コード例 #1
0
 /**
  * @test
  */
 public function convertToBooleanProperlyConvertsObjects()
 {
     $this->assertFalse(BooleanNode::convertToBoolean(NULL));
     $this->assertTrue(BooleanNode::convertToBoolean(new \stdClass()));
 }
コード例 #2
0
 /**
  * @param NodeInterface $node
  * @param RenderingContextInterface $renderingContext
  * @return boolean
  */
 public static function createFromNodeAndEvaluate(NodeInterface $node, RenderingContextInterface $renderingContext)
 {
     $booleanNode = new BooleanNode($node);
     return $booleanNode->evaluate($renderingContext);
 }
コード例 #3
0
 /**
  * @param BooleanNode $node
  * @return array
  * @see convert()
  */
 protected function convertBooleanNode(BooleanNode $node)
 {
     $stack = $this->convertArrayNode(new ArrayNode($node->getStack()));
     $initializationPhpCode = '// Rendering Boolean node' . chr(10);
     $initializationPhpCode = $stack['initialization'] . chr(10);
     return array('initialization' => $initializationPhpCode, 'execution' => sprintf('\\NamelessCoder\\Fluid\\Core\\Parser\\SyntaxTree\\BooleanNode::evaluateStack($renderingContext, %s)', $stack['execution']));
 }