Circle   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 55
loc 55
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getCenter() 4 4 1
A setCenter() 4 4 1
A getRadius() 4 4 1
A setRadius() 4 4 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
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Overlay;
13
14
use Ivory\GoogleMap\Base\Coordinate;
15
use Ivory\GoogleMap\Utility\OptionsAwareInterface;
16
use Ivory\GoogleMap\Utility\OptionsAwareTrait;
17
use Ivory\GoogleMap\Utility\VariableAwareTrait;
18
19
/**
20
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#Circle
21
 *
22
 * @author GeLo <[email protected]>
23
 */
24 View Code Duplication
class Circle implements ExtendableInterface, OptionsAwareInterface
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...
25
{
26
    use OptionsAwareTrait;
27
    use VariableAwareTrait;
28
29
    /**
30
     * @var Coordinate
31
     */
32
    private $center;
33
34
    /**
35
     * @var float
36
     */
37
    private $radius;
38
39
    /**
40
     * @param float   $radius
41
     * @param mixed[] $options
42
     */
43 32
    public function __construct(Coordinate $center, $radius = 1.0, array $options = [])
44
    {
45 32
        $this->setCenter($center);
46 32
        $this->setRadius($radius);
47 32
        $this->addOptions($options);
48 32
    }
49
50
    /**
51
     * @return Coordinate
52
     */
53 20
    public function getCenter()
54
    {
55 20
        return $this->center;
56
    }
57
58 32
    public function setCenter(Coordinate $center)
59
    {
60 32
        $this->center = $center;
61 32
    }
62
63
    /**
64
     * @return float
65
     */
66 16
    public function getRadius()
67
    {
68 16
        return $this->radius;
69
    }
70
71
    /**
72
     * @param float $radius
73
     */
74 32
    public function setRadius($radius)
75
    {
76 32
        $this->radius = $radius;
77 32
    }
78
}
79