Completed
Push — master ( 1e7ae1...1641c1 )
by Axel
04:29
created

ProjectRegistry::store()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 5.0488

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 4
nop 1
dl 0
loc 10
ccs 7
cts 8
cp 0.875
crap 5.0488
rs 8.8571
c 0
b 0
f 0
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
}