| @@ 144-158 (lines=15) @@ | ||
| 141 | $this->pos = 0; |
|
| 142 | } |
|
| 143 | ||
| 144 | public function current() |
|
| 145 | { |
|
| 146 | if (!is_array($this->result)) { |
|
| 147 | return $this->pos === 0 ? $this->result : null; |
|
| 148 | } elseif ($this->resultType === static::RESULT_TYPE_DEFAULT || $this->resultType === static::RESULT_TYPE_ARGSVALS) { |
|
| 149 | return $this->result[$this->pos]; |
|
| 150 | } elseif ($this->resultType === static::RESULT_TYPE_MESSAGE) { |
|
| 151 | // message |
|
| 152 | return $this->result[2]; |
|
| 153 | } elseif ($this->resultType === static::RESULT_TYPE_ASSOC) { |
|
| 154 | return $this->result[$this->pos * 2 + 1]; |
|
| 155 | } |
|
| 156 | } |
|
| 157 | ||
| 158 | public function key() |
|
| 159 | { |
|
| 160 | if (!is_array($this->result)) { |
|
| 161 | return $this->pos === 0 ? 0 : null; |
|
| @@ 158-175 (lines=18) @@ | ||
| 155 | } |
|
| 156 | } |
|
| 157 | ||
| 158 | public function key() |
|
| 159 | { |
|
| 160 | if (!is_array($this->result)) { |
|
| 161 | return $this->pos === 0 ? 0 : null; |
|
| 162 | } elseif ($this->resultType === static::RESULT_TYPE_DEFAULT) { |
|
| 163 | return $this->pos; |
|
| 164 | } elseif ($this->resultType === static::RESULT_TYPE_MESSAGE) { |
|
| 165 | // channel |
|
| 166 | return $this->result[1]; |
|
| 167 | } elseif ($this->resultType === static::RESULT_TYPE_ARGSVALS) { |
|
| 168 | return $this->args[$this->pos]; |
|
| 169 | } elseif ($this->resultType === static::RESULT_TYPE_ASSOC) { |
|
| 170 | return $this->result[$this->pos * 2]; |
|
| 171 | } |
|
| 172 | } |
|
| 173 | ||
| 174 | public function next() |
|
| 175 | { |
|
| 176 | ++$this->pos; |
|
| 177 | } |
|
| 178 | ||