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.
Completed
Pull Request — master (#8)
by
unknown
04:22
created

LeadFile   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 53
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A toArray() 0 11 3
A getId() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace LPTracker\models;
4
5
use LPTracker\exceptions\LPTrackerSDKException;
6
7
class LeadFile extends Model
0 ignored issues
show
Bug introduced by
There is one abstract method validate in this class; you could implement it, or declare this class as abstract.
Loading history...
8
{
9
    /**
10
     * @var integer
11
     */
12
    protected $id;
13
14
    /**
15
     * @var string
16
     */
17
    protected $name;
18
19
    public function __construct(array $fileData = [])
20
    {
21
        if (!empty($fileData['id'])) {
22
            $this->id = (int) $fileData['id'];
23
        }
24
        if (!empty($fileData['name'])) {
25
            $this->name = (int) $fileData['name'];
0 ignored issues
show
Documentation Bug introduced by
The property $name was declared of type string, but (int) $fileData['name'] is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
26
        }
27
    }
28
29
    /**
30
     * @return array
31
     */
32
    public function toArray()
33
    {
34
        $result = [];
35
        if (!empty($this->id)) {
36
            $result['id'] = $this->getId();
37
        }
38
        if (!empty($this->name)) {
39
            $result['name'] = $this->getName();
40
        }
41
        return $result;
42
    }
43
44
    /**
45
     * @return int
46
     */
47
    public function getId()
48
    {
49
        return (int) $this->id;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getName()
56
    {
57
        return $this->name;
58
    }
59
}
60