| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | namespace Salient\Contract\Iterator; |
| 4: | |
| 5: | use Salient\Contract\Core\Arrayable; |
| 6: | use Traversable; |
| 7: | |
| 8: | /** |
| 9: | * @api |
| 10: | * |
| 11: | * @template TKey of array-key |
| 12: | * @template TValue |
| 13: | * |
| 14: | * @extends Arrayable<TKey,TValue> |
| 15: | * @extends Traversable<TKey,TValue> |
| 16: | */ |
| 17: | interface FluentIteratorInterface extends Arrayable, Traversable |
| 18: | { |
| 19: | /** |
| 20: | * Get the iterator's elements as an array |
| 21: | */ |
| 22: | public function toArray(bool $preserveKeys = true): array; |
| 23: | |
| 24: | /** |
| 25: | * Get the first element in the iterator with the given value at the given |
| 26: | * key, or null if no such element is found |
| 27: | * |
| 28: | * @param array-key $key |
| 29: | * @param mixed $value |
| 30: | * @return (TValue&(object|mixed[]))|null |
| 31: | */ |
| 32: | public function getFirstWith($key, $value, bool $strict = false); |
| 33: | } |
| 34: |