Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 56... Línea 56...
56
    }
56
    }
Línea 57... Línea 57...
57
 
57
 
58
    /**
58
    /**
59
     * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
59
     * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
60
     */
60
     */
61
    public function __construct(callable $handler = null)
61
    public function __construct(?callable $handler = null)
62
    {
62
    {
63
        $this->handler = $handler;
63
        $this->handler = $handler;
Línea 64... Línea 64...
64
    }
64
    }
Línea 84... Línea 84...
84
    {
84
    {
85
        $depth = 0;
85
        $depth = 0;
86
        $stack = [];
86
        $stack = [];
Línea 87... Línea 87...
87
 
87
 
88
        if ($this->handler !== null) {
88
        if ($this->handler !== null) {
89
            $stack[] = "0) Handler: " . $this->debugCallable($this->handler);
89
            $stack[] = '0) Handler: '.$this->debugCallable($this->handler);
Línea 90... Línea 90...
90
        }
90
        }
91
 
91
 
92
        $result = '';
92
        $result = '';
93
        foreach (\array_reverse($this->stack) as $tuple) {
93
        foreach (\array_reverse($this->stack) as $tuple) {
94
            $depth++;
94
            ++$depth;
95
            $str = "{$depth}) Name: '{$tuple[1]}', ";
95
            $str = "{$depth}) Name: '{$tuple[1]}', ";
96
            $str .= "Function: " . $this->debugCallable($tuple[0]);
96
            $str .= 'Function: '.$this->debugCallable($tuple[0]);
97
            $result = "> {$str}\n{$result}";
97
            $result = "> {$str}\n{$result}";
Línea 98... Línea 98...
98
            $stack[] = $str;
98
            $stack[] = $str;
Línea 120... Línea 120...
120
    /**
120
    /**
121
     * Returns true if the builder has a handler.
121
     * Returns true if the builder has a handler.
122
     */
122
     */
123
    public function hasHandler(): bool
123
    public function hasHandler(): bool
124
    {
124
    {
125
        return $this->handler !== null ;
125
        return $this->handler !== null;
126
    }
126
    }
Línea 127... Línea 127...
127
 
127
 
128
    /**
128
    /**
129
     * Unshift a middleware to the bottom of the stack.
129
     * Unshift a middleware to the bottom of the stack.
Línea 264... Línea 264...
264
        }
264
        }
Línea 265... Línea 265...
265
 
265
 
266
        if (\is_array($fn)) {
266
        if (\is_array($fn)) {
267
            return \is_string($fn[0])
267
            return \is_string($fn[0])
268
                ? "callable({$fn[0]}::{$fn[1]})"
268
                ? "callable({$fn[0]}::{$fn[1]})"
269
                : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])";
269
                : "callable(['".\get_class($fn[0])."', '{$fn[1]}'])";
Línea 270... Línea 270...
270
        }
270
        }
271
 
271
 
272
        /** @var object $fn */
272
        /** @var object $fn */
273
        return 'callable(' . \spl_object_hash($fn) . ')';
273
        return 'callable('.\spl_object_hash($fn).')';