1 | <?php |
||
10 | class ValueWrapper implements ValueWrapperInterface |
||
11 | { |
||
12 | /** |
||
13 | * The storage variable containing the mappings. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | private static $typeClassMapping = [ |
||
18 | '*' => \drupol\valuewrapper\Type\TypeValue::class, |
||
19 | 'string' => \drupol\valuewrapper\Type\StringType::class, |
||
20 | 'array' => \drupol\valuewrapper\Type\ArrayType::class, |
||
21 | 'null' => \drupol\valuewrapper\Type\NullType::class, |
||
22 | 'boolean' => \drupol\valuewrapper\Type\BooleanType::class, |
||
23 | 'integer' => \drupol\valuewrapper\Type\IntegerType::class, |
||
24 | 'double' => \drupol\valuewrapper\Type\DoubleType::class, |
||
25 | 'object' => [ |
||
26 | '*' => \drupol\valuewrapper\Object\ObjectValue::class, |
||
27 | 'stdClass' => \drupol\valuewrapper\Object\StdClassObject::class, |
||
28 | 'Anonymous' => \drupol\valuewrapper\Object\AnonymousObject::class, |
||
29 | 'Closure' => \drupol\valuewrapper\Object\ClosureObject::class, |
||
30 | 'DateTime' => \drupol\valuewrapper\Object\DateTimeObject::class, |
||
31 | ], |
||
32 | 'resource' => [ |
||
33 | '*' => \drupol\valuewrapper\Resource\ResourceValue::class, |
||
34 | 'stream' => \drupol\valuewrapper\Resource\StreamResource::class, |
||
35 | ], |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | 1 | public static function create($value) : ValueInterface |
|
42 | { |
||
43 | 1 | return (new self())->make($value); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 12 | public function make($value) : ValueInterface |
|
78 | } |
||
79 |