GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PointField   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 37
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B setData() 0 13 5
A getData() 0 4 1
1
<?php
2
namespace Solvire\API\Serializers\DataFields;
3
4
use Solvire\API\Exceptions\InvalidParameterException;
5
6
/**
7
 * Kind of a hack to couple the data elements in separate fields as a single point for representation
8
 * In GIS databases this would be one data element.
9
 *
10
 *
11
 * @author solvire <[email protected]>
12
 * @package DataFields
13
 * @namespace Solvire\API\Serializers\DataFields
14
 */
15
class PointField extends DataField
16
{
17
18
    protected $cast = 'array';
19
20 4
    public function __construct($options)
21
    {
22 4
        parent::__construct($options);
23 4
    }
24
25
    /**
26
     * (non-PHPdoc)
27
     *
28
     * @see \Solvire\API\Serializers\DataFields\DataField::setData()
29
     */
30 2
    public function setData($data)
31
    {
32 2
        if ((! is_array($data) || ! isset($data['latitude']) || ! isset($data['longitude'])) && ! $this->allowNull())
33 2
            throw new InvalidParameterException('PointField data must be an array of fields with keys of latitude and longitude');
34
            
35
            // keeping it clean
36
            // don't want other fields slipping in
37 2
        $this->data = [
38 2
            'latitude' => $data['latitude'],
39 2
            'longitude' => $data['longitude']
40 2
        ];
41 2
        return $this;
42
    }
43
44
    /**
45
     * This is a char so it will always be just a string
46
     */
47 2
    public function getData()
48
    {
49 2
        return $this->data;
50
    }
51
}
52