Completed
Pull Request — master (#161)
by
unknown
07:58
created

Hosts   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A add() 0 6 1
A getAll() 0 4 1
1
<?php
2
namespace Yandex\Webmaster\Models;
3
4
use Yandex\Common\ObjectModel;
5
6
/**
7
 * Class Hosts
8
 *
9
 * @package Yandex\Webmaster\Models
10
 */
11
class Hosts extends ObjectModel
12
{
13
    /**
14
     * @var array $collection a collection of Host objects
15
     */
16
    protected $collection = [];
17
18
    /**
19
     * @var array $mappingClasses
20
     */
21
    protected $mappingClasses = [];
22
23
    /**
24
     * @var array $propNameMap
25
     */
26
    protected $propNameMap = [];
27
28
    /**
29
     * Hosts constructor.
30
     *
31
     * @param \SimpleXMLIterator $data
32
     */
33
    public function __construct(\SimpleXMLIterator $data)
34
    {
35
        $this->fromXml($data);
36
    }
37
38
    /**
39
     * Add item
40
     *
41
     * @param \SimpleXMLIterator $host
42
     *
43
     * @return $this
44
     */
45
    public function add(\SimpleXMLIterator $host)
46
    {
47
        $this->collection[] = new Host($host);
48
49
        return $this;
50
    }
51
52
    /**
53
     * Get items
54
     *
55
     * @return array
56
     */
57
    public function getAll()
58
    {
59
        return $this->collection;
60
    }
61
}
62