1 | <?php |
||
18 | class ChannelCommand extends AbstractCommand |
||
19 | { |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $commandName = 'channel'; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $helpCommands = [ |
||
29 | 'help' => 'shows this help' |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * @return bool|string |
||
34 | * |
||
35 | * @throws \Doctrine\DBAL\DBALException |
||
36 | */ |
||
37 | public function process() |
||
41 | |||
42 | /** |
||
43 | * @param array $data |
||
44 | * @example $data: |
||
45 | * [ |
||
46 | * "type": "channel_created", |
||
47 | * "channel": { |
||
48 | * "id": "C024BE91L", |
||
49 | * "name": "fun", |
||
50 | * "created": 1360782804, |
||
51 | * "creator": "U024BE7LH" |
||
52 | * } |
||
53 | * ] |
||
54 | */ |
||
55 | public function processChannelCreated(array $data) |
||
67 | } |
||
68 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: