PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.7.2
Defender Security – Malware Scanner, Login Security & Firewall v5.7.2
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Laravel / SerializableClosure / UnsignedSerializableClosure.php

UnsignedSerializableClosure.php in Defender Security – Malware Scanner, Login Security & Firewall 5.7.2, at lib/packages/Laravel/SerializableClosure/UnsignedSerializableClosure.php

83 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPMU_DEV\Defender\Vendor\Laravel\SerializableClosure;
4
5 use Closure;
6 use WPMU_DEV\Defender\Vendor\Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
7
8 class UnsignedSerializableClosure
9 {
10 /**
11 * The closure's serializable.
12 *
13 * @var \WPMU_DEV\Defender\Vendor\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