Completed
Push — master ( c34bb5...a29fc9 )
by Andrii
04:22
created

Asserter::makeAnd()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 6
    public function __construct(Context $context = null)
26
    {
27 6
        if (null !== $context) {
28
            $this->setContext($context);
29
        }
30
31 6
        $this->setOperator('and', [$this, 'makeAnd']);
32 6
    }
33
34 1
    public function makeAnd($lhs, $rhs)
35
    {
36 1
        return new LastCombination($lhs, $rhs);
37
    }
38
39 5
    public function visitModel(Model $element, &$handle = null, $eldnah = null)
40
    {
41 5
        return $element->getExpression()->accept($this, $handle, $eldnah);
42
    }
43
}
44