OrderBy::direction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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