OrderBy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A desc() 0 3 1
A direction() 0 3 1
A __construct() 0 5 1
A asc() 0 3 1
1
<?php
2
3
namespace Zenstruck\Porpaginas\Specification;
4
5
/**
6
 * @author Kevin Bond <[email protected]>
7
 */
8
final class OrderBy extends Field
9
{
10
    public const ASC = 'ASC';
11
    public const DESC = 'DESC';
12
13
    private string $direction;
14
15 6
    private function __construct(string $field, string $direction)
16
    {
17 6
        parent::__construct($field);
18
19 6
        $this->direction = $direction;
20 6
    }
21
22 2
    public static function asc(string $field): self
23
    {
24 2
        return new self($field, self::ASC);
25
    }
26
27 4
    public static function desc(string $field): self
28
    {
29 4
        return new self($field, self::DESC);
30
    }
31
32 6
    public function direction(): string
33
    {
34 6
        return $this->direction;
35
    }
36
}
37