2017 © Pedro PelĂĄez
 

library cascade

A lightweight API to filter values.

image

fg/cascade

A lightweight API to filter values.

  • Sunday, April 5, 2015
  • by fg
  • Repository
  • 1 Watchers
  • 0 Stars
  • 737 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Cascade

A lightweight API to filter values., (*1)

Installation

composer require fg/cascade

Usage

Filtering a value:, (*2)

$Cascade = new Cascade\Cascade([
    function($value) {
        return $value + $value;
    },
    function($value) {
        return $value * $value;
    }
]);

echo $Cascade->filter(2); // 16

Filtering a value depending on additionnal arguments:, (*3)

$Cascade = new Cascade\Cascade([
    function($value, $factor) {
        return $value * $factor;
    }
]);

echo $Cascade->filter(2, 10); // 20

Filtering a value with a filter object:, (*4)

class SquareFilter {
    public function __invoke($value) {
        return $value * $value;
    }
}

$Cascade = new Cascade\Cascade([
    new SquareFilter()
]);

echo $Cascade->filter(2); // 4

API

// constructor
$Cascade = new Cascade\Cascade();
$Cascade = new Cascade\Cascade($filters);

// accessors for the list of filters
$Cascade->filters();
$Cascade->setFilters($filters);
$Cascade->addFilter($filter);

// filter
$Cascade->filter($value [, $args...]);

The Versions

05/04 2015

dev-master

9999999-dev http://github.com/felixgirault/cascade

A lightweight API to filter values.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

filter cascade

05/04 2015

1.0.0

1.0.0.0 http://github.com/felixgirault/cascade

A lightweight API to filter values.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

filter cascade