@@ -42,48 +42,48 @@ |
||
42 | 42 | */ |
43 | 43 | final class ServiceEventListener { |
44 | 44 | |
45 | - /** @var IServerContainer */ |
|
46 | - private $container; |
|
45 | + /** @var IServerContainer */ |
|
46 | + private $container; |
|
47 | 47 | |
48 | - /** @var string */ |
|
49 | - private $class; |
|
48 | + /** @var string */ |
|
49 | + private $class; |
|
50 | 50 | |
51 | - /** @var LoggerInterface */ |
|
52 | - private $logger; |
|
51 | + /** @var LoggerInterface */ |
|
52 | + private $logger; |
|
53 | 53 | |
54 | - /** @var null|IEventListener */ |
|
55 | - private $service; |
|
54 | + /** @var null|IEventListener */ |
|
55 | + private $service; |
|
56 | 56 | |
57 | - public function __construct(IServerContainer $container, |
|
58 | - string $class, |
|
59 | - LoggerInterface $logger) { |
|
60 | - $this->container = $container; |
|
61 | - $this->class = $class; |
|
62 | - $this->logger = $logger; |
|
63 | - } |
|
57 | + public function __construct(IServerContainer $container, |
|
58 | + string $class, |
|
59 | + LoggerInterface $logger) { |
|
60 | + $this->container = $container; |
|
61 | + $this->class = $class; |
|
62 | + $this->logger = $logger; |
|
63 | + } |
|
64 | 64 | |
65 | - public function __invoke(Event $event) { |
|
66 | - if ($this->service === null) { |
|
67 | - try { |
|
68 | - // TODO: fetch from the app containers, otherwise any custom services, |
|
69 | - // parameters and aliases won't be resolved. |
|
70 | - // See https://github.com/nextcloud/server/issues/27793 for details. |
|
71 | - $this->service = $this->container->query($this->class); |
|
72 | - } catch (QueryException $e) { |
|
73 | - $this->logger->error( |
|
74 | - sprintf( |
|
75 | - 'Could not load event listener service %s: %s. Make sure the class is auto-loadable by the Nextcloud server container', |
|
76 | - $this->class, |
|
77 | - $e->getMessage() |
|
78 | - ), |
|
79 | - [ |
|
80 | - 'exception' => $e, |
|
81 | - ] |
|
82 | - ); |
|
83 | - return; |
|
84 | - } |
|
85 | - } |
|
65 | + public function __invoke(Event $event) { |
|
66 | + if ($this->service === null) { |
|
67 | + try { |
|
68 | + // TODO: fetch from the app containers, otherwise any custom services, |
|
69 | + // parameters and aliases won't be resolved. |
|
70 | + // See https://github.com/nextcloud/server/issues/27793 for details. |
|
71 | + $this->service = $this->container->query($this->class); |
|
72 | + } catch (QueryException $e) { |
|
73 | + $this->logger->error( |
|
74 | + sprintf( |
|
75 | + 'Could not load event listener service %s: %s. Make sure the class is auto-loadable by the Nextcloud server container', |
|
76 | + $this->class, |
|
77 | + $e->getMessage() |
|
78 | + ), |
|
79 | + [ |
|
80 | + 'exception' => $e, |
|
81 | + ] |
|
82 | + ); |
|
83 | + return; |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - $this->service->handle($event); |
|
88 | - } |
|
87 | + $this->service->handle($event); |
|
88 | + } |
|
89 | 89 | } |