WatchedResourceCollection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 24
ccs 0
cts 7
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createSingle() 0 6 1
A createMultiple() 0 12 2
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
}