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

ResultCollection::asDataProviderArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
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