1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Serializer\Csv\AbstractSerializer |
5
|
|
|
* |
6
|
|
|
* PHP version 7 |
7
|
|
|
* |
8
|
|
|
* @author Tim Wagner <[email protected]> |
9
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
10
|
|
|
* @license https://opensource.org/licenses/MIT |
11
|
|
|
* @link https://github.com/techdivision/import-serializer-csv |
12
|
|
|
* @link http://www.techdivision.com |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Serializer\Csv; |
16
|
|
|
|
17
|
|
|
use TechDivision\Import\Serializer\SerializerInterface; |
18
|
|
|
use TechDivision\Import\Serializer\ConfigurationAwareSerializerInterface; |
19
|
|
|
use TechDivision\Import\Serializer\Configuration\SerializerConfigurationInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Abstract serializer implementation. |
23
|
|
|
* |
24
|
|
|
* @author Tim Wagner <[email protected]> |
25
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
26
|
|
|
* @license https://opensource.org/licenses/MIT |
27
|
|
|
* @link https://github.com/techdivision/import-serializer-csv |
28
|
|
|
* @link http://www.techdivision.com |
29
|
|
|
*/ |
30
|
|
|
abstract class AbstractCsvSerializer implements SerializerInterface, ConfigurationAwareSerializerInterface |
31
|
|
|
{ |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The configuration used to un-/serialize the additional attributes. |
35
|
|
|
* |
36
|
|
|
* @var \TechDivision\Import\Serializer\Csv\Configuration\CsvConfigurationInterface |
37
|
|
|
*/ |
38
|
|
|
private $serializerConfiguration; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Passes the configuration and initializes the serializer. |
42
|
|
|
* |
43
|
|
|
* @param \TechDivision\Import\Serializer\Csv\Configuration\CsvConfigurationInterface $configuration The CSV configuration |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
public function init(SerializerConfigurationInterface $configuration) |
48
|
|
|
{ |
49
|
|
|
$this->serializerConfiguration = $configuration; |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Returns the configuration to un-/serialize the additional attributes. |
54
|
|
|
* |
55
|
|
|
* @return \TechDivision\Import\Serializer\Configuration\SerializerConfigurationInterface The configuration |
56
|
|
|
*/ |
57
|
|
|
public function getSerializerConfiguration() |
58
|
|
|
{ |
59
|
|
|
return $this->serializerConfiguration; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.