example.php$0 ➔ onInotifyEvent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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
    );