1 | <?php |
||
11 | class ClassBasedTypeHandler implements TypeHandlerInterface |
||
12 | { |
||
13 | /** |
||
14 | * Full class name as a type |
||
15 | * |
||
16 | * @var bool |
||
17 | */ |
||
18 | protected $fullName; |
||
19 | |||
20 | /** |
||
21 | * Type parts delimiter |
||
22 | * Works only for "full-name" mode enabled |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $delimiter; |
||
27 | |||
28 | /** |
||
29 | * Cache of resolved types |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $resolvedCache = []; |
||
34 | |||
35 | /** |
||
36 | * ClassBasedTypeHandler constructor. |
||
37 | * |
||
38 | * @param bool $fullName Use full class name as a type |
||
39 | * @param string $delimiter Type parts delimiter (only for enable "full-name" mode) |
||
40 | */ |
||
41 | 2 | public function __construct(bool $fullName = true, string $delimiter = '.') |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 2 | public function getType($object): string |
|
60 | |||
61 | /** |
||
62 | * Resolve type by class |
||
63 | * |
||
64 | * @param string $class |
||
65 | * @return string |
||
66 | */ |
||
67 | 2 | protected function resolveType(string $class): string |
|
83 | } |