@@ 157-175 (lines=19) @@ | ||
154 | return $res; |
|
155 | } |
|
156 | ||
157 | public function slice($start, $length) |
|
158 | { |
|
159 | $res = new static(); |
|
160 | if ($length <= 0) { |
|
161 | return $res; |
|
162 | } |
|
163 | foreach ($this as $v) { |
|
164 | if ($start !== 0) { |
|
165 | --$start; |
|
166 | continue; |
|
167 | } |
|
168 | $res[] = $v; |
|
169 | if (--$length === 0) { |
|
170 | break; |
|
171 | } |
|
172 | } |
|
173 | ||
174 | return $res; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * {@inheritDoc} |
@@ 142-160 (lines=19) @@ | ||
139 | return $res; |
|
140 | } |
|
141 | ||
142 | public function slice($start, $lenght) |
|
143 | { |
|
144 | $res = new static(); |
|
145 | if ($lenght <= 0) { |
|
146 | return $res; |
|
147 | } |
|
148 | foreach ($this as $k => $v) { |
|
149 | if ($start !== 0) { |
|
150 | --$start; |
|
151 | continue; |
|
152 | } |
|
153 | $res[$k] = $v; |
|
154 | if (--$lenght === 0) { |
|
155 | break; |
|
156 | } |
|
157 | } |
|
158 | ||
159 | return $res; |
|
160 | } |
|
161 | ||
162 | public function first() |
|
163 | { |