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