����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.169 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././www/vendor/laravel/framework/src/Illuminate/Queue/ |
Upload File : |
<?php
namespace Illuminate\Queue;
use ReflectionClass;
use ReflectionProperty;
trait SerializesModels
{
use SerializesAndRestoresModelIdentifiers;
/**
* Prepare the instance for serialization.
*
* @return array
*/
public function __sleep()
{
$properties = (new ReflectionClass($this))->getProperties();
foreach ($properties as $property) {
$property->setValue($this, $this->getSerializedPropertyValue(
$this->getPropertyValue($property)
));
}
return array_values(array_filter(array_map(function ($p) {
return $p->isStatic() ? null : $p->getName();
}, $properties)));
}
/**
* Restore the model after serialization.
*
* @return void
*/
public function __wakeup()
{
foreach ((new ReflectionClass($this))->getProperties() as $property) {
if ($property->isStatic()) {
continue;
}
$property->setValue($this, $this->getRestoredPropertyValue(
$this->getPropertyValue($property)
));
}
}
/**
* Prepare the instance values for serialization.
*
* @return array
*/
public function __serialize()
{
$values = [];
$properties = (new ReflectionClass($this))->getProperties();
$class = get_class($this);
foreach ($properties as $property) {
if ($property->isStatic()) {
continue;
}
$property->setAccessible(true);
if (! $property->isInitialized($this)) {
continue;
}
$name = $property->getName();
if ($property->isPrivate()) {
$name = "\0{$class}\0{$name}";
} elseif ($property->isProtected()) {
$name = "\0*\0{$name}";
}
$values[$name] = $this->getSerializedPropertyValue(
$this->getPropertyValue($property)
);
}
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->setAccessible(true);
$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)
{
$property->setAccessible(true);
return $property->getValue($this);
}
}