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

Hosts::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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