public function setDecorate(
        /*# string */ $ruleName,
        $interfaceOrClosure,
        $decorateCallable
    ) {
        // create closure it it is a interface name
        if (!is_callable($interfaceOrClosure)) {
            $interfaceOrClosure = function ($service) use ($interfaceOrClosure) {
                    return $service instanceof $interfaceOrClosure;
                };
        }

        // create closure if array [method, arguments] provided
        if (!is_callable($decorateCallable)) {
            $method    = $decorateCallable[0];
            $container = $this->getContainer();
            $arguments = isset($decorateCallable[1]) ? $decorateCallable[1] : [];
            $decorateCallable = function ($service) use ($container, $method, $arguments) {
                    $container->run([$service, $method], $arguments);
                };
        }

        // set the rule
        $this->rules[$ruleName] = [ $interfaceOrClosure, $decorateCallable ];
    }
public function setDecorate(
        /*# string */ $ruleName,
        $interfaceOrClosure,
        $decorateCallable
    ) {
        // create closure it it is a interface name
        if (!is_callable($interfaceOrClosure)) {
            $interfaceOrClosure = function ($service) use ($interfaceOrClosure) {
                    return $service instanceof $interfaceOrClosure;
                };
        }

        // create closure if array [method, arguments] provided
        if (!is_callable($decorateCallable)) {
            $method    = $decorateCallable[0];
            $container = $this->getContainer();
            $arguments = isset($decorateCallable[1]) ? $decorateCallable[1] : [];
            $decorateCallable = function ($service) use ($container, $method, $arguments) {
                    $container->run([$service, $method], $arguments);
                };
        }

        // set the rule
        $this->rules[$ruleName] = [ $interfaceOrClosure, $decorateCallable ];
    }
public function setDecorate ( /*# string */ $ ruleName , $ interfaceOrClosure , $ decorateCallable ) { // create closure it it is a interface name if ( ! is_callable ( $ interfaceOrClosure ) ) { $ interfaceOrClosure = function ( $ service ) use ( $ interfaceOrClosure ) { return $ service instanceof $ interfaceOrClosure ; } ; } // create closure if array [method, arguments] provided if ( ! is_callable ( $ decorateCallable ) ) { $ method = $ decorateCallable [ 0 ] ; $ container = $ this -> getContainer ( ) ; $ arguments = isset ( $ decorateCallable [ 1 ] ) ? $ decorateCallable [ 1 ] : [ ] ; $ decorateCallable = function ( $ service ) use ( $ container , $ method , $ arguments ) { $ container -> run ( [ $ service , $ method ] , $ arguments ) ; } ; } // set the rule $ this -> rules [ $ ruleName ] = [ $ interfaceOrClosure , $ decorateCallable ] ; }
Set up docorating rules

@param  string $ruleName decorate rule name
@param  string|callable $interfaceOrClosure callable or interface/class
@param  array|callable $decorateCallable callable or [method, arguments]
@return void
@throws LogicException if something goes wrong
@access public
@internal
Set up docorating rules