Passed
Push — develop ( 6e1cbd...b98f4a )
by Sebastian
02:28
created

ResultCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addResult() 0 4 1
A current() 0 4 1
A asDataProviderArray() 0 11 2
1
<?php
2
namespace DjThossi\SmokeTestingPhp\Collection;
3
4
use DjThossi\SmokeTestingPhp\Result\Result;
5
6
class ResultCollection extends BaseCollection
7
{
8
    /**
9
     * @param Result $result
10
     */
11
    public function addResult(Result $result)
12
    {
13
        $this->addElement($result);
14
    }
15
16
    /**
17
     * @return Result
18
     */
19
    public function current()
20
    {
21
        return $this->getCurrent();
22
    }
23
24
    /**
25
     * @return array
26
     */
27
    public function asDataProviderArray()
28
    {
29
        $retValue = [];
30
        /** @var Result $result */
31
        foreach ($this as $key => $result) {
32
            $key = sprintf('#%d: %s', $key, $result->getUrl()->asString());
33
            $retValue[$key] = [$result];
34
        }
35
36
        return $retValue;
37
    }
38
}
39