forked from illuminate/queue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSerializableClosure.php
40 lines (33 loc) · 954 Bytes
/
SerializableClosure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Illuminate\Queue;
use Opis\Closure\SerializableClosure as OpisSerializableClosure;
class SerializableClosure extends OpisSerializableClosure
{
use SerializesAndRestoresModelIdentifiers;
/**
* Transform the use variables before serialization.
*
* @param array $data The Closure's use variables
* @return array
*/
protected function transformUseVariables($data)
{
foreach ($data as $key => $value) {
$data[$key] = $this->getSerializedPropertyValue($value);
}
return $data;
}
/**
* Resolve the use variables after unserialization.
*
* @param array $data The Closure's transformed use variables
* @return array
*/
protected function resolveUseVariables($data)
{
foreach ($data as $key => $value) {
$data[$key] = $this->getRestoredPropertyValue($value);
}
return $data;
}
}