repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/ZipOperation.php
src/Fp/Operations/ZipOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; use function Fp\Cast\asGenerator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class ZipOperation extends AbstractOperation { /** * @template TVI * * @param iterable<mixed, TVI> $that...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/FilterNotNullOperation.php
src/Fp/Operations/FilterNotNullOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class FilterNotNullOperation extends AbstractOperation { /** * @return Generator<TK, TV> */ public function __invoke(): Generator { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/InitOperation.php
src/Fp/Operations/InitOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class InitOperation extends AbstractOperation { /** * @return Generator<TK, TV> */ public function __invoke(): Generator { if (!...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/GroupAdjacentByOperation.php
src/Fp/Operations/GroupAdjacentByOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class GroupAdjacentByOperation extends AbstractOperation { /** * @template D * * @param callable(TV): D $discriminator * @return Gener...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/FirstMapOperation.php
src/Fp/Operations/FirstMapOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class FirstMapOperation extends AbstractOperation { /** * @template TVO * * @param callable(TK, TV): Option<TVO> $f ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/KeysOperation.php
src/Fp/Operations/KeysOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class KeysOperation extends AbstractOperation { /** * @return Generator<int, TK> */ public function __invoke(): Generator { fore...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/GroupByOperation.php
src/Fp/Operations/GroupByOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\HashMap; use Fp\Collections\HashTable; use Fp\Collections\Map; use Fp\Collections\NonEmptyHashMap; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class GroupByOperation extends AbstractOperation { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/EveryOperation.php
src/Fp/Operations/EveryOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class EveryOperation extends AbstractOperation { /** * @param callable(TK, TV): bool $f * @return bool */ public function __invoke(callable $f): bool ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/TraverseOptionOperation.php
src/Fp/Operations/TraverseOptionOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Closure; use Fp\Collections\HashTable; use Fp\Functional\Option\Option; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class TraverseOptionOperation extends AbstractOperation { /** * @template...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/DropOperation.php
src/Fp/Operations/DropOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class DropOperation extends AbstractOperation { /** * @return Generator<TK, TV> */ public function __invoke(int $length): Generator { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/FilterOperation.php
src/Fp/Operations/FilterOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class FilterOperation extends AbstractOperation { /** * @param callable(TK, TV): bool $f * @return Generator<TK, TV> */ public function...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MapOperation.php
src/Fp/Operations/MapOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class MapOperation extends AbstractOperation { /** * @template TVO * * @param callable(TK, TV): TVO $f * @return Generator<TK, TVO> ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/RepeatOperation.php
src/Fp/Operations/RepeatOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\ArrayList; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class RepeatOperation extends AbstractOperation { /** * @return Generator<int, TV> */ public function __invoke...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/InterleaveOperation.php
src/Fp/Operations/InterleaveOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class InterleaveOperation extends AbstractOperation { /** * @template TVI * * @param iterable<mixed, TVI> $that * @return Generator<in...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/AbstractOperation.php
src/Fp/Operations/AbstractOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\Collection; use Generator; use function Fp\Cast\asGenerator; /** * @template TK * @template TV * @psalm-consistent-constructor * @psalm-consistent-templates */ abstract class AbstractOperation { /** * @var Generator<TK, TV> ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/UniqueByOperation.php
src/Fp/Operations/UniqueByOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\HashTable; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class UniqueByOperation extends AbstractOperation { /** * @param callable(TV): mixed $callback * @return Generator...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/GroupMapOperation.php
src/Fp/Operations/GroupMapOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\HashMap; use Fp\Collections\HashTable; use Fp\Collections\Map; use Fp\Collections\NonEmptyHashMap; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class GroupMapOperation extends AbstractOperation { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MinElementOperation.php
src/Fp/Operations/MinElementOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class MinElementOperation extends AbstractOperation { /** * @return Option<TV> */ public function __invoke(): Option {...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/GroupMapReduceOperation.php
src/Fp/Operations/GroupMapReduceOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\HashMap; use Fp\Collections\HashTable; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class GroupMapReduceOperation extends AbstractOperation { /** * @template TKO * @template TVO * ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/AtOperation.php
src/Fp/Operations/AtOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class AtOperation extends AbstractOperation { /** * @param TK $pos * @return Option<TV> */ public function __invoke(m...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/AppendedOperation.php
src/Fp/Operations/AppendedOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class AppendedOperation extends AbstractOperation { /** * @template TVI * * @param TVI $elem * @return Generator<TV|TVI> */ p...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/FlattenOperation.php
src/Fp/Operations/FlattenOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; final class FlattenOperation { /** * @template TKO * @template TVO * * @param iterable<iterable<TKO, TVO>> $collection * @return Generator<TKO, TVO> */ public static function of(iterable $collection): Genera...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/TakeWhileOperation.php
src/Fp/Operations/TakeWhileOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class TakeWhileOperation extends AbstractOperation { /** * @template TKO * * @param callable(TK, TV): bool $f * @return Generator<TK, ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/ValuesOperation.php
src/Fp/Operations/ValuesOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class ValuesOperation extends AbstractOperation { /** * @return Generator<int, TV> */ public function __invoke(): Generator { fo...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/CountOperation.php
src/Fp/Operations/CountOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class CountOperation extends AbstractOperation { public function __invoke(): int { $counter = 0; foreach ($this->gen as $ignored) { $coun...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MinByElementOperation.php
src/Fp/Operations/MinByElementOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class MinByElementOperation extends AbstractOperation { /** * @param callable(TV): mixed $by * @return Option<TV> */ ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/ReindexOperation.php
src/Fp/Operations/ReindexOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class ReindexOperation extends AbstractOperation { /** * @template TKO * * @param callable(TK, TV): TKO $f * @return Generator<TKO, TV...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/ChunksOperation.php
src/Fp/Operations/ChunksOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class ChunksOperation extends AbstractOperation { /** * @param positive-int $size * @return Generator<int, non-empty-list<TV>> */ publi...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/TraverseEitherOperation.php
src/Fp/Operations/TraverseEitherOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Closure; use Fp\Collections\HashTable; use Fp\Functional\Either\Either; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class TraverseEitherOperation extends AbstractOperation { /** * @template...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/LastOperation.php
src/Fp/Operations/LastOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class LastOperation extends AbstractOperation { /** * @param null|callable(TK, TV): bool $f * @return Option<TV> */ p...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/TakeOperation.php
src/Fp/Operations/TakeOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class TakeOperation extends AbstractOperation { /** * @return Generator<TK, TV> */ public function __invoke(int $length): Generator { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MkStringOperation.php
src/Fp/Operations/MkStringOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use function Fp\Collection\fold; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class MkStringOperation extends AbstractOperation { public function __invoke(string $start, string $sep, string $end): string { ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/SecondOperation.php
src/Fp/Operations/SecondOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class SecondOperation extends AbstractOperation { /** * @param null|callable(TV): bool $f * @return Option<TV> */ pub...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/SortedOperation.php
src/Fp/Operations/SortedOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use function Fp\Cast\asList; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class SortedOperation extends AbstractOperation { /** * @param callable(TV, TV): int $f * @return list<TV> */ public func...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/IntersperseOperation.php
src/Fp/Operations/IntersperseOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class IntersperseOperation extends AbstractOperation { /** * @template TVI * * @param TVI $separator * @return Generator<TK|int, TV|TV...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/ToStringOperation.php
src/Fp/Operations/ToStringOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Stringable; use Throwable; use function Fp\Collection\map; use function Fp\Collection\mapKV; use function Fp\Util\jsonEncode; final class ToStringOperation { public static function of(mixed $value): string { if ($value instanceof Throwable...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MergeMapOperation.php
src/Fp/Operations/MergeMapOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Collections\Map; use Fp\Collections\NonEmptyMap; use Generator; /** * @template TK * @template TV * @extends AbstractOperation<TK, TV> */ final class MergeMapOperation extends AbstractOperation { /** * @template TKO * @template TVO ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/TapOperation.php
src/Fp/Operations/TapOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class TapOperation extends AbstractOperation { /** * @param callable(TK, TV): void $f * @return Generator<TK, TV> */ public function __...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/PrependedOperation.php
src/Fp/Operations/PrependedOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class PrependedOperation extends AbstractOperation { /** * @template TVI * * @param TVI $elem * @return Generator<TV|TVI> */ ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/AppendedAllOperation.php
src/Fp/Operations/AppendedAllOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class AppendedAllOperation extends AbstractOperation { /** * @template TVI * * @param iterable<mixed, TVI> $suffix * @return Generator...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/PrependedAllOperation.php
src/Fp/Operations/PrependedAllOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Generator; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class PrependedAllOperation extends AbstractOperation { /** * @template TVI * * @param iterable<mixed, TVI> $prefix * @return Generato...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Operations/MaxByElementOperation.php
src/Fp/Operations/MaxByElementOperation.php
<?php declare(strict_types=1); namespace Fp\Operations; use Fp\Functional\Option\Option; /** * @template TK * @template TV * * @extends AbstractOperation<TK, TV> */ final class MaxByElementOperation extends AbstractOperation { /** * @param callable(TV): mixed $by * @return Option<TV> */ ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Panic.php
src/Fp/Functions/Panic.php
<?php declare(strict_types=1); namespace Fp; use RuntimeException; /** * @return empty */ function panic(string $message, float|int|string ...$args): mixed { throw new RuntimeException(sprintf($message, ...$args)); }
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Unit.php
src/Fp/Functions/Unit.php
<?php declare(strict_types=1); namespace Fp; use Fp\Functional\Unit; const unit = '\Fp\unit'; /** * Represents no return value for do-notation * * ```php * >>> Option::do(function () { * yield proveTrue(true); * return unit(); * }) * => Some(Unit()) * ``` */ function unit(): Unit { return Uni...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Id.php
src/Fp/Functions/Id.php
<?php declare(strict_types=1); namespace Fp; const id = '\Fp\id'; /** * Identity function * * ```php * >>> id(1); * => 1 * ``` * * @template T * * @param T $value * @return T */ function id(mixed $value): mixed { return $value; }
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsInt.php
src/Fp/Functions/Cast/AsInt.php
<?php declare(strict_types=1); namespace Fp\Cast; use Fp\Functional\Option\Option; /** * Try cast integer like value * Returns None if cast is not possible * * ```php * >>> asInt('1'); * => Some(1) * * >>> asInt('zxc'); * => None * ``` * * @return Option<int> */ function asInt(mixed $subject): Option {...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsGenerator.php
src/Fp/Functions/Cast/AsGenerator.php
<?php declare(strict_types=1); namespace Fp\Cast; use Generator; /** * ```php * >>> asGenerator(function() { yield 1; yield 2; }); * => Generator(1, 2) * ``` * * @template TK * @template TV * * @param callable(): (iterable<TK, TV> | Generator<TK, TV>) $callback * @return Generator<TK, TV> */ function asG...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsArray.php
src/Fp/Functions/Cast/AsArray.php
<?php declare(strict_types=1); namespace Fp\Cast; /** * Copy iterable as array * * ```php * >>> asArray(LinkedList::collect([1, 2])); * => [1, 2] * ``` * * @template TK of array-key * @template TV * * @param iterable<TK, TV> $collections * @param TP $preserveKeys * @return ( * $collections is non-e...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsString.php
src/Fp/Functions/Cast/AsString.php
<?php declare(strict_types=1); namespace Fp\Cast; use Stringable; use Fp\Functional\Option\Option; /** * Try cast value to string * Returns None if cast is not possible * * ```php * >>> asString('1'); * => Some('1') * * >>> asString(1); * => Some('1') * * >>> asString(...any Stringable object...) * >>> ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsEnumOf.php
src/Fp/Functions/Cast/AsEnumOf.php
<?php namespace Fp\Cast; use Closure; use BackedEnum; use Fp\Functional\Option\Option; /** * Cast string or int to BackedEnum instance. * * ```php * >>> asEnumOf(1, IntEnum::class) * => Some(IntEnum(1)) * >>> asEnumOf(42, IntEnum::class) * => None * ``` * * @template TEnum of BackedEnum * * @param class-...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsNonEmptyArray.php
src/Fp/Functions/Cast/AsNonEmptyArray.php
<?php declare(strict_types=1); namespace Fp\Cast; use Fp\Functional\Option\Option; /** * Try copy and cast collection to non-empty-array * Returns None if there is no first collection element * * ```php * >>> asNonEmptyArray(LinkedList::collect([1, 2])); * => Some([1, 2]) * * >>> asNonEmptyArray(LinkedList:...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsNonEmptyList.php
src/Fp/Functions/Cast/AsNonEmptyList.php
<?php declare(strict_types=1); namespace Fp\Cast; use Fp\Functional\Option\Option; use function Fp\Collection\head; /** * Try copy and cast collection to non-empty-list * Returns None if there is no first collection element * * ```php * >>> asNonEmptyList(LinkedList::collect([1, 2])); * => Some([1, 2]) * *...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsList.php
src/Fp/Functions/Cast/AsList.php
<?php declare(strict_types=1); namespace Fp\Cast; /** * Copy one or multiple collections as list * * ```php * >>> asList([1], ['prop' => 2], [3, 4]); * => [1, 2, 3, 4] * ``` * * @template TV * * @param iterable<mixed, TV> ...$collections * @return ( * $collections is non-empty-array * ? non-...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsBool.php
src/Fp/Functions/Cast/AsBool.php
<?php declare(strict_types=1); namespace Fp\Cast; use Fp\Functional\Option\Option; /** * Try cast boolean like value * Returns None if cast is not possible * * ```php * >>> asBool('yes'); * => Some(true); * * >>> asBool('no'); * => Some(false) * * >>> asBool('xzc'); * => None * ``` * * @return Option...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsFloat.php
src/Fp/Functions/Cast/AsFloat.php
<?php declare(strict_types=1); namespace Fp\Cast; use Fp\Functional\Option\Option; /** * Try cast float like value * Returns None if cast is not possible * * ```php * >>> asFloat('1.1'); * => Some(1.1) * * >>> asFloat('1zxc1'); * => None * ``` * * @return Option<float> */ function asFloat(mixed $subjec...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Cast/AsPairs.php
src/Fp/Functions/Cast/AsPairs.php
<?php declare(strict_types=1); namespace Fp\Cast; use Generator; /** * ```php * >>> asPairs(['a' => 1, 'b' => 2]); * => [['a', 1], ['b', 2]] * ``` * * @template TK * @template TV * * @param iterable<TK, TV> $collection * @return list<array{TK, TV}> * @psalm-return ($collection is non-empty-array * ?...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveString.php
src/Fp/Functions/Evidence/ProveString.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Closure; use Fp\Functional\Option\Option; use function Fp\Collection\exists; /** * Prove that subject is of string type * * ```php * >>> proveString(''); * => Some('') * * >>> proveString(1); * => None * ``` * * @return Option<string> */ functio...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveFloat.php
src/Fp/Functions/Evidence/ProveFloat.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that subject is of float type * * ```php * >>> proveFloat(1); * => None * * >>> proveFloat(1.1); * => Some(1.1) * ``` * * @return Option<float> */ function proveFloat(mixed $potential): Option { return...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveArray.php
src/Fp/Functions/Evidence/ProveArray.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that given collection is of array type * * ```php * >>> proveArray([]); * => Some([]) * * >>> proveArray([1, 2]); * => Some([1, 2]) * * >>> proveArray(true); * => None * * >>> proveArray([1, 2], vType: pr...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveUnion.php
src/Fp/Functions/Evidence/ProveUnion.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Closure; use Fp\Functional\Option\Option; use function Fp\Collection\firstMap; /** * Prove that subject is one of given types * * ```php * >>> proveUnion(1, [proveString(...), proveInt(...)]); * => Some(1) * >>> proveUnion('str', [proveString(...), pr...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveObject.php
src/Fp/Functions/Evidence/ProveObject.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that subject is of integer type * * ```php * >>> proveObject(1); * => None * * >>> proveObject(new Foo(1)); * => Some(Foo(1)) * ``` * * @return Option<object> */ function proveObject(mixed $potential): Opt...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveBool.php
src/Fp/Functions/Evidence/ProveBool.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that subject is of boolean type * * ```php * >>> proveBool(true); * => Some(true) * * >>> proveBool(1); * => None * ``` * * @return Option<bool> */ function proveBool(mixed $subject): Option { return O...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveNull.php
src/Fp/Functions/Evidence/ProveNull.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that subject is null. * * ```php * >>> proveNull(null); * => Some(null) * * >>> proveNull(1); * => None * ``` * * @return Option<null> */ function proveNull(mixed $potential): Option { return null === ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveOf.php
src/Fp/Functions/Evidence/ProveOf.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Closure; use Fp\Functional\Option\Option; use function Fp\Collection\exists; /** * Prove that subject is of given class * * ```php * >>> proveOf(new Foo(1), Foo::class); * => Some(Foo(1)) * * >>> proveOf(new Bar(2), Foo::class); * => None * ``` * ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveList.php
src/Fp/Functions/Evidence/ProveList.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; use function Fp\Collection\traverseOption; /** * Prove that given collection is of list type * * ```php * >>> proveList([1, 2]); * => Some([1, 2]) * * >>> proveList([1, 2 => 2]); * => None * * >>> proveList([1, 2], pro...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Evidence/ProveInt.php
src/Fp/Functions/Evidence/ProveInt.php
<?php declare(strict_types=1); namespace Fp\Evidence; use Fp\Functional\Option\Option; /** * Prove that subject is of integer type * * ```php * >>> proveInt(1.1); * => None * * >>> proveInt(1); * => Some(1) * ``` * * @return Option<int> */ function proveInt(mixed $potential): Option { return Option:...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Init.php
src/Fp/Functions/Collection/Init.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\InitOperation; use function Fp\Cast\asArray; /** * @template TK of array-key * @template TV * * @param iterable<TK, TV> $collection * @return array<TK, TV> * @psalm-return ($collection is list<TV> ? list<TV> : array<TK, TV>) */ functi...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Keys.php
src/Fp/Functions/Collection/Keys.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\KeysOperation; use function Fp\Cast\asList; /** * Returns list of collection keys * * ```php * >>> keys(['a' => 1, 'b' => 2]); * => ['a', 'b'] * ``` * * @template TK * * @param iterable<TK, mixed> $collection * @return list<TK> *...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Traverse.php
src/Fp/Functions/Collection/Traverse.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Either\Either; use Fp\Functional\Option\Option; use Fp\Operations\TraverseEitherMergedOperation; use Fp\Operations\TraverseEitherOperation; use Fp\Operations\TraverseOptionOperation; use function Fp\Callable\dropFirstArg; use function Fp\Cast...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/MkString.php
src/Fp/Functions/Collection/MkString.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\MkStringOperation; /** * Displays all elements of this collection in a string * using start, end, and separator strings. * * ```php * >>> mkString([1, 2, 3]) * => '1,2,3' * * >>> mkString([1, 2, 3], '(', ', ', ')') * => '(1, 2, 3)' ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Tail.php
src/Fp/Functions/Collection/Tail.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\TailOperation; use function Fp\Cast\asList; /** * Returns every collection element except first * * ```php * >>> tail([1, 2, 3]); * => [2, 3] * ``` * * @template TV * * @param iterable<TV> $collection * @return list<TV> */ functi...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Partition.php
src/Fp/Functions/Collection/Partition.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Psalm\Hook\FunctionReturnTypeProvider\PartitionFunctionReturnTypeProvider; /** * Divide collection by given conditions * * * ```php * >>> partitionT([new Foo(1), new Foo(2), new Bar(3)], * >>> fn(Foo|Bar $v) => objectOf($v, Foo::class), * >>>...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Sequence.php
src/Fp/Functions/Collection/Sequence.php
<?php declare(strict_types=1); namespace Fp\Collection; use Closure; use Fp\Functional\Either\Either; use Fp\Functional\Option\Option; use Fp\Operations\TraverseEitherMergedOperation; use Fp\Operations\TraverseEitherOperation; use Fp\Operations\TraverseOptionOperation; use function Fp\Cast\asArray; use function Fp\...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Drop.php
src/Fp/Functions/Collection/Drop.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\DropOperation; use Fp\Operations\DropWhileOperation; use function Fp\Callable\dropFirstArg; use function Fp\Cast\asArray; use function Fp\Cast\asList; /** * Drop N collection elements * * ```php * >>> drop([1, 2, 3], 2); * => [3] * ```...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Pop.php
src/Fp/Functions/Collection/Pop.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use function Fp\Cast\asNonEmptyList; /** * Pop last collection element * and return tuple containing this element and other collection elements * If there is no last element then returns None * * ```php * >>> [$head, $ta...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/First.php
src/Fp/Functions/Collection/First.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\FirstMapOperation; use Fp\Operations\FirstOperation; use function Fp\Callable\dropFirstArg; /** * Find first element which satisfies the condition * * ```php * >>> first([1, 2], fn(int $v): bool => $v === ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Second.php
src/Fp/Functions/Collection/Second.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\SecondOperation; /** * Returns second collection element * None if there is no second collection element * * ```php * >>> second([1, 2, 3])->get(); * => 2 * ``` * * @template TV * * @param iterable<...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Head.php
src/Fp/Functions/Collection/Head.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\HeadOperation; /** * Returns collection first element * * ```php * >>> head([1, 2, 3])->get(); * => 1 * ``` * * @template TV * * @param iterable<TV> $collection * @return Option<TV> */ function hea...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/GroupMapReduce.php
src/Fp/Functions/Collection/GroupMapReduce.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\GroupMapReduceOperation; use function Fp\Callable\dropFirstArg; /** * Partitions this iterable collection into a map according to a discriminator function key. * All the values that have the same discriminator are then transformed by the va...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/GroupBy.php
src/Fp/Functions/Collection/GroupBy.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Collections\Collection; use Fp\Collections\NonEmptyHashMap; use Fp\Operations\GroupByOperation; use function Fp\Callable\dropFirstArg; /** * Group collection elements by key returned by function * * ```php * >>> groupBy( * [1, 2, 3], * fn(...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Exists.php
src/Fp/Functions/Collection/Exists.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\ExistsOperation; use function Fp\Callable\dropFirstArg; /** * Find if there is element which satisfies the condition * false otherwise * * ```php * >>> exists([1, 2], fn(int $v): bool => $v === 1); * => true * ``` * * @template TK o...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Every.php
src/Fp/Functions/Collection/Every.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\EveryOperation; use function Fp\Callable\dropFirstArg; /** * Returns true if every collection element satisfies the condition * false otherwise * * ```php * >>> every([1, 2], fn(int $v) => $v === 1); * => false * ``` * * @template T...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/At.php
src/Fp/Functions/Collection/At.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\AtOperation; /** * Find element by its key * * O(1) for arrays * O(N) for other cases * * Returns None if there is no such collection element * * ```php * >>> at([new Foo(), 2, 3], 1)->get(); * => 2 ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Reverse.php
src/Fp/Functions/Collection/Reverse.php
<?php declare(strict_types=1); namespace Fp\Collection; use function Fp\Cast\asArray; /** * Copy collection in reversed order * * ```php * >>> reverse([1, 2, 3]); * => [3, 2, 1] * ``` * * @template TK of array-key * @template TV * * @param iterable<TK, TV> $collection * @return array<TK, TV> * * @psal...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Reindex.php
src/Fp/Functions/Collection/Reindex.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\ReindexOperation; use function Fp\Callable\dropFirstArg; use function Fp\Cast\asArray; /** * Produces a new array of elements by assigning the values to keys generated by a transformation function (callback). * * ```php * >>> reindex([1,...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Chunks.php
src/Fp/Functions/Collection/Chunks.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\ChunksOperation; use Generator; /** * Generate collection chunks * * Warning: you can not rewind the generator * * ```php * >>> chunks([1, 2, 3, 4], 2); * => [[1, 2], [3, 4]] * ``` * * @template TV * * @param iterable<TV> $collect...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Contains.php
src/Fp/Functions/Collection/Contains.php
<?php declare(strict_types=1); namespace Fp\Collection; /** * Checks if a value exists in an array. * * ```php * >>> contains(42, [40, 41, 42]); * => true * >>> contains(43, [40, 41, 42]); * => false * ``` */ function contains(mixed $elem, iterable $collection): bool { /** @var mixed $item */ foreac...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/GroupMap.php
src/Fp/Functions/Collection/GroupMap.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Collections\NonEmptyHashMap; use Fp\Operations\GroupMapOperation; use function Fp\Callable\dropFirstArg; /** * Partitions given $collection into an array of groups according to a discriminator function $group. * Each element in a group is transformed...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Last.php
src/Fp/Functions/Collection/Last.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\LastMapOperation; use Fp\Operations\LastOperation; use function Fp\Callable\dropFirstArg; /** * Returns last collection element * and None if there is no last element * * ```php * >>> last([1, 2, 3])->ge...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Filter.php
src/Fp/Functions/Collection/Filter.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use Fp\Operations\FilterMapOperation; use Fp\Operations\FilterNotNullOperation; use Fp\Operations\FilterOperation; use Fp\Psalm\Hook\FunctionReturnTypeProvider\FilterNotNullFunctionReturnTypeProvider; use function Fp\Callable\d...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Map.php
src/Fp/Functions/Collection/Map.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\MapOperation; use function Fp\Callable\dropFirstArg; use function Fp\Cast\asArray; /** * Produces a new array of elements by mapping each element in collection * through a transformation function (callback). * * Keys are preserved * * ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Pluck.php
src/Fp/Functions/Collection/Pluck.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Psalm\Hook\FunctionReturnTypeProvider\PluckFunctionReturnTypeProvider; /** * Map every collection element into given property/key value * * ```php * >>> pluck([['a' => 1], ['a' => 2]], 'a'); * => [1, 2] * * >>> pluck([new Foo(1), new Foo(2)], 'a'...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Unique.php
src/Fp/Functions/Collection/Unique.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\UniqueByOperation; use function Fp\Cast\asArray; use function Fp\Cast\asList; /** * Returns collection unique elements * * ```php * >>> unique([1, 2, 2, 3, 3, 3, 3]); * => [1, 2, 3] * ``` * * @template TK of array-key * @template TV...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Shift.php
src/Fp/Functions/Collection/Shift.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Functional\Option\Option; use function Fp\Cast\asNonEmptyList; /** * Shift first collection element * and return tuple containing this element and other collection elements * If there is no first element then returns None * * ```php * >>> [$head,...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Fold.php
src/Fp/Functions/Collection/Fold.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\FoldOperation; /** * Fold many elements into one * * ```php * >>> fold('', ['a', 'b', 'c'])(fn($acc, $curr) => $acc . $cur); * => 'abc' * ``` * * @template TV * @template TInit * * @param TInit $init * @param iterable<TV> $collect...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Tap.php
src/Fp/Functions/Collection/Tap.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\TapOperation; use Fp\Streams\Stream; use function Fp\Callable\dropFirstArg; /** * Do something for all collection elements * * ```php * >>> tap([1, 2, 3], function($v) { echo($v); }); * => 123 * ``` * * @template TK * @template TV ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/Zip.php
src/Fp/Functions/Collection/Zip.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\ZipOperation; use function Fp\Cast\asList; /** * Returns an iterable collection formed from this iterable collection * and another iterable collection by combining corresponding elements in pairs. * * If one of the two collections is lon...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Collection/FlatMap.php
src/Fp/Functions/Collection/FlatMap.php
<?php declare(strict_types=1); namespace Fp\Collection; use Fp\Operations\FlatMapOperation; use function Fp\Callable\dropFirstArg; use function Fp\Cast\asList; /** * Map + flatten combination * * <ul> * <li> map [1, 4] to [[0, 1, 2], [3, 4, 5]] </li> * <li> flatten [[0, 1, 2], [3, 4, 5]] to [0, 1, 2, ...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Util/RegExp.php
src/Fp/Functions/Util/RegExp.php
<?php declare(strict_types=1); namespace Fp\Util; use Fp\Functional\Option\Option; use function Fp\Collection\at; use function Fp\Evidence\proveNonEmptyString; /** * Regular expression search * Returns None if not matched * * ```php * >>> regExpMatch('/[a-z]+(c)/', 'abc', 1); * => Some('c') * ``` * * @par...
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false
fp4php/functional
https://github.com/fp4php/functional/blob/93eee663d7cd50400fa3a440553fd67fbcd4d47f/src/Fp/Functions/Util/Writeln.php
src/Fp/Functions/Util/Writeln.php
<?php declare(strict_types=1); namespace Fp\Util; use const PHP_EOL; function writeln(string $text): void { print_r($text . PHP_EOL); }
php
MIT
93eee663d7cd50400fa3a440553fd67fbcd4d47f
2026-01-05T02:19:24.532501Z
false