Passed
Push — master ( fd2f7c...a88c1a )
by Andrii
02:45
created

SimpleBillRepository::findByTarget()   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\support\bill;
12
13
use hiqdev\php\billing\bill\BillInterface;
14
use hiqdev\php\billing\bill\BillRepositoryInterface;
15
use hiqdev\php\billing\target\TargetInterface;
16
17
class SimpleBillRepository implements BillRepositoryInterface
18
{
19
    protected $bills;
20
21
    public function findId(BillInterface $bill)
22
    {
23
        throw new \Exception('not implemented');
24
    }
25
26
    public function findIds(array $bills): array
27
    {
28
        throw new \Exception('not implemented');
29
    }
30
31
    public function findByIds(array $ids): array
32
    {
33
        $bills = [];
34
        foreach ($ids as $id) {
35
            if (empty($this->bills[$id])) {
36
                continue;
37
            }
38
            $bills[$id] = $this->bills[$id];
39
        }
40
41
        return $bills;
42
    }
43
44
    public function save(BillInterface $bill)
45
    {
46
        $id = $bill->getId();
47
        $this->bills[$id] = $bill;
48
49
        return $id;
50
    }
51
52
    public function findByUniqueness(BillInterface $bill)
53
    {
54
        return $this->bills;
55
    }
56
}
57