Completed
Push — master ( ec4e5d...fd3bfb )
by Sebastian
03:44 queued 48s
created

ResultCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addResult() 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->elements[] = $result;
14
    }
15
16
    /**
17
     * @return array
18
     */
19
    public function asDataProviderArray()
20
    {
21
        $retValue = [];
22
        /** @var Result $result */
23
        foreach ($this as $key => $result) {
24
            $key = sprintf('#%d: %s', $key, $result->getUrl()->asString());
25
            $retValue[$key] = [$result];
26
        }
27
28
        return $retValue;
29
    }
30
}
31