1 | <?php |
||
5 | class Terminal { |
||
6 | |||
7 | /** |
||
8 | * @param array $availableCommands |
||
9 | */ |
||
10 | public function __construct(array $availableCommands) |
||
14 | |||
15 | /** |
||
16 | * try to launch a command class from a command line |
||
17 | * @param string $commandLine |
||
18 | * @throws \DeGraciaMathieu\Clike\Exceptions\UnknowCommand |
||
19 | * @return array |
||
20 | */ |
||
21 | public function execute(string $commandLine) :array |
||
27 | |||
28 | /** |
||
29 | * Make Command class from binding |
||
30 | * @param string $binding |
||
31 | * @throws \DeGraciaMathieu\Clike\Exceptions\UnknowCommand |
||
32 | * @return \DeGraciaMathieu\Clike\Contracts\Command |
||
33 | */ |
||
34 | protected function retrieveCommand(string $binding) :Contracts\Command |
||
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: