WatchedResourceCollection::createMultiple()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 12
ccs 0
cts 5
cp 0
crap 6
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
}