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