| @@ 135-148 (lines=14) @@ | ||
| 132 | * |
|
| 133 | * @return $this |
|
| 134 | */ |
|
| 135 | public function each(callable $callable) |
|
| 136 | { |
|
| 137 | $type = $this->determineFirstParameterType($callable); |
|
| 138 | ||
| 139 | foreach ($this->items as $item) { |
|
| 140 | if ($type !== null && !$item instanceof $type) { |
|
| 141 | continue; |
|
| 142 | } |
|
| 143 | ||
| 144 | $callable($item); |
|
| 145 | } |
|
| 146 | ||
| 147 | return $this; |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Register a filter to the menu. When an item is added, all filters will be applied to the |
|
| @@ 302-317 (lines=16) @@ | ||
| 299 | * |
|
| 300 | * @return $this |
|
| 301 | */ |
|
| 302 | public function setActive(callable $callable) |
|
| 303 | { |
|
| 304 | $type = $this->determineFirstParameterType($callable); |
|
| 305 | ||
| 306 | foreach ($this->items as $item) { |
|
| 307 | if ($type !== null && !$item instanceof $type) { |
|
| 308 | continue; |
|
| 309 | } |
|
| 310 | ||
| 311 | if ($callable($item)) { |
|
| 312 | $item->setActive(); |
|
| 313 | } |
|
| 314 | } |
|
| 315 | ||
| 316 | return $this; |
|
| 317 | } |
|
| 318 | ||
| 319 | /** |
|
| 320 | * @return string |
|