1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Inotify; |
||
6 | |||
7 | use Symfony\Component\EventDispatcher\EventDispatcher; |
||
8 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||
9 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||
10 | |||
11 | class InotifyConsumerFactory |
||
12 | { |
||
13 | private $inotifyProxy; |
||
14 | /** |
||
15 | * @var EventDispatcherInterface |
||
16 | */ |
||
17 | private $eventDispatcher; |
||
18 | |||
19 | public function __construct( |
||
20 | InotifyProxyInterface $inotifyProxy = null, |
||
21 | EventDispatcherInterface $eventDispatcher = null |
||
22 | ) { |
||
23 | $this->inotifyProxy = $inotifyProxy; |
||
24 | $this->eventDispatcher = $eventDispatcher; |
||
25 | |||
26 | if (null === $eventDispatcher) { |
||
27 | $this->eventDispatcher = new EventDispatcher(); |
||
28 | } |
||
29 | if (null === $inotifyProxy) { |
||
30 | $this->inotifyProxy = new InotifyProxy(); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param WatchedResourceCollection|WatchedResource[] $collection |
||
36 | */ |
||
37 | public function consume(WatchedResourceCollection $collection): void |
||
38 | { |
||
39 | foreach ($collection as $resource) { |
||
40 | $this->inotifyProxy->addWatch($resource); |
||
0 ignored issues
–
show
|
|||
41 | } |
||
42 | |||
43 | while ($events = $this->inotifyProxy->read()) { |
||
44 | foreach ($events as $event) { |
||
45 | $this->eventDispatcher->dispatch($event); |
||
46 | } |
||
47 | } |
||
48 | |||
49 | $this->inotifyProxy->closeWatchers(); |
||
50 | } |
||
51 | |||
52 | public function registerSubscriber(EventSubscriberInterface $eventSubscribers): self |
||
53 | { |
||
54 | $this->eventDispatcher->addSubscriber($eventSubscribers); |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.