Completed
Push — master ( adb54b...754379 )
by Muhammad Kashif
25:19
created

InMemoryServiceRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 8 2
A add() 0 4 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
    public function get($serviceId)
16
    {
17
        if(!isset($serviceId)){
18
            return Null;
19
        }
20
21
        return $this->serviceStore[$serviceId];
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function add($id, $service)
28
    {
29
        $this->serviceStore[$id] = $service;
30
    }
31
}
32