Changeset View
Changeset View
Standalone View
Standalone View
src/parser/aast/api/AASTNodeList.php
| <?php | <?php | ||||
| final class AASTNodeList implements Countable, Iterator { | final class AASTNodeList | ||||
| extends Phobject | |||||
| implements Countable, Iterator { | |||||
| protected $list; | protected $list; | ||||
| protected $tree; | protected $tree; | ||||
| protected $ids; | protected $ids; | ||||
| protected $pos; | protected $pos; | ||||
| protected function __construct() {} | protected function __construct() {} | ||||
| Show All 40 Lines | public function getTokens() { | ||||
| return $tokens; | return $tokens; | ||||
| } | } | ||||
| public function getRawNodes() { | public function getRawNodes() { | ||||
| return $this->list; | return $this->list; | ||||
| } | } | ||||
| public static function newFromTreeAndNodes(AASTTree $tree, array $nodes) { | public static function newFromTreeAndNodes(AASTTree $tree, array $nodes) { | ||||
| assert_instances_of($nodes, 'AASTNode'); | // We could do `assert_instances_of($nodes, 'AASTNode')` here, but doing | ||||
| // so imposes an observable performance penalty for linting. | |||||
| $obj = new AASTNodeList(); | $obj = new AASTNodeList(); | ||||
| $obj->tree = $tree; | $obj->tree = $tree; | ||||
| $obj->list = $nodes; | $obj->list = $nodes; | ||||
| $obj->ids = array_keys($nodes); | $obj->ids = array_keys($nodes); | ||||
| return $obj; | return $obj; | ||||
| } | } | ||||
| Show All 39 Lines | |||||