Test Failed
Pull Request — main (#372)
by
unknown
16:58 queued 06:32
created

BaseRange::isEmpty()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=0);
4
5
namespace MartinGeorgiev\Model;
6
7
abstract class BaseRange implements RangeInterface
8
{
9
    public function isLowerInfinite(): bool
10
    {
11
        return null === $this->lower;
12
    }
13
14
    public function isUpperInfinite(): bool
15
    {
16
        return null === $this->upper;
17
    }
18
19
    public function isEmpty(): bool
20
    {
21
        return null !== $this->lower && $this->lower === $this->upper;
22
    }
23
24
    public function isInfinite(): bool
25
    {
26
        return $this->isLowerInfinite() && $this->isUpperInfinite();
27
    }
28
29
    public function hasSingleBoundary(): bool
30
    {
31
        return !$this->isLowerInfinite() xor !$this->isUpperInfinite();
32
    }
33
34
    public function hasBothBoundaries(): bool
35
    {
36
        return !$this->isLowerInfinite() && !$this->isUpperInfinite();
37
    }
38
}
39