Passed
Pull Request — master (#62)
by Alexander
07:46
created

Modifier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withPriority() 0 5 1
A getPriority() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Arrays\Collection\Modifier;
6
7
use Yiisoft\Arrays\Collection\Modifier\ModifierInterface\ModifierInterface;
8
9
abstract class Modifier implements ModifierInterface
10
{
11
    public const PRIORITY_HIGH = 10000;
12
    public const PRIORITY_NORMAL = 0;
13
    public const PRIORITY_LOW = -10000;
14
15
    protected int $priority = self::PRIORITY_NORMAL;
16
17 3
    public function getPriority(): int
18
    {
19 3
        return $this->priority;
20
    }
21
22 3
    public function withPriority(int $priority): self
23
    {
24 3
        $new = clone $this;
25 3
        $new->priority = $priority;
26 3
        return $new;
27
    }
28
}
29