Completed
Push — master ( a4f70a...5b7a0f )
by Andrii
05:16
created

SimplePlanRepository::findByIds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
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\plan;
12
13
use hiqdev\php\billing\action\ActionInterface;
14
use hiqdev\php\billing\order\OrderInterface;
15
use hiqdev\php\billing\plan\PlanInterface;
16
use hiqdev\php\billing\plan\PlanRepositoryInterface;
17
18
class SimplePlanRepository implements PlanRepositoryInterface
19
{
20
    protected $plan;
21
22
    public function __construct(PlanInterface $plan)
23
    {
24
        $this->plan = $plan;
25
    }
26
27
    public function findByAction(ActionInterface $action)
28
    {
29
        return $this->plan;
30
    }
31
32
    public function findByOrder(OrderInterface $order)
33
    {
34
        $plans = [];
35
        foreach (array_keys($order->getActions()) as $actionKey) {
36
            $plans[$actionKey] = $this->plan;
37
        }
38
39
        return $plans;
40
    }
41
42
    public function findByIds(array $ids)
43
    {
44
        throw new \Exception('not implemented');
45
    }
46
}
47