1 | <?php declare(strict_types = 1); |
||
26 | class DefinitionBuilder extends AbstractDefinition |
||
27 | { |
||
28 | /** @var ClassDefinition[] Definition collection */ |
||
29 | protected $definitionCollection = []; |
||
30 | /** @var ParameterBuilder */ |
||
31 | protected $parameterBuilder; |
||
32 | /** @var array Collection of interface => [classes]*/ |
||
33 | protected $implementors = []; |
||
34 | |||
35 | /** |
||
36 | * DefinitionBuilder constructor. |
||
37 | * |
||
38 | * @param ParameterBuilder $parameterBuilder |
||
39 | * @param AbstractDefinition|null $parentDefinition |
||
40 | */ |
||
41 | 18 | public function __construct(ParameterBuilder $parameterBuilder, AbstractDefinition $parentDefinition = null) |
|
48 | |||
49 | /** |
||
50 | * Define parameters |
||
51 | * |
||
52 | * @param string $name |
||
53 | * @param ReferenceInterface $reference |
||
54 | * @return ParameterBuilderInterface |
||
55 | * @throws ParameterAlreadyExistsException |
||
56 | */ |
||
57 | 3 | public function defineParameter(string $name, ReferenceInterface $reference): ParameterBuilderInterface |
|
61 | |||
62 | /** |
||
63 | * Define interface implementors |
||
64 | * |
||
65 | * @param string $interfaceName |
||
66 | * @param ReferenceInterface $class |
||
67 | * @return DefinitionBuilder |
||
68 | */ |
||
69 | public function defineImplementors(string $interfaceName, ReferenceInterface $class): DefinitionBuilder |
||
75 | |||
76 | /** |
||
77 | * Add new class definition |
||
78 | * |
||
79 | * @param $className |
||
80 | * @param string $serviceName |
||
81 | * @return ClassBuilderInterface |
||
82 | * @throws \InvalidArgumentException |
||
83 | * @throws ClassDefinitionAlreadyExistsException |
||
84 | */ |
||
85 | 16 | public function addDefinition($className, string $serviceName = null): ClassBuilderInterface |
|
104 | |||
105 | /** |
||
106 | * When definition for class name is exists in collection |
||
107 | * |
||
108 | * @param $className |
||
109 | * @return bool |
||
110 | */ |
||
111 | 16 | public function hasDefinition($className): bool |
|
115 | |||
116 | /** |
||
117 | * @return ClassDefinition[] |
||
118 | */ |
||
119 | 10 | public function getDefinitionCollection(): array |
|
123 | |||
124 | /** |
||
125 | * @return ReferenceInterface[] |
||
126 | */ |
||
127 | 4 | public function getParameterCollection(): array |
|
131 | |||
132 | /** |
||
133 | * @return array |
||
134 | */ |
||
135 | public function getImplementors(): array |
||
139 | } |
||
140 |
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: