Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | protected function retrieveCommand(string $binding) :Contracts\Command |
||
35 | { |
||
36 | $command = array_filter($this->availableCommands, function($availableCommand) use($binding) { |
||
37 | return (new $availableCommand)->binding() === $binding; |
||
38 | }); |
||
39 | |||
40 | if (! $command[0]) { |
||
41 | throw new Exceptions\UnknowCommand(); |
||
42 | } |
||
43 | |||
44 | return new $command[0]; |
||
45 | } |
||
46 | } |
||
47 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: