@@ 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} |
@@ 127-145 (lines=19) @@ | ||
124 | return $res; |
|
125 | } |
|
126 | ||
127 | public function slice($start, $lenght) |
|
128 | { |
|
129 | $res = new static(); |
|
130 | if ($lenght <= 0) { |
|
131 | return $res; |
|
132 | } |
|
133 | foreach ($this as $k => $v) { |
|
134 | if ($start !== 0) { |
|
135 | --$start; |
|
136 | continue; |
|
137 | } |
|
138 | $res[$k] = $v; |
|
139 | if (--$lenght === 0) { |
|
140 | break; |
|
141 | } |
|
142 | } |
|
143 | ||
144 | return $res; |
|
145 | } |
|
146 | ||
147 | public function first() |
|
148 | { |