ProjectRegistry::getItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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
}