1 | <?php |
||
34 | trait SerializerTrait |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * The serializer instance to use. |
||
39 | * |
||
40 | * @var \TechDivision\Import\Serializers\SerializerInterface |
||
41 | */ |
||
42 | protected $serializer; |
||
43 | |||
44 | /** |
||
45 | * Sets the serializer instance. |
||
46 | * |
||
47 | * @param \TechDivision\Import\Serializers\SerializerInterface $serializer The serializer instance |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | public function setSerializer(SerializerInterface $serializer) |
||
55 | |||
56 | /** |
||
57 | * Returns the serializer instance. |
||
58 | * |
||
59 | * @return \TechDivision\Import\Serializers\SerializerInterface The serializer instance |
||
60 | */ |
||
61 | public function getSerializer() |
||
65 | |||
66 | /** |
||
67 | * Extracts the elements of the passed value by exploding them |
||
68 | * with the also passed delimiter. |
||
69 | * |
||
70 | * @param string|null $value The value to extract |
||
71 | * @param string|null $delimiter The delimiter used to extrace the elements |
||
72 | * |
||
73 | * @return array|null The exploded values |
||
74 | */ |
||
75 | public function explode($value = null, $delimiter = null) |
||
79 | |||
80 | /** |
||
81 | * Compacts the elements of the passed value by imploding them |
||
82 | * with the also passed delimiter. |
||
83 | * |
||
84 | * @param array|null $value The values to compact |
||
85 | * @param string|null $delimiter The delimiter use to implode the values |
||
86 | * |
||
87 | * @return string|null The compatected value |
||
88 | */ |
||
89 | public function implode(array $value = null, $delimiter = null) |
||
93 | |||
94 | /** |
||
95 | * Serializes the elements of the passed array. |
||
96 | * |
||
97 | * @param array|null $unserialized The serialized data |
||
98 | * |
||
99 | * @return string The serialized array |
||
100 | */ |
||
101 | public function serialize(array $unserialized = null) |
||
105 | |||
106 | /** |
||
107 | * Unserializes the elements of the passed string. |
||
108 | * |
||
109 | * @param string|null $serialized The value to unserialize |
||
110 | * |
||
111 | * @return array The unserialized values |
||
112 | */ |
||
113 | public function unserialize($serialized = null) |
||
117 | } |
||
118 |