Changeset View
Changeset View
Standalone View
Standalone View
src/parser/aast/api/AASTNodeList.php
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public static function newFromTree(AASTTree $tree) { | ||||
$obj->list = array(0 => $tree->getRootNode()); | $obj->list = array(0 => $tree->getRootNode()); | ||||
$obj->ids = array(0 => 0); | $obj->ids = array(0 => 0); | ||||
return $obj; | return $obj; | ||||
} | } | ||||
/* -( Countable )---------------------------------------------------------- */ | /* -( Countable )---------------------------------------------------------- */ | ||||
#[\ReturnTypeWillChange] | |||||
public function count() { | public function count() { | ||||
return count($this->ids); | return count($this->ids); | ||||
} | } | ||||
/* -( Iterator )----------------------------------------------------------- */ | /* -( Iterator )----------------------------------------------------------- */ | ||||
#[\ReturnTypeWillChange] | |||||
public function current() { | public function current() { | ||||
return $this->list[$this->key()]; | return $this->list[$this->key()]; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function key() { | public function key() { | ||||
return $this->ids[$this->pos]; | return $this->ids[$this->pos]; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function next() { | public function next() { | ||||
$this->pos++; | $this->pos++; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function rewind() { | public function rewind() { | ||||
$this->pos = 0; | $this->pos = 0; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function valid() { | public function valid() { | ||||
return $this->pos < count($this->ids); | return $this->pos < count($this->ids); | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0