Passed
Push — master ( 0b999e...3d12f2 )
by Baptiste
43s
created

ComparisonTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 26
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A the_json_path_should_be_greater_than() 0 3 1
A the_json_path_should_be_greater_or_equal_than() 0 3 1
A the_json_path_should_be_less_or_equal_than() 0 3 1
A the_json_path_should_be_less_than() 0 3 1
1
<?php declare(strict_types=1);
2
namespace Behapi\Json;
3
4
use Webmozart\Assert\Assert;
5
6
trait ComparisonTrait
7
{
8
    abstract protected function getValue(?string $path);
9
10
    /** @Then in the json, :path should be greater than :expected */
11
    final public function the_json_path_should_be_greater_than(string $path, int $expected): void
12
    {
13
        Assert::greaterThan($this->getValue($path), $expected);
14
    }
15
16
    /** @Then in the json, :path should be greater than or equal to :expected */
17
    final public function the_json_path_should_be_greater_or_equal_than(string $path, int $expected): void
18
    {
19
        Assert::greaterThanEq($this->getValue($path), $expected);
20
    }
21
22
    /** @Then in the json, :path should be less than :expected */
23
    final public function the_json_path_should_be_less_than(string $path, int $expected): void
24
    {
25
        Assert::lessThan($this->getValue($path), $expected);
26
    }
27
28
    /** @Then in the json, :path should be less than or equal to :expected */
29
    final public function the_json_path_should_be_less_or_equal_than(string $path, int $expected): void
30
    {
31
        Assert::lessThanEq($this->getValue($path), $expected);
32
    }
33
}
34