Source of file CollectionWriteInterface.php
Size: 1,353 Bytes - Last Modified: 2016-07-22T15:31:35+00:00
/home/travis/build/Nayjest/Collection/src/CollectionWriteInterface.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | <?php namespace Nayjest\Collection; use Traversable; use Evenement\EventEmitterInterface; /** * CollectionWriteInterface describes methods that changes collection. */ interface CollectionWriteInterface extends EventEmitterInterface { public function onItemAdd(callable $callback); public function onItemRemove(callable $callback); public function onChange(callable $callback); /** * Adds item to collection. * * @param $item * @param bool $prepend false by default * * @return $this */ public function add($item, $prepend = false); /** * Adds multiple to collection. * * @param array|Traversable $items * @param bool $prepend false by default * * @return $this */ public function addMany($items, $prepend = false); public function replace($oldItem, $newItem, $forceAdd = true); /** * Removes all items from collection. * * @return $this */ public function clear(); /** * Removes items equals to specified value from collection. * * @param $item * * @return $this */ public function remove($item); /** * Removes old and sets new collection items. * * @param array|Traversable $items * * @return $this */ public function set($items); } |