Total Complexity | 9 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 68% |
Changes | 0 |
1 | <?php |
||
9 | final class JsonRepositoryCache implements RepositoryCache |
||
10 | { |
||
11 | /** @var Repository */ |
||
12 | private $repository; |
||
13 | |||
14 | /** @var int */ |
||
15 | private $jsonOptions; |
||
16 | |||
17 | public function __construct(Repository $repository, int $jsonOptions = JSON_PRETTY_PRINT) |
||
18 | { |
||
19 | $this->repository = $repository; |
||
20 | $this->jsonOptions = $jsonOptions; |
||
21 | } |
||
22 | |||
23 | 2 | public function getRepository(): Repository |
|
24 | { |
||
25 | 2 | return $this->repository; |
|
26 | } |
||
27 | |||
28 | 2 | public function addPackage(Package $package) |
|
29 | { |
||
30 | 2 | $this->upsertPackage($package); |
|
31 | 2 | } |
|
32 | |||
33 | public function editPackage(Package $package) |
||
34 | { |
||
35 | $this->upsertPackage($package); |
||
36 | } |
||
37 | |||
38 | 2 | public function removePackage(Package $package) |
|
39 | { |
||
40 | 2 | $this->repository->removePackage($package); |
|
41 | 2 | } |
|
42 | |||
43 | 2 | private function upsertPackage(Package $package) |
|
44 | { |
||
45 | 2 | $this->repository->addPackage($package); |
|
46 | 2 | } |
|
47 | |||
48 | 2 | public function refresh() |
|
54 | } |
||
55 | 2 | } |
|
56 | |||
57 | 3 | public function count() |
|
58 | { |
||
60 | } |
||
61 | } |
||
62 |