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

GetHostsResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A getHosts() 4 4 1
A setHosts() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Yandex\Webmaster\Models;
4
5
use Yandex\Metrica\Management\Models\Accounts;
6
use Yandex\Common\Model;
7
8
/**
9
 * Class GetHostsResponse
10
 *
11
 * @package Yandex\Webmaster\Models
12
 */
13 View Code Duplication
class GetHostsResponse extends Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
16
    /**
17
     * @var Hosts $hosts
18
     */
19
    protected $hosts = null;
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected $mappingClasses = [
25
        'hosts' => 'Yandex\Webmaster\Models\Hosts',
26
    ];
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected $propNameMap = [
32
        'hosts' => 'hostlist',
33
    ];
34
35
    /**
36
     * GetHostsResponse constructor.
37
     *
38
     * @param \SimpleXMLIterator $data
39
     */
40
    public function __construct(\SimpleXMLIterator $data)
41
    {
42
        $this->fromXml($data);
43
    }
44
45
    /**
46
     * Get Hosts
47
     *
48
     * @return Hosts
49
     */
50
    public function getHosts()
51
    {
52
        return $this->hosts;
53
    }
54
55
    /**
56
     * Set Hosts
57
     *
58
     * @param Hosts $hosts
59
     * @return $this
60
     */
61
    public function setHosts($hosts)
62
    {
63
        $this->hosts = $hosts;
64
65
        return $this;
66
    }
67
}
68