1 | <?php |
||
24 | class LoggerListener implements SubscriberInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var Client |
||
28 | */ |
||
29 | protected $client; |
||
30 | |||
31 | public function __construct(Client $client) |
||
32 | { |
||
33 | $this->client = $client; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return Logger |
||
38 | */ |
||
39 | protected function getLogger() |
||
40 | { |
||
41 | return $this->client->getLogger(); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public static function getSubscribedEvents() |
||
48 | { |
||
49 | return [ |
||
50 | Events::CLIENT_RUN => 'onClientRun', |
||
51 | Events::CLIENT_CONNECT => 'onConnectToServer', |
||
52 | Events::CANNOT_CONNECT_SERVER => 'onCannotConnectToServer', |
||
53 | Events::CLIENT_ACTION => 'onReceiveMessage', |
||
54 | Events::CONNECTION_ERROR => 'onConnectionError', |
||
55 | Events::AUTH_ERROR => 'onAuthError', |
||
56 | Events::AUTH_SUCCESS => 'onAuthSuccess', |
||
57 | Events::REGISTER_TUNNEL_ERROR => 'onRegisterTunnelError', |
||
58 | Events::DISCONNECT_FROM_SERVER => 'onDisconnectFromServer', |
||
59 | ]; |
||
60 | } |
||
61 | |||
62 | public function onAuthError(Event $event) |
||
|
|||
63 | { |
||
64 | $this->getLogger()->error('Auth error, please check your configuration file'); |
||
65 | } |
||
66 | |||
67 | public function onAuthSuccess(Event $event) |
||
71 | |||
72 | public function onRegisterTunnelError(Event $event) |
||
73 | { |
||
74 | $this->getLogger()->error(sprintf('Registers tunnel "%s" error, message: "%s"', |
||
79 | |||
80 | public function onDisconnectFromServer(Event $event) |
||
84 | |||
85 | public function onReceiveMessage(FilterActionHandlerEvent $event) |
||
89 | |||
90 | public function onClientRun(Event $event) |
||
94 | |||
95 | public function onConnectionError(Event $event) |
||
102 | |||
103 | public function onConnectToServer(Event $event) |
||
107 | |||
108 | public function onCannotConnectToServer(Event $event) |
||
112 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.