1 | <?php |
||
10 | class TransformerManager |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $transfomers = []; |
||
16 | |||
17 | /** |
||
18 | * @param TransformerInterface $transformer |
||
19 | * @param string $indexId |
||
20 | * @param string $typeName |
||
21 | */ |
||
22 | public function registerTransformer(TransformerInterface $transformer, $indexId, $typeName) |
||
32 | |||
33 | /** |
||
34 | * @param object $entity |
||
35 | * @param string $indexId |
||
36 | * @param string $typeName |
||
37 | * @return TransformerInterface |
||
38 | */ |
||
39 | protected function getTransformer($entity, $indexId, $typeName) |
||
51 | |||
52 | /** |
||
53 | * @param object $entity |
||
54 | * @param string $indexId |
||
55 | * @param string $typeName |
||
56 | * @return Document[] |
||
57 | */ |
||
58 | public function transformToDocuments($entity, $indexId, $typeName) |
||
62 | |||
63 | /** |
||
64 | * @param object $entity |
||
65 | * @param string $indexId |
||
66 | * @param string $typeName |
||
67 | * @return string[]|int[] |
||
68 | */ |
||
69 | public function transformToIds($entity, $indexId, $typeName) |
||
73 | } |
||
74 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: