| @@ 99-110 (lines=12) @@ | ||
| 96 | * @var string $key |
|
| 97 | * @var mixed $value |
|
| 98 | */ |
|
| 99 | public function unshift($key, $value) { |
|
| 100 | $oldItems = $this->firstItems; |
|
| 101 | $this->firstItems = array( |
|
| 102 | $key => $value |
|
| 103 | ); |
|
| 104 | ||
| 105 | if($oldItems) { |
|
| 106 | $this->firstItems = $this->firstItems + $oldItems; |
|
| 107 | } |
|
| 108 | ||
| 109 | return $this; |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * Pushes an item onto the end of the map. |
|
| @@ 118-130 (lines=13) @@ | ||
| 115 | * @var string $key |
|
| 116 | * @var mixed $value |
|
| 117 | */ |
|
| 118 | public function push($key, $value) { |
|
| 119 | $oldItems = $this->lastItems; |
|
| 120 | ||
| 121 | $this->lastItems = array( |
|
| 122 | $key => $value |
|
| 123 | ); |
|
| 124 | ||
| 125 | if($oldItems) { |
|
| 126 | $this->lastItems = $this->lastItems + $oldItems; |
|
| 127 | } |
|
| 128 | ||
| 129 | return $this; |
|
| 130 | } |
|
| 131 | ||
| 132 | // ArrayAccess |
|
| 133 | ||