1 | <?php |
||
14 | class CodeGeneratorRegistry |
||
15 | { |
||
16 | private static $generators = []; |
||
17 | |||
18 | /** |
||
19 | * Registers an entity code generator service. |
||
20 | * |
||
21 | * @param CodeGeneratorInterface $codeGenerator the entity code generator service |
||
22 | * |
||
23 | * @throws \Exception |
||
24 | */ |
||
25 | public static function register(CodeGeneratorInterface $codeGenerator) |
||
36 | |||
37 | /** |
||
38 | * Returns the last registered entity code generator service id for a given entity class and field. |
||
39 | * |
||
40 | * @param string $entityClass |
||
41 | * @param string $entityField |
||
42 | * |
||
43 | * @return CodeGeneratorInterface |
||
44 | * |
||
45 | * @throws \Exception |
||
46 | */ |
||
47 | public static function getCodeGenerator($entityClass, $entityField = 'code') |
||
55 | |||
56 | /** |
||
57 | * Returns registred code generators for specifyed entity class. |
||
58 | * |
||
59 | * @param string $entityClass |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | public static function getCodeGenerators($entityClass = null) |
||
75 | |||
76 | /** |
||
77 | * @param string $entityClass |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | public static function hasGeneratorForClass($entityClass) |
||
85 | } |
||
86 |
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: