| @@ 44-54 (lines=11) @@ | ||
| 41 | * {@inheritDoc} |
|
| 42 | * @return $this |
|
| 43 | */ |
|
| 44 | public function filter(callable $callable) |
|
| 45 | { |
|
| 46 | $res = new static(); |
|
| 47 | foreach ($this as $v) { |
|
| 48 | if ($callable($v)) { |
|
| 49 | $res[] = $v; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | return $res; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * {@inheritDoc} |
|
| @@ 113-124 (lines=12) @@ | ||
| 110 | return $res; |
|
| 111 | } |
|
| 112 | ||
| 113 | public function takeWhile(callable $callable) |
|
| 114 | { |
|
| 115 | $res = new static(); |
|
| 116 | foreach ($this as $v) { |
|
| 117 | if (!$callable($v)) { |
|
| 118 | break; |
|
| 119 | } |
|
| 120 | $res[] = $v; |
|
| 121 | } |
|
| 122 | ||
| 123 | return $res; |
|
| 124 | } |
|
| 125 | ||
| 126 | public function skip($n) |
|
| 127 | { |
|