|
|
@ -83,7 +83,7 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Seri
|
|
|
|
* @return static
|
|
|
|
* @return static
|
|
|
|
* @psalm-return static<TKey, TValue>
|
|
|
|
* @psalm-return static<TKey, TValue>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function slice (int $offset, ?int $length = null): IImmutableCollection;
|
|
|
|
public function slice (int $offset, ?int $length = null): self;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get a collection of all elements that satisfy predicate $filter
|
|
|
|
* Get a collection of all elements that satisfy predicate $filter
|
|
|
@ -95,7 +95,23 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Seri
|
|
|
|
* @return static The result collection
|
|
|
|
* @return static The result collection
|
|
|
|
* @psalm-return static<TKey, TValue>
|
|
|
|
* @psalm-return static<TKey, TValue>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function filter (Closure $filter): IImmutableCollection;
|
|
|
|
public function filter (Closure $filter): self;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Get a collection of all not empty elements
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Use {@see https://www.php.net/manual/function.empty.php empty} to check if element is empty or not
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return static The result collection
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function withoutEmpties (): self;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Remove all empty elements on current collection
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Use {@see https://www.php.net/manual/function.empty.php empty} to check if element is empty or not
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return $this
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function removeEmpties (): self;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A new collection with $process applied on all elements
|
|
|
|
* A new collection with $process applied on all elements
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -108,7 +124,7 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Seri
|
|
|
|
* @return static
|
|
|
|
* @return static
|
|
|
|
* @psalm-return static<TKey, TResultValue>
|
|
|
|
* @psalm-return static<TKey, TResultValue>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function map (Closure $process): IImmutableCollection;
|
|
|
|
public function map (Closure $process): self;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The list of all keys
|
|
|
|
* The list of all keys
|
|
|
@ -116,12 +132,30 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Seri
|
|
|
|
* @return static The list of all keys
|
|
|
|
* @return static The list of all keys
|
|
|
|
* @psalm-return static<int, TKey>
|
|
|
|
* @psalm-return static<int, TKey>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function keys (): IImmutableCollection;
|
|
|
|
public function keys (): self;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The list of all values
|
|
|
|
* The list of all values
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return static The list of all values
|
|
|
|
* @return static The list of all values
|
|
|
|
* @psalm-return static<int, TValue>
|
|
|
|
* @psalm-return static<int, TValue>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function values (): IImmutableCollection;
|
|
|
|
public function values (): self;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Join all values with a separator
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $separator The separator
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return string The joined values
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function join (string $separator): string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Create a collection of split values
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $value The value to split
|
|
|
|
|
|
|
|
* @param string $separator The split separator
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return static
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static function split (string $value, string $separator): self;
|
|
|
|
}
|
|
|
|
}
|