PluginProbe
Auto Alt Text / 2.8.2
Auto Alt Text v2.8.2
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / vendor-prefixed / laravel / serializable-closure / src / UnsignedSerializableClosure.php

UnsignedSerializableClosure.php in Auto Alt Text 2.8.2, at vendor-prefixed/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 AATXT\Vendor\Laravel\SerializableClosure;
4
5 use Closure;
6 use AATXT\Vendor\Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
7
8 class UnsignedSerializableClosure
9 {
10 /**
11 * The closure's serializable.
12 *
13 * @var \AATXT\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