2017 © Pedro Peláez
 

library collection

Small functional multi-purpose collection

image

troublete/collection

Small functional multi-purpose collection

  • Friday, February 9, 2018
  • by troublete
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Functional Collection

Small functional multi-purpose collection, (*1)

Build Status Technical dept Reliability, (*2)

Insall

composer require troublete/collection

Usage

<?php
use function TryPhp\collection;
$collection = collection([1, 2, 3]);

// or

use TryPhp\FuntionalCollection;
$collection = new FunctionalCollection([1, 2, 3]);

API

of(...$values)

Setup new collection with provided values. immutable, (*3)

map(callable $mapFunc)

Method which will be applied to each element in the value set of the collection. mutable, (*4)

filter(callable $predicate)

Method which will create a collection copy and filter values by function (returning false filters value out). immutable, (*5)

generator(): \Generator

Returns Generator over value set., (*6)

extract(): array

Will return value set., (*7)

extend(callable $func)

Method will call the provided Closure and inject set values. Returned values will be put into immutable FunctionalCollection and returned. immutable, (*8)

concat(FunctionaCollection $collection)

Method will combine to value sets of two collection and return a new one with set values. immutable, (*9)

chain(callable $map)

Method which will apply $map to every element in the value collection and will reduce the result and add it to the overall value set and create a immutable new collection with it. immutable, (*10)

reduce(callable $func = null)

Method to reduce the value set (value by value) according to the result of calling $func and return the created accumulated value. If $func is null the raw value is used and added to the accumulator., (*11)

License

GPL-2.0 © 2018 Willi Eßer, (*12)

The Versions

09/02 2018

dev-master

9999999-dev

Small functional multi-purpose collection

  Sources   Download

GPL-2.0-only

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

09/02 2018

0.1.1

0.1.1.0

Small functional multi-purpose collection

  Sources   Download

GPL-2.0-only

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

09/02 2018

0.1.0

0.1.0.0

Small functional multi-purpose collection

  Sources   Download

GPL-2.0-only

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer