Completed
Push — master ( eebd57...9e79a2 )
by Andrii
07:00
created

Asserter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2.032
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\formula;
12
13
use hiqdev\php\billing\charge\modifiers\LastCombination;
14
use Hoa\Ruler\Context;
15
use Hoa\Ruler\Model;
16
17
/**
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class Asserter extends \Hoa\Ruler\Visitor\Asserter
21
{
22
    /**
23
     * @param Context $context context
24
     */
25 2
    public function __construct(Context $context = null)
26
    {
27 2
        if (null !== $context) {
28
            $this->setContext($context);
29
        }
30
31 2
        $this->setOperator('and', [$this, 'makeAnd']);
32 2
    }
33
34
    public function makeAnd($lhs, $rhs)
35
    {
36
        return new LastCombination($lhs, $rhs);
37
    }
38
39 2
    public function visitModel(Model $element, &$handle = null, $eldnah = null)
40
    {
41 2
        return $element->getExpression()->accept($this, $handle, $eldnah);
42
    }
43
}
44