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.

IntegerField   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setData() 0 8 2
A getData() 0 4 1
1
<?php
2
namespace Solvire\API\Serializers\DataFields;
3
4
/**
5
 *
6
 * @author solvire <[email protected]>
7
 * @package DataFields
8
 * @namespace Solvire\API\Serializers\DataFields
9
 */
10
class IntegerField extends DataField
11
{
12
13
    protected $cast = 'integer';
14
15 1
    public function setData($data)
16
    {
17 1
        if (! is_int($data))
18 1
            throw new \RuntimeException('IntegerField data must be an integer ' . $data . ' in ' . $this->name);
19
        
20 1
        $this->data = $data;
21 1
        return $this;
22
    }
23
24
    /**
25
     * This is a int so it will always be just a integer
26
     */
27 2
    public function getData()
28
    {
29 2
        return (int) $this->data;
30
    }
31
}