Completed
Push — master ( f8b790...ca13fb )
by Bobby
03:19
created

LinearRing   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 30
ccs 6
cts 7
cp 0.8571
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addRing() 0 9 2
A get() 0 4 1
1
<?php
2
3
namespace Ballen\Cartographer\Core;
4
5
use Ballen\Collection\Collection;
6
7
class LinearRing
8
{
9
10
    private $rings = [];
11
12
    /**
13
     * Add a coordinate group to the object.
14
     * @param array $coordinates
15
     * @return \Ballen\Cartographer\Core\LinearRing
16
     * @throws \InvalidArgumentException
17
     */
18 8
    public function addRing(array $coordinates)
19
    {
20
        //die(var_dump((count($coordinates) - 1)));
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
21 8
        if ($coordinates[0] != $coordinates[(count($coordinates) - 1)]) {
22
            throw new \InvalidArgumentException('The first and last coordinates must be the same.');
23
        }
24 8
        $this->rings[] = $coordinates;
25 8
        return $this;
26
    }
27
28
    /**
29
     * Returns the array of groups
30
     * @return array
31
     */
32 4
    public function get()
33
    {
34 4
        return $this->rings;
35
    }
36
}
37