Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 1... Línea 1...
1
<?php
1
<?php
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
namespace Laravel\SerializableClosure;
3
namespace Laravel\SerializableClosure;
4
 
-
 
Línea 5... Línea 4...
5
use Closure;
4
 
6
use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
5
use Closure;
7
 
6
 
8
class UnsignedSerializableClosure
7
class UnsignedSerializableClosure
Línea 20... Línea 19...
20
     * @param  \Closure  $closure
19
     * @param  \Closure  $closure
21
     * @return void
20
     * @return void
22
     */
21
     */
23
    public function __construct(Closure $closure)
22
    public function __construct(Closure $closure)
24
    {
23
    {
25
        if (\PHP_VERSION_ID < 70400) {
-
 
26
            throw new PhpVersionNotSupportedException();
-
 
27
        }
-
 
28
 
-
 
29
        $this->serializable = new Serializers\Native($closure);
24
        $this->serializable = new Serializers\Native($closure);
30
    }
25
    }
Línea 31... Línea 26...
31
 
26
 
32
    /**
27
    /**
33
     * Resolve the closure with the given arguments.
28
     * Resolve the closure with the given arguments.
34
     *
29
     *
35
     * @return mixed
30
     * @return mixed
36
     */
31
     */
37
    public function __invoke()
32
    public function __invoke()
38
    {
-
 
39
        if (\PHP_VERSION_ID < 70400) {
-
 
40
            throw new PhpVersionNotSupportedException();
-
 
41
        }
-
 
42
 
33
    {
43
        return call_user_func_array($this->serializable, func_get_args());
34
        return call_user_func_array($this->serializable, func_get_args());
Línea 44... Línea 35...
44
    }
35
    }
45
 
36
 
46
    /**
37
    /**
47
     * Gets the closure.
38
     * Gets the closure.
48
     *
39
     *
49
     * @return \Closure
40
     * @return \Closure
50
     */
41
     */
51
    public function getClosure()
-
 
52
    {
-
 
53
        if (\PHP_VERSION_ID < 70400) {
-
 
54
            throw new PhpVersionNotSupportedException();
-
 
55
        }
42
    public function getClosure()
56
 
43
    {
Línea 57... Línea 44...
57
        return $this->serializable->getClosure();
44
        return $this->serializable->getClosure();
58
    }
45
    }
59
 
46
 
60
    /**
47
    /**
61
     * Get the serializable representation of the closure.
48
     * Get the serializable representation of the closure.
62
     *
49
     *
63
     * @return array
50
     * @return array{serializable: \Laravel\SerializableClosure\Contracts\Serializable}
64
     */
51
     */
65
    public function __serialize()
52
    public function __serialize()
Línea 70... Línea 57...
70
    }
57
    }
Línea 71... Línea 58...
71
 
58
 
72
    /**
59
    /**
73
     * Restore the closure after serialization.
60
     * Restore the closure after serialization.
74
     *
61
     *
75
     * @param  array  $data
62
     * @param  array{serializable: \Laravel\SerializableClosure\Contracts\Serializable}  $data
76
     * @return void
63
     * @return void
77
     */
64
     */
78
    public function __unserialize($data)
65
    public function __unserialize($data)
79
    {
66
    {