2017 © Pedro Peláez
 

library callbacks

Family of callback wrappers with shared interface

image

actualwave/callbacks

Family of callback wrappers with shared interface

  • Wednesday, January 6, 2016
  • by a_[w]
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

PHP-Callbacks

Build Status Coverage Status Dependency Status, (*1)

Latest Stable Version Total Downloads License, (*2)

Family of Callback Wrappers allowing to store chains of delayed calls that can be started by event. * FunctionCallback - calls global function or static method. * MethodCallback - calls instance or static method. * OutputCallback - outputs all arguments in JSON format. * PropertyCallback - stores first argument as property value, works with static properties. * VariableCallback - stores first argument as variable value, works with static properties. * CallableQueue - calls stored callbacks passing previous result as argument, returns result of last callback. * CallableSequence - calls stored callbacks with same arguments, returns result of last callback., (*3)

$variable = 'value';
$callback = new \aw\callbacks\VariableCallback('variable');
$callback('new value');
echo $variable.PHP_EOL; // new value

function doEcho($param){
  echo 'My name is: '.$param.PHP_EOL;
}

$callback = new \aw\callbacks\FunctionCallback('doEcho');
$callback('####'); // My name is: ####

Installation

Via composer, (*4)

composer require actualwave/callbacks

Usage

All wrappers are callables, so can be used directly as closure. CallableCollection accepts any callable including PHP closures., (*5)

function multiply4($value){
  return $value*4;
}

$collection = new \aw\CallableQueue();
$collection[] = function($value){
  return $value*2;
};
$collection[] = function($value){
  return $value*3;
};
$collection[] = new \aw\callbacks\FunctionCallback('multiply4');
echo 'Result: '.$collection(2).PHP_EOL; // Result: 48

The Versions

06/01 2016

dev-master

9999999-dev https://github.com/burdiuz/php-callbacks

Family of callback wrappers with shared interface

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper object callable interface callback

05/01 2016

0.0.4

0.0.4.0 https://github.com/burdiuz/php-callbacks

Family of callback wrappers with shared interface

  Sources   Download

MIT

The Requires

 

The Development Requires

wrapper object callable interface callback

07/12 2015

0.0.3

0.0.3.0

Family of callback wrappers

  Sources   Download

MIT

The Requires

  • aw/object >=0.0.2

 

The Development Requires

04/12 2015

0.0.2

0.0.2.0

Family of callback wrappers

  Sources   Download

MIT

The Requires

  • aw/object >=0.0.2

 

The Development Requires

04/12 2015

0.0.1

0.0.1.0

Family of callback wrappers

  Sources   Download

MIT

The Requires

  • aw/object >=0.0.2

 

The Development Requires