Completed
Push — master ( a88c1a...2a7402 )
by Andrii
02:44
created

SimpleBilling::calculate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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\tests\support\order;
12
13
use hiqdev\php\billing\bill\BillRepositoryInterface;
14
use hiqdev\php\billing\order\Billing;
15
use hiqdev\php\billing\order\CalculatorInterface;
16
use hiqdev\php\billing\tests\support\bill\SimpleBillRepository;
17
use hiqdev\php\billing\tools\Aggregator;
18
use hiqdev\php\billing\tools\AggregatorInterface;
19
use hiqdev\php\billing\tools\Merger;
20
use hiqdev\php\billing\tools\MergerInterface;
21
22
class SimpleBilling extends Billing
23
{
24
    public function __construct(
25
        CalculatorInterface $calculator = null,
26
        AggregatorInterface $aggregator = null,
27
        MergerInterface $merger = null,
28
        $repository = null
29
    ) {
30
        $calculator = $calculator ?: new SimpleCalculator();
31
        $aggregator = $aggregator ?: new Aggregator($calculator->getGeneralizer());
0 ignored issues
show
Bug introduced by
The method getGeneralizer() does not exist on hiqdev\php\billing\order\CalculatorInterface. It seems like you code against a sub-type of hiqdev\php\billing\order\CalculatorInterface such as hiqdev\php\billing\tests...\order\SimpleCalculator. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        $aggregator = $aggregator ?: new Aggregator($calculator->/** @scrutinizer ignore-call */ getGeneralizer());
Loading history...
32
        $merger = $merger ?: new Merger();
33
        $repository = $repository ?: new SimpleBillRepository();
34
35
        parent::__construct($calculator, $aggregator, $merger, $repository);
36
    }
37
38
    public function getBillRepository(): BillRepositoryInterface
39
    {
40
        return $this->repository;
41
    }
42
}
43