anonymous//example/example.php$0   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 2
b 0
f 0
dl 0
loc 9
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A example.php$0 ➔ getSubscribedEvents() 0 3 1
A example.php$0 ➔ onInotifyEvent() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Inotify\InotifyConsumerFactory;
6
use Inotify\InotifyEvent;
7
use Inotify\InotifyEventCodeEnum;
8
use Inotify\WatchedResourceCollection;
9
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
10
11
include __DIR__ . '/../vendor/autoload.php';
12
13
(new InotifyConsumerFactory())
14
    ->registerSubscriber(
15
        new class implements EventSubscriberInterface {
16
            public static function getSubscribedEvents(): array
17
            {
18
                return [InotifyEvent::class => 'onInotifyEvent'];
19
            }
20
21
            public function onInotifyEvent(InotifyEvent $event): void
22
            {
23
                echo $event;
24
            }
25
        }
26
    )->consume(
27
        WatchedResourceCollection::createSingle(
28
            sys_get_temp_dir(),
29
            // sys_get_temp_dir() . '/test.log',
30
            //InotifyEventCodeEnum::ON_CREATE()->getValue() | InotifyEventCodeEnum::ON_DELETE()->getValue(),
31
            InotifyEventCodeEnum::ON_ALL_EVENTS()->getValue(),
32
            'test'
33
        )
34
    );