1 | <?php |
||
7 | abstract class AbstractMapper |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $options = []; |
||
13 | |||
14 | /** |
||
15 | * constructor allows passing of options |
||
16 | * |
||
17 | * @param array $options |
||
18 | */ |
||
19 | public function __construct(array $options = null) |
||
25 | |||
26 | /** |
||
27 | * implements the mapping of parts |
||
28 | * |
||
29 | * @param array $parts - the name parts |
||
30 | * @return array $parts - the mapped parts |
||
31 | */ |
||
32 | abstract public function map(array $parts); |
||
33 | |||
34 | /** |
||
35 | * checks if there are still unmapped parts left before the given position |
||
36 | * |
||
37 | * @param array $parts |
||
38 | * @param $index |
||
39 | * @return bool |
||
40 | */ |
||
41 | protected function hasUnmappedPartsBefore(array $parts, $index) |
||
55 | |||
56 | /** |
||
57 | * @param string $type |
||
58 | * @param array $parts |
||
59 | * @return int|bool |
||
60 | */ |
||
61 | protected function findFirstMapped(string $type, array $parts) |
||
73 | } |
||
74 |