MemoryCollector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 8 2
A write() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Leaditin\Annotations\Collector;
6
7
use Leaditin\Annotations\Reflection;
8
9
/**
10
 * Class MemoryCollector
11
 *
12
 * @package Leaditin\Annotations\Collector
13
 * @author Igor Vuckovic <[email protected]>
14
 */
15
class MemoryCollector extends AbstractCollector
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    public function read(string $class) : Reflection
21
    {
22 1
        if ($this->has($class) === false) {
23 1
            $this->write($class, $this->reader->read($class));
24
        }
25
26 1
        return $this->get($class);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    protected function write(string $class, Reflection $reflection)
33
    {
34 1
        $this->set($class, $reflection);
35 1
    }
36
}
37