IntegerRange   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 23
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addToDiscreteBoundary() 0 3 1
A transformBoundary() 0 3 1
A forSql() 0 3 1
1
<?php
2
3
namespace Belamov\PostgresRange\Ranges;
4
5
/**
6
 * Class IntegerRange.
7
 *
8
 * @method int|null from()
9
 * @method int|null to()
10
 */
11
class IntegerRange extends CanonicalRange
12
{
13
    /**
14
     * @param  string  $boundary
15
     * @return string
16
     */
17
    protected function addToDiscreteBoundary(string $boundary): string
18
    {
19
        return (string) ($this->transformBoundary($boundary) + 1);
20
    }
21
22
    /**
23
     * @param  string  $boundary
24
     * @return int
25
     */
26
    protected function transformBoundary(string $boundary): int
27
    {
28
        return (int) $boundary;
29
    }
30
31
    public function forSql(): string
32
    {
33
        return "'$this'";
34
    }
35
}
36