Base   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 63
wmc 7
lcom 2
cbo 1
ccs 14
cts 16
cp 0.875
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __clone() 0 3 1
assign() 0 1 ?
map() 0 1 ?
A getInstance() 0 8 2
A getManager() 0 5 2
A setManager() 0 5 1
1
<?php
2
3
namespace Iris\Mapping;
4
5
abstract class Base
6
{
7
    private static $instances = array();
8
9
    private $manager;
10
11 8
    protected function __construct()
12
    {
13 8
    }
14
15
    protected function __clone()
16
    {
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 20
    public static function getInstance()
23
    {
24 20
        $class = static::class;
25 20
        if (!isset(self::$instances[$class])) {
26 8
            self::$instances[$class] = new static();
27 8
        }
28 20
        return self::$instances[$class];
29
    }
30
31
    /**
32
     * @return \Iris\Manager
33
     */
34 1
    public function getManager()
35
    {
36 1
        $this->manager || $this->setManager(\Iris\Manager::getInstance());
37 1
        return $this->manager;
38
    }
39
40
    /**
41
     * @param \Iris\Manager $manager
42
     * @return Base
43
     */
44 4
    public function setManager(\Iris\Manager $manager)
45
    {
46 4
        $this->manager = $manager;
47 4
        return $this;
48
    }
49
50
    /**
51
     * Converts an array of infrastructure to a business object.
52
     * Here IRIS receives external shop data and converts it to its custom Transfer Object
53
     *
54
     * @param array $externalData
55
     * @return \Iris\Transfer\Catalog\ConfigCollection
56
     */
57
    abstract public function assign(array $externalData);
58
59
    /**
60
     * Converts a business object to an array.
61
     * Here IRIS prepares data for external shop from its custom Transfer objects
62
     *
63
     * @param $internalData Transfer object
64
     * @return array
65
     */
66
    abstract public function map($internalData);
67
}
68