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