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

Modifier::withPriority()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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