PHP 8.3.31
Preview: SerializesModels.php Size: 2.65 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php

<?php

namespace Illuminate\Queue;

use Illuminate\Queue\Attributes\WithoutRelations;
use ReflectionClass;
use ReflectionProperty;

trait SerializesModels
{
    use SerializesAndRestoresModelIdentifiers;

    /**
     * Prepare the instance values for serialization.
     *
     * @return array
     */
    public function __serialize()
    {
        $values = [];

        $reflectionClass = new ReflectionClass($this);

        [$class, $properties, $classLevelWithoutRelations] = [
            get_class($this),
            $reflectionClass->getProperties(),
            ! empty($reflectionClass->getAttributes(WithoutRelations::class)),
        ];

        foreach ($properties as $property) {
            if ($property->isStatic()) {
                continue;
            }

            if (! $property->isInitialized($this)) {
                continue;
            }

            $value = $this->getPropertyValue($property);

            if ($property->hasDefaultValue() && $value === $property->getDefaultValue()) {
                continue;
            }

            $name = $property->getName();

            if ($property->isPrivate()) {
                $name = "\0{$class}\0{$name}";
            } elseif ($property->isProtected()) {
                $name = "\0*\0{$name}";
            }

            $values[$name] = $this->getSerializedPropertyValue(
                $value,
                ! $classLevelWithoutRelations &&
                    empty($property->getAttributes(WithoutRelations::class))
            );
        }

        return $values;
    }

    /**
     * Restore the model after serialization.
     *
     * @param  array  $values
     * @return void
     */
    public function __unserialize(array $values)
    {
        $properties = (new ReflectionClass($this))->getProperties();

        $class = get_class($this);

        foreach ($properties as $property) {
            if ($property->isStatic()) {
                continue;
            }

            $name = $property->getName();

            if ($property->isPrivate()) {
                $name = "\0{$class}\0{$name}";
            } elseif ($property->isProtected()) {
                $name = "\0*\0{$name}";
            }

            if (! array_key_exists($name, $values)) {
                continue;
            }

            $property->setValue(
                $this, $this->getRestoredPropertyValue($values[$name])
            );
        }
    }

    /**
     * Get the property value for the given property.
     *
     * @param  \ReflectionProperty  $property
     * @return mixed
     */
    protected function getPropertyValue(ReflectionProperty $property)
    {
        return $property->getValue($this);
    }
}

Directory Contents

Dirs: 8 × Files: 26

Name Size Perms Modified Actions
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
Capsule DIR
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
Console DIR
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
Events DIR
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
Failed DIR
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
Jobs DIR
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
- drwxrwxrwx 2025-09-17 06:52:57
Edit Download
5.92 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
2.50 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
9.25 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
1.79 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
11.60 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
6.90 KB lrw-rw-rw- 2025-09-17 06:52:56
Edit Download
552 B lrw-rw-rw- 2025-09-17 06:52:56
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:52:56
Edit Download
5.62 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
902 B lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
4.34 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
125 B lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
587 B lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
1.39 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
12.11 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
6.86 KB lrw-rw-rw- 2025-09-17 06:52:56
Edit Download
9.91 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
1.19 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
10.17 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
3.84 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
2.65 KB lrw-rw-rw- 2025-09-17 06:52:56
Edit Download
5.97 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
4.72 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
437 B lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
25.79 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download
2.43 KB lrw-rw-rw- 2025-09-17 06:52:57
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).