getSerializerConfiguration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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;
0 ignored issues
show
Documentation Bug introduced by
$configuration is of type TechDivision\Import\Seri...rConfigurationInterface, but the property $serializerConfiguration was declared to be of type TechDivision\Import\Seri...vConfigurationInterface. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

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.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
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