PluginProbe
WPIDE – File Manager & Code Editor / 3.5.10
WPIDE – File Manager & Code Editor v3.5.10
3.5.10 3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 All 56 releases
wpide / vendor / laravel / serializable-closure / src / UnsignedSerializableClosure.php

UnsignedSerializableClosure.php in WPIDE – File Manager & Code Editor 3.5.10, at vendor/laravel/serializable-closure/src/UnsignedSerializableClosure.php

83 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Laravel\SerializableClosure;
4
5 use Closure;
6 use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
7
8 class UnsignedSerializableClosure
9 {
10 /**
11 * The closure's serializable.
12 *
13 * @var \Laravel\SerializableClosure\Contracts\Serializable
14 */
15 protected $serializable;
16
17 /**
18 * Creates a new serializable closure instance.
19 *
20 * @param \Closure $closure
21 * @return void
22 */
23 public function __construct(Closure $closure)
24 {
25 if (\PHP_VERSION_ID < 70400) {
26 throw new PhpVersionNotSupportedException();
27 }
28
29 $this->serializable = new Serializers\Native($closure);
30 }
31
32 /**
33 * Resolve the closure with the given arguments.
34 *
35 * @return mixed
36 */
37 public function __invoke()
38 {
39 if (\PHP_VERSION_ID < 70400) {
40 throw new PhpVersionNotSupportedException();
41 }
42
43 return call_user_func_array($this->serializable, func_get_args());
44 }
45
46 /**
47 * Gets the closure.
48 *
49 * @return \Closure
50 */
51 public function getClosure()
52 {
53 if (\PHP_VERSION_ID < 70400) {
54 throw new PhpVersionNotSupportedException();
55 }
56
57 return $this->serializable->getClosure();
58 }
59
60 /**
61 * Get the serializable representation of the closure.
62 *
63 * @return array
64 */
65 public function __serialize()
66 {
67 return [
68 'serializable' => $this->serializable,
69 ];
70 }
71
72 /**
73 * Restore the closure after serialization.
74 *
75 * @param array $data
76 * @return void
77 */
78 public function __unserialize($data)
79 {
80 $this->serializable = $data['serializable'];
81 }
82 }
83