Completed
Push — master ( ca4bd4...d89b8a )
by Mauro
03:26
created

District   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 63
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDistrict() 9 9 2
A setDistrict() 5 5 1
A getZone() 4 4 1
A setZone() 5 5 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
 * This file is part of the La Voz Feed Generator package.
4
 *
5
 * (c) Zephia <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zephia\LaVozFeed\Entity;
12
13
use Zephia\LaVozFeed\Exception\LogicException;
14
15
/**
16
 * Class District
17
 *
18
 * @package Zephia\LaVozFeed\Entity
19
 * @author  Mauro Moreno <[email protected]>
20
 */
21 View Code Duplication
class District extends Entity
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...
22
{
23
    /**
24
     * @var string
25
     */
26
    private $district;
27
28
    /**
29
     * @var string
30
     */
31
    private $zone;
32
33
    /**
34
     * Get District
35
     *
36
     * @return string
37
     */
38
    public function getDistrict()
39
    {
40
        if (empty($this->district)) {
41
            throw new LogicException(
42
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'district')
43
            );
44
        }
45
        return $this->district;
46
    }
47
48
    /**
49
     * Get District
50
     *
51
     * @param string $district
52
     *
53
     * @return District
54
     */
55
    public function setDistrict($district)
56
    {
57
        $this->district = $district;
58
        return $this;
59
    }
60
61
    /**
62
     * Get Zone
63
     *
64
     * @return string
65
     */
66
    public function getZone()
67
    {
68
        return $this->zone;
69
    }
70
71
    /**
72
     * Get Zone
73
     *
74
     * @param string $zone
75
     *
76
     * @return District
77
     */
78
    public function setZone($zone)
79
    {
80
        $this->zone = $zone;
81
        return $this;
82
    }
83
}
84