Completed
Push — development ( eb9524...db4517 )
by Andrij
28:49 queued 02:09
created

Result::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace xbanners\src\UrlFinder\Results;
4
5
use Countable;
6
7
class Result implements ResultInterface, Countable
8
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
9
10
    /**
11
     * @var string
12
     */
13
    protected $groupName;
14
15
    /**
16
     * @var array
17
     */
18
    protected $urls = [];
19
20
    /**
21
     * @param string $groupName
22
     */
23
    public function __construct($groupName) {
24
        $this->groupName = $groupName;
25
    }
26
27
    public function addResult($name, $url) {
28
        $this->urls[$name] = $url;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getGroupName() {
35
        return $this->groupName;
36
    }
37
38
    public function count() {
39
        return count($this->urls);
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function getResults() {
46
        return $this->urls;
47
    }
48
49
    public function toArray() {
50
        return [ $this->getGroupName() => $this->getResults()];
51
    }
52
53
}