Changeset View
Changeset View
Standalone View
Standalone View
src/utils/PhutilArray.php
Show All 23 Lines | /* -( Conversion )--------------------------------------------------------- */ | ||||
public function toArray() { | public function toArray() { | ||||
return iterator_to_array($this, true); | return iterator_to_array($this, true); | ||||
} | } | ||||
/* -( Countable Interface )------------------------------------------------ */ | /* -( Countable Interface )------------------------------------------------ */ | ||||
#[\ReturnTypeWillChange] | |||||
public function count() { | public function count() { | ||||
return count($this->data); | return count($this->data); | ||||
} | } | ||||
/* -( Iterator Interface )------------------------------------------------- */ | /* -( Iterator Interface )------------------------------------------------- */ | ||||
#[\ReturnTypeWillChange] | |||||
public function current() { | public function current() { | ||||
return current($this->data); | return current($this->data); | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function key() { | public function key() { | ||||
return key($this->data); | return key($this->data); | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function next() { | public function next() { | ||||
return next($this->data); | return next($this->data); | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function rewind() { | public function rewind() { | ||||
reset($this->data); | reset($this->data); | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function valid() { | public function valid() { | ||||
return (key($this->data) !== null); | return (key($this->data) !== null); | ||||
} | } | ||||
/* -( ArrayAccess Interface )---------------------------------------------- */ | /* -( ArrayAccess Interface )---------------------------------------------- */ | ||||
#[\ReturnTypeWillChange] | |||||
public function offsetExists($key) { | public function offsetExists($key) { | ||||
return array_key_exists($key, $this->data); | return array_key_exists($key, $this->data); | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function offsetGet($key) { | public function offsetGet($key) { | ||||
return $this->data[$key]; | return $this->data[$key]; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function offsetSet($key, $value) { | public function offsetSet($key, $value) { | ||||
$this->data[$key] = $value; | $this->data[$key] = $value; | ||||
} | } | ||||
#[\ReturnTypeWillChange] | |||||
public function offsetUnset($key) { | public function offsetUnset($key) { | ||||
unset($this->data[$key]); | unset($this->data[$key]); | ||||
} | } | ||||
} | } |