| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | namespace Salient\Contract\Collection; |
| 4: | |
| 5: | /** |
| 6: | * @api |
| 7: | * |
| 8: | * @template TKey of array-key |
| 9: | * @template TValue |
| 10: | * @template TArrayValue = TValue |
| 11: | * |
| 12: | * @extends DictionaryInterface<TKey,TValue,TArrayValue> |
| 13: | */ |
| 14: | interface CollectionInterface extends DictionaryInterface |
| 15: | { |
| 16: | /** |
| 17: | * Add an item |
| 18: | * |
| 19: | * @param TValue $value |
| 20: | * @return static<TKey|int,TValue,TArrayValue> |
| 21: | */ |
| 22: | public function add($value); |
| 23: | |
| 24: | /** |
| 25: | * Push items onto the end of the collection |
| 26: | * |
| 27: | * @param TValue ...$items |
| 28: | * @return static<TKey|int,TValue,TArrayValue> |
| 29: | */ |
| 30: | public function push(...$items); |
| 31: | |
| 32: | /** |
| 33: | * Add items to the beginning of the collection |
| 34: | * |
| 35: | * Items are added in one operation and stay in the given order. |
| 36: | * |
| 37: | * @param TValue ...$items |
| 38: | * @return static<TKey|int,TValue,TArrayValue> |
| 39: | */ |
| 40: | public function unshift(...$items); |
| 41: | } |
| 42: |