Passed
Push — master ( cbb991...62e47c )
by Albert
07:16 queued 05:08
created

FSOutput::format()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SwooleTW\Http\HotReload;
4
5
/**
6
 * Class FSOutput
7
 */
8
class FSOutput
9
{
10
    /**
11
     * @param \SwooleTW\Http\HotReload\FSEvent $event
12
     *
13
     * @return string
14
     */
15
    public static function format(FSEvent $event): string
16
    {
17
        $item = is_dir($event->getPath()) ? 'Directory' : 'File';
18
        $events = implode(', ', $event->getTypes());
19
        $time = $event->getWhen()->format('Y.m.d H:i:s');
20
21
        return sprintf('%s: %s %s at %s', $item, $event->getPath(), $events, $time);
22
    }
23
}