# defender-security/5.7.0/lib/packages/Laravel/SerializableClosure/UnsignedSerializableClosure.php

Defender Security – Malware Scanner, Login Security &amp; Firewall, version 5.7.0. 83 lines.

- Page: https://pluginprobe.com/plugins/defender-security/5.7.0/code/lib/packages/Laravel/SerializableClosure/UnsignedSerializableClosure.php
- Raw: https://pluginprobe.com/plugins/defender-security/5.7.0/raw/lib/packages/Laravel/SerializableClosure/UnsignedSerializableClosure.php
- Modified: 2023-09-18T10:08:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/defender-security/5.7.0/code/lib/packages/Laravel/SerializableClosure/UnsignedSerializableClosure.php#L10-L20`.

```php
<?php

namespace WPMU_DEV\Defender\Vendor\Laravel\SerializableClosure;

use Closure;
use WPMU_DEV\Defender\Vendor\Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;

class UnsignedSerializableClosure
{
    /**
     * The closure's serializable.
     *
     * @var \WPMU_DEV\Defender\Vendor\Laravel\SerializableClosure\Contracts\Serializable
     */
    protected $serializable;

    /**
     * Creates a new serializable closure instance.
     *
     * @param  \Closure  $closure
     * @return void
     */
    public function __construct(Closure $closure)
    {
        if (\PHP_VERSION_ID < 70400) {
            throw new PhpVersionNotSupportedException();
        }

        $this->serializable = new Serializers\Native($closure);
    }

    /**
     * Resolve the closure with the given arguments.
     *
     * @return mixed
     */
    public function __invoke()
    {
        if (\PHP_VERSION_ID < 70400) {
            throw new PhpVersionNotSupportedException();
        }

        return call_user_func_array($this->serializable, func_get_args());
    }

    /**
     * Gets the closure.
     *
     * @return \Closure
     */
    public function getClosure()
    {
        if (\PHP_VERSION_ID < 70400) {
            throw new PhpVersionNotSupportedException();
        }

        return $this->serializable->getClosure();
    }

    /**
     * Get the serializable representation of the closure.
     *
     * @return array
     */
    public function __serialize()
    {
        return [
            'serializable' => $this->serializable,
        ];
    }

    /**
     * Restore the closure after serialization.
     *
     * @param  array  $data
     * @return void
     */
    public function __unserialize($data)
    {
        $this->serializable = $data['serializable'];
    }
}

```
