Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
namespace Laravel\SerializableClosure;
3
namespace Laravel\SerializableClosure;
4
 
4
 
5
use Closure;
-
 
6
use Laravel\SerializableClosure\Exceptions\InvalidSignatureException;
5
use Closure;
7
use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
6
use Laravel\SerializableClosure\Exceptions\InvalidSignatureException;
Línea 8... Línea 7...
8
use Laravel\SerializableClosure\Serializers\Signed;
7
use Laravel\SerializableClosure\Serializers\Signed;
9
use Laravel\SerializableClosure\Signers\Hmac;
8
use Laravel\SerializableClosure\Signers\Hmac;
Línea 23... Línea 22...
23
     * @param  \Closure  $closure
22
     * @param  \Closure  $closure
24
     * @return void
23
     * @return void
25
     */
24
     */
26
    public function __construct(Closure $closure)
25
    public function __construct(Closure $closure)
27
    {
26
    {
28
        if (\PHP_VERSION_ID < 70400) {
-
 
29
            throw new PhpVersionNotSupportedException();
-
 
30
        }
-
 
31
 
-
 
32
        $this->serializable = Serializers\Signed::$signer
27
        $this->serializable = Serializers\Signed::$signer
33
            ? new Serializers\Signed($closure)
28
            ? new Serializers\Signed($closure)
34
            : new Serializers\Native($closure);
29
            : new Serializers\Native($closure);
35
    }
30
    }
Línea 39... Línea 34...
39
     *
34
     *
40
     * @return mixed
35
     * @return mixed
41
     */
36
     */
42
    public function __invoke()
37
    public function __invoke()
43
    {
38
    {
44
        if (\PHP_VERSION_ID < 70400) {
-
 
45
            throw new PhpVersionNotSupportedException();
-
 
46
        }
-
 
47
 
-
 
48
        return call_user_func_array($this->serializable, func_get_args());
39
        return call_user_func_array($this->serializable, func_get_args());
49
    }
40
    }
Línea 50... Línea 41...
50
 
41
 
51
    /**
42
    /**
52
     * Gets the closure.
43
     * Gets the closure.
53
     *
44
     *
54
     * @return \Closure
45
     * @return \Closure
55
     */
46
     */
56
    public function getClosure()
47
    public function getClosure()
57
    {
-
 
58
        if (\PHP_VERSION_ID < 70400) {
-
 
59
            throw new PhpVersionNotSupportedException();
-
 
60
        }
-
 
61
 
48
    {
62
        return $this->serializable->getClosure();
49
        return $this->serializable->getClosure();
Línea 63... Línea 50...
63
    }
50
    }
64
 
51
 
Línea 109... Línea 96...
109
    }
96
    }
Línea 110... Línea 97...
110
 
97
 
111
    /**
98
    /**
112
     * Get the serializable representation of the closure.
99
     * Get the serializable representation of the closure.
113
     *
100
     *
114
     * @return array
101
     * @return array{serializable: \Laravel\SerializableClosure\Serializers\Signed|\Laravel\SerializableClosure\Contracts\Serializable}
115
     */
102
     */
116
    public function __serialize()
103
    public function __serialize()
117
    {
104
    {
118
        return [
105
        return [
Línea 121... Línea 108...
121
    }
108
    }
Línea 122... Línea 109...
122
 
109
 
123
    /**
110
    /**
124
     * Restore the closure after serialization.
111
     * Restore the closure after serialization.
125
     *
112
     *
126
     * @param  array  $data
113
     * @param  array{serializable: \Laravel\SerializableClosure\Serializers\Signed|\Laravel\SerializableClosure\Contracts\Serializable}  $data
127
     * @return void
114
     * @return void
128
     *
115
     *
129
     * @throws \Laravel\SerializableClosure\Exceptions\InvalidSignatureException
116
     * @throws \Laravel\SerializableClosure\Exceptions\InvalidSignatureException
130
     */
117
     */