Skip to content

Commit

Permalink
Merge pull request #16 from phug-php/analysis-q2gY7R
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
TorbenKoehn authored Jul 10, 2017
2 parents ed7997c + b366df3 commit a84b6bf
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 21 deletions.
13 changes: 6 additions & 7 deletions src/Phug/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public function __construct(array $options = null)
'default_tag' => 'div',
'default_doctype' => 'html',
'on_compile' => null,
'on_output' => null,
'on_node' => null,
'on_element' => null,
'on_output' => null,
'on_node' => null,
'on_element' => null,
'filters' => [],
'parser_class_name' => Parser::class,
'parser_options' => [],
Expand Down Expand Up @@ -475,7 +475,6 @@ public function getBlocks()
*/
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
{

$e = new NodeEvent($node);
$this->trigger($e);
$node = $e->getNode();
Expand Down Expand Up @@ -607,7 +606,7 @@ public function dumpFile($fileName)
* blocks compiled.
*
* @param string $input pug input
* @param string $path optional path of the compiled source
* @param string $path optional path of the compiled source
*
* @throws CompilerException
*
Expand Down Expand Up @@ -682,13 +681,12 @@ public function compileDocument($input, $path = null)
* Returns PHTML from pug input.
*
* @param string $input pug input
* @param string $path optional path of the compiled source
* @param string $path optional path of the compiled source
*
* @return string
*/
public function compile($input, $path = null)
{

$e = new CompileEvent($input, $path);
$this->trigger($e);

Expand All @@ -702,6 +700,7 @@ public function compile($input, $path = null)

$e = new OutputEvent($output);
$this->trigger($e);

return $e->getOutput();
}

Expand Down
3 changes: 1 addition & 2 deletions src/Phug/Compiler/Event/CompileEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

class CompileEvent extends Event
{

private $input;
private $path;

/**
* CompileEvent constructor.
*
* @param string $input
* @param string $input
* @param string|null $path
*/
public function __construct($input, $path = null)
Expand Down
1 change: 0 additions & 1 deletion src/Phug/Compiler/Event/OutputEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class OutputEvent extends Event
{

private $output;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Phug/CompilerEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class CompilerEvent
{

const COMPILE = 'compiler.compile';
const OUTPUT = 'compiler.output';
const NODE = 'compiler.node';
Expand Down
2 changes: 1 addition & 1 deletion src/Phug/CompilerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function compileIntoElement($pugInput, $fileName = null);

/**
* @param string $input pug input
* @param string $path optional path of the compiled source
* @param string $path optional path of the compiled source
*
* @throws CompilerException
*
Expand Down
2 changes: 0 additions & 2 deletions tests/Phug/Compiler/NodeCompiler/FilterNodeCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Phug\Test\Compiler\NodeCompiler;

use Phug\Ast\NodeInterface;
use Phug\Compiler;
use Phug\Compiler\NodeCompiler\FilterNodeCompiler;
use Phug\Formatter\Element\DocumentElement;
Expand Down Expand Up @@ -153,7 +152,6 @@ public function testFilterChildrenException()

$compiler = new Compiler([
'on_element' => function (Compiler\Event\ElementEvent $e) {

if ($e->getElement() instanceof TextElement) {
$e->setElement(new DocumentElement());
}
Expand Down
7 changes: 0 additions & 7 deletions tests/Phug/CompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
use Phug\Formatter;
use Phug\Formatter\Element\CodeElement;
use Phug\Formatter\Element\MarkupElement;
use Phug\Formatter\ElementInterface;
use Phug\LexerException;
use Phug\Parser;
use Phug\Parser\Node\ElementNode;
use Phug\Parser\NodeInterface;
use Phug\ParserException;

/**
Expand Down Expand Up @@ -209,14 +207,12 @@ public function testHooks()
{
$compiler = new Compiler([
'on_node' => function (Compiler\Event\NodeEvent $e) {

$node = $e->getNode();
if ($node instanceof ElementNode) {
$node->setName($node->getName().'b');
}
},
'on_element' => function (Compiler\Event\ElementEvent $e) {

$element = $e->getElement();
if ($element instanceof MarkupElement) {
$element->setName($element->getName().'c');
Expand All @@ -228,11 +224,9 @@ public function testHooks()

$compiler = new Compiler([
'on_compile' => function (Compiler\Event\CompileEvent $e) {

$e->setInput($e->getInput().' Hello');
},
'on_output' => function (Compiler\Event\OutputEvent $e) {

$e->setOutput('<p>'.$e->getOutput().'</p>');
},
]);
Expand Down Expand Up @@ -267,7 +261,6 @@ public function testHooks()
],
]);
$compiler->attach(CompilerEvent::COMPILE, function (Compiler\Event\CompileEvent $e) use ($compiler) {

$compiler->setOption('jsphpize_engine', new JsPhpize([
'catchDependencies' => true,
]));
Expand Down

0 comments on commit a84b6bf

Please sign in to comment.