/** * Compiles given DOM element with directives added to main PhCompile object. * * @param \DOMElement $element Dom element to compile. * @return boolean Returns false if compilation was interrupted, true otherwise. */ protected function compileNode(\DOMElement $element) { /** * Clone queue so we won't lost original data. */ $directives = clone $this->phCompile->getDirectives(); $interrupt = false; foreach ($directives as $directive) { if ($directive->isRestrict('E') === true) { $interrupt = $this->compileElement($element, $directive); } if ($interrupt === false && $directive->isRestrict('A') === true) { $interrupt = $this->compileAttribute($element, $directive); } if ($interrupt === false && $directive->isRestrict('C') === true) { $interrupt = $this->compileClass($element, $directive); } if ($interrupt === true) { return false; } } return true; }
/** * @covers PhCompile\PhCompile::addDefaultDirectives * @covers PhCompile\PhCompile::__construct * @depends testGetDirectives */ public function testNoDefaultDirectives() { $config = array('directive' => array('defaults' => false)); $phCompile = new PhCompile($config); $this->assertEmpty($phCompile->getDirectives()); }