1 | <?php |
||
18 | class WebHookController extends AbstractHookController |
||
19 | { |
||
20 | use LoggerTrait; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $colorMap = [ |
||
26 | 'info' => Message\Attachment::COLOR_INFO, |
||
27 | 'ok' => Message\Attachment::COLOR_GOOD, |
||
28 | 'warning' => Message\Attachment::COLOR_WARNING, |
||
29 | 'danger' => Message\Attachment::COLOR_DANGER, |
||
30 | 'notice' => Message\Attachment::COLOR_NOTICE, |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * public method to start processing the request. |
||
35 | * |
||
36 | * @param string $hook |
||
37 | * @param string $input |
||
38 | * |
||
39 | * Input example: |
||
40 | * { |
||
41 | * "securityToken": "a valid security token", |
||
42 | * "color": [info|ok|warning|danger|notice|#HEXCODE], |
||
43 | * "title": "Title of the message" |
||
44 | * "text": "Text of the message" |
||
45 | * } |
||
46 | * |
||
47 | * @throws \Doctrine\DBAL\DBALException |
||
48 | * @throws \Exception |
||
49 | */ |
||
50 | 9 | public function process($hook, $input = 'php://input') |
|
63 | |||
64 | /** |
||
65 | * @param \stdClass $json |
||
66 | * @param array $hookConfiguration |
||
67 | * |
||
68 | * @throws \Doctrine\DBAL\DBALException |
||
69 | */ |
||
70 | 7 | protected function sendMessage(\stdClass $json, array $hookConfiguration) |
|
90 | } |
||
91 |