ProjectRegistry   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 10
cts 11
cp 0.9091
rs 10
c 0
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getItems() 0 3 1
B store() 0 10 5
1
<?php
2
3
namespace App\Registry;
4
5
class ProjectRegistry implements RegistryInterface
6
{
7
    protected $projects = [
8
        'working' => [],
9
        'submitted' => [],
10
        'preparing' => []
11
    ];
12
    
13 1
    public function store(array $items = [])
14
    {
15 1
        foreach ($items as $project) {
16 1
            $poll = $project->getApprovalPoll();
17 1
            if ($poll !== null && $poll->getIsEnded() === true) {
18 1
                $this->projects['working'][] = $project;
19 1
            } elseif ($poll !== null) {
20
                $this->projects['submitted'][] = $project;
21
            } else {
22 1
                $this->projects['preparing'][] = $project;
23
            }
24
        }
25 1
    }
26
    
27 1
    public function getItems(): array
28
    {
29 1
        return $this->projects;
30
    }
31
}