Completed
Push — master ( 8530e7...2147ca )
by Andrii
02:54
created

SimpleSaleRepository::findByIds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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\unit\sale;
12
13
use hiqdev\php\billing\action\ActionInterface;
14
use hiqdev\php\billing\order\OrderInterface;
15
use hiqdev\php\billing\sale\SaleInterface;
16
use hiqdev\php\billing\sale\SaleRepositoryInterface;
17
18 View Code Duplication
class SimpleSaleRepository implements SaleRepositoryInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    protected $sale;
21
22
    public function __construct(SaleInterface $sale)
23
    {
24
        $this->sale = $sale;
25
    }
26
27
    public function findByAction(ActionInterface $action)
0 ignored issues
show
Unused Code introduced by
The parameter $action is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        return $this->sale;
30
    }
31
32
    public function findByOrder(OrderInterface $order)
33
    {
34
        $sales = [];
35
        foreach ($order->getActions() as $actionKey => $action) {
36
            $sales[$actionKey] = $this->findByAction($action);
37
        }
38
39
        return $sales;
40
    }
41
42
    public function findByIds(array $ids)
0 ignored issues
show
Unused Code introduced by
The parameter $ids is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        throw new \Exception('not implemented');
45
    }
46
}
47