private static function collectClosures(&$input) {
        static $closureNo = 1;
        $closures = [];
        if (is_array($input)) {
            foreach ($input as &$value) {
                if (is_array($value) || $value instanceof Closure) {
                    $closures = array_merge($closures, self::collectClosures($value));
                }
            }
        } elseif ($input instanceof Closure) {
            $closureNo++;
            $key = "--==<<[[((Closure#$closureNo))]]>>==--";
            $closures[$key] = $input;
            $input = $key;
        }

        return $closures;
    }
private static function collectClosures(&$input) {
        static $closureNo = 1;
        $closures = [];
        if (is_array($input)) {
            foreach ($input as &$value) {
                if (is_array($value) || $value instanceof Closure) {
                    $closures = array_merge($closures, self::collectClosures($value));
                }
            }
        } elseif ($input instanceof Closure) {
            $closureNo++;
            $key = "--==<<[[((Closure#$closureNo))]]>>==--";
            $closures[$key] = $input;
            $input = $key;
        }

        return $closures;
    }
private static function collectClosures ( & $ input ) { static $ closureNo = 1 ; $ closures = [ ] ; if ( is_array ( $ input ) ) { foreach ( $ input as & $ value ) { if ( is_array ( $ value ) || $ value instanceof Closure ) { $ closures = array_merge ( $ closures , self :: collectClosures ( $ value ) ) ; } } } elseif ( $ input instanceof Closure ) { $ closureNo ++ ; $ key = "--==<<[[((Closure#$closureNo))]]>>==--" ; $ closures [ $ key ] = $ input ; $ input = $ key ; } return $ closures ; }
Collects closures from given input.
Substitutes closures with a tag.
@param mixed $input will be changed
@return array array of found closures
Collects closures from given input . Substitutes closures with a tag .