Completed
Push — master ( ed3ca4...bcd0d2 )
by Dmitry
11:49
created

SimplePlanRepository::getById()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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\unit\plan;
12
13
use hiqdev\php\billing\action\ActionInterface;
14
use hiqdev\php\billing\Exception\EntityNotFoundException;
15
use hiqdev\php\billing\order\OrderInterface;
16
use hiqdev\php\billing\plan\PlanInterface;
17
use hiqdev\php\billing\plan\PlanRepositoryInterface;
18
19
class SimplePlanRepository implements PlanRepositoryInterface
20
{
21
    protected $plan;
22
23
    public function __construct(PlanInterface $plan)
24
    {
25
        $this->plan = $plan;
26
    }
27
28
    public function findByAction(ActionInterface $action)
29
    {
30
        return $this->plan;
31
    }
32
33
    public function findByOrder(OrderInterface $order)
34
    {
35
        $plans = [];
36
        foreach (array_keys($order->getActions()) as $actionKey) {
37
            $plans[$actionKey] = $this->plan;
38
        }
39
40
        return $plans;
41
    }
42
43
    public function findByIds(array $ids)
44
    {
45
        throw new \Exception('not implemented');
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function getById(int $id): PlanInterface
52
    {
53
        throw new \Exception('not implemented');
54
    }
55
}
56