コード例 #1
0
ファイル: EchoStatementNode.php プロジェクト: kidaa30/redcat
 /**
  * Return the expressions being echoed.
  *
  * @return NodeCollection|ExpressionNode[]
  */
 public function getExpressions()
 {
     return $this->expressions->getItems();
 }
コード例 #2
0
 public function testToArrayNode()
 {
     $list = new CommaListNode();
     $list->appendItem(Node::fromValue('foo'));
     $list->appendItem(Node::fromValue('baz'));
     $list->appendItem(Node::fromValue(30));
     $array = $list->toArrayNode();
     $this->assertInstanceOf('\\Pharborist\\Types\\ArrayNode', $array);
     /** @var \PHarborist\Types\ScalarNode[] $elements */
     $elements = $array->getElements();
     $this->assertCount(3, $elements);
     $this->assertInstanceOf('\\Pharborist\\Types\\StringNode', $elements[0]);
     $this->assertEquals('foo', $elements[0]->toValue());
     $this->assertInstanceOf('\\Pharborist\\Types\\StringNode', $elements[1]);
     $this->assertEquals('baz', $elements[1]->toValue());
     $this->assertInstanceOf('\\Pharborist\\Types\\IntegerNode', $elements[2]);
     $this->assertEquals(30, $elements[2]->toValue());
     $this->assertEquals("['foo', 'baz', 30]", $array->getText());
 }