WatchedResourceCollection::createSingle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 6
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inotify;
6
7
use Vistik\Collections\TypedCollection;
8
9
class WatchedResourceCollection extends TypedCollection
10
{
11
    protected $type = WatchedResource::class;
12
13
    public static function createSingle(
14
        string $pathname,
15
        int $watchOnChangeFlags,
16
        string $customName
17
    ): self {
18
        return (new self())->push(new WatchedResource($pathname, $watchOnChangeFlags, $customName));
19
    }
20
21
    public static function createMultiple(
22
        array $paths,
23
        int $watchOnChangeFlags,
24
        string $customName
25
    ): self {
26
        $collection = new self();
27
28
        foreach ($paths as $pathname) {
29
            $collection->push(new WatchedResource($pathname, $watchOnChangeFlags, $customName));
30
        }
31
32
        return $collection;
33
    }
34
}