Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 35... Línea 35...
35
     *
35
     *
36
     * @return callable
36
     * @return callable
37
     */
37
     */
38
    public static function wrap(
38
    public static function wrap(
39
        Service $service,
39
        Service $service,
40
        callable $bytesGenerator = null
40
        ?callable $bytesGenerator = null
41
    ) {
41
    ) {
42
        return function (callable $handler) use ($service, $bytesGenerator) {
42
        return function (callable $handler) use ($service, $bytesGenerator) {
43
            return new self($handler, $service, $bytesGenerator);
43
            return new self($handler, $service, $bytesGenerator);
44
        };
44
        };
45
    }
45
    }
Línea 46... Línea 46...
46
 
46
 
47
    public function __construct(
47
    public function __construct(
48
        callable $nextHandler,
48
        callable $nextHandler,
49
        Service $service,
49
        Service $service,
50
        callable $bytesGenerator = null
50
        ?callable $bytesGenerator = null
51
    ) {
51
    ) {
52
        $this->bytesGenerator = $bytesGenerator
52
        $this->bytesGenerator = $bytesGenerator
53
            ?: $this->findCompatibleRandomSource();
53
            ?: $this->findCompatibleRandomSource();
54
        $this->service = $service;
54
        $this->service = $service;
55
        $this->nextHandler = $nextHandler;
55
        $this->nextHandler = $nextHandler;
Línea 56... Línea 56...
56
    }
56
    }
57
 
57
 
58
    public function __invoke(
58
    public function __invoke(
59
        CommandInterface $command,
59
        CommandInterface $command,
60
        RequestInterface $request = null
60
        ?RequestInterface $request = null
61
    ) {
61
    ) {
62
        $handler = $this->nextHandler;
62
        $handler = $this->nextHandler;
63
        if ($this->bytesGenerator) {
63
        if ($this->bytesGenerator) {