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

LinearRing::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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