Comparison::getAttributePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cloudstek\SCIM\FilterParser\AST;
6
7
/**
8
 * Comparison.
9
 */
10
class Comparison extends AbstractNode
11
{
12
    private AttributePath $attributePath;
13
14
    private Operator $operator;
1 ignored issue
show
Bug introduced by
The type Cloudstek\SCIM\FilterParser\AST\Operator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
    /** @var bool|string|int|float|null */
17
    private string|int|bool|null|float $value;
18
19
    /**
20
     * Comparison.
21
     *
22
     * @param AttributePath              $attributePath
23
     * @param string|Operator            $operator
24
     * @param float|bool|int|string|null $value
25
     * @param Node|null                  $parent
26
     *
27
     * @throws \UnexpectedValueException On invalid operator.
28
     */
29
    public function __construct(
30
        AttributePath $attributePath,
31
        Operator|string $operator,
32
        float|bool|int|string|null $value,
33
        ?Node $parent = null
34
    ) {
35
        parent::__construct($parent);
36
37
        $this->attributePath = $attributePath;
38
        $this->operator = $operator instanceof Operator ? $operator : Operator::from($operator);
39
        $this->value = $value;
40
    }
41
42
    /**
43
     * Get attribute path.
44
     *
45
     * @return AttributePath
46
     */
47
    public function getAttributePath(): AttributePath
48
    {
49
        return $this->attributePath;
50
    }
51
52
    /**
53
     * Set attribute path.
54
     *
55
     * @param AttributePath $attributePath
56
     *
57
     * @internal
58
     * @return Comparison
59
     *
60
     */
61
    public function setAttributePath(AttributePath $attributePath): Comparison
62
    {
63
        $this->attributePath = $attributePath;
64
65
        return $this;
66
    }
67
68
    /**
69
     * Get operator.
70
     *
71
     * @return Operator
72
     */
73
    public function getOperator(): Operator
74
    {
75
        return $this->operator;
76
    }
77
78
    /**
79
     * Get value.
80
     *
81
     * @return bool|float|int|string|null
82
     */
83
    public function getValue(): float|bool|int|string|null
84
    {
85
        return $this->value;
86
    }
87
}
88