1 | <?php |
||
14 | class DataMappers |
||
15 | { |
||
16 | /** |
||
17 | * @var DataMapperInterface[] |
||
18 | */ |
||
19 | protected $dataMappers; |
||
20 | |||
21 | /** |
||
22 | * @var DataMapper[] |
||
23 | */ |
||
24 | protected $wrappedDataMappers; |
||
25 | |||
26 | /** |
||
27 | * @var ValidatorInterface |
||
28 | */ |
||
29 | protected $validator; |
||
30 | |||
31 | 5 | public function __construct() |
|
32 | { |
||
33 | 5 | $this->dataMappers = []; |
|
34 | 5 | $this->wrappedDataMappers = []; |
|
35 | 5 | } |
|
36 | |||
37 | /** |
||
38 | * @return ValidatorInterface |
||
39 | */ |
||
40 | 2 | public function getValidator() |
|
44 | |||
45 | /** |
||
46 | * @param ValidatorInterface $validator |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | 1 | public function setValidator($validator) |
|
56 | |||
57 | /** |
||
58 | * @param DataMapperInterface $dataMapper |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | 2 | public function addMapper(DataMapperInterface $dataMapper, string $name = null) : self |
|
74 | |||
75 | /** |
||
76 | * @param string $class |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 3 | public function hasMapper(string $class) : bool |
|
84 | |||
85 | /** |
||
86 | * @param string $class |
||
87 | * |
||
88 | * @return DataMapper |
||
89 | * @throws DataMapperNotFoundException |
||
90 | */ |
||
91 | 3 | public function getMapper(string $class) : DataMapper |
|
108 | |||
109 | /** |
||
110 | * @param string $class |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | 1 | public function removeMapper(string $class) : self |
|
121 | } |
||
122 |