lithium\aop\Chain::__invoke()

public method

Advances the chain by one and executes the next filter in line. This method is usually accessed from within a filter function.

This method is implemented as a magic method as it allows use to hide the fact that the second parameter passed to filters is a rich object. Making the single purpose (next) very clear.

A filter function using $next inside its function body to advance the chain.

function($params, $next) {
    return $next($params);
}

Parameters

  • array $params

    An array of named parameters.

Returns

mixed

The return value of the next filter. If there is no next filter, the return value of the implementation.

Source

	public function __invoke(array $params) {
		if (($filter = next($this->_filters)) !== false) {
			return $filter($params, $this);
		}

		$implementation = $this->_implementation;
		return $implementation($params);
	}