Completed
Push — master ( 557060...19a865 )
by Muhammad Kashif
25:46
created

InMemoryServiceRepository::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Gr8abbasi\Container\Repository;
4
5
class InMemoryServiceRepository implements ServiceRepositoryInterface
6
{
7
    /**
8
     * @var array $serviceStore
9
     */
10
    private $serviceStore;
11
12
    /**
13
     * @inheritdoc
14
     */
15 5
    public function get($serviceId)
16
    {
17 5
        if(!isset($this->serviceStore[$serviceId]) || !isset($serviceId)){
18 4
            return Null;
19
        }
20
21 2
        return $this->serviceStore[$serviceId];
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27 2
    public function add($id, $service)
28
    {
29 2
        $this->serviceStore[$id] = $service;
30 2
    }
31
}
32