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.

Column   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 6
Bugs 3 Features 3
Metric Value
wmc 10
c 6
b 3
f 3
lcom 0
cbo 0
dl 0
loc 104
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A getName() 0 4 1
A getDefault() 0 4 1
A isNotNull() 0 4 1
A setTable() 0 4 1
A getTable() 0 4 1
getType() 0 1 ?
A setDescription() 0 4 1
A getDescription() 0 4 1
1
<?php
2
3
namespace Rentgen\Database;
4
5
abstract class Column implements DatabaseObjectInterface
6
{
7
    protected $name;
8
    protected $description;
9
    protected $isNotNull = false;
10
    protected $default;
11
12
    /**
13
     * Constructor.
14
     *
15
     * @param string $name    Column name.
16
     * @param array  $options Optional options.
17
     */
18
    public function __construct($name, array $options = array())
19
    {
20
        $this->name = $name;
21
22
        if (array_key_exists('not_null', $options)) {
23
            $this->isNotNull = $options['not_null'];
24
        }
25
        if (array_key_exists('default', $options)) {
26
            $this->default = $options['default'];
27
        }
28
    }
29
30
    /**
31
     * Get column name.
32
     *
33
     * @return string Column name.
34
     */
35
    public function getName()
36
    {
37
        return $this->name;
38
    }
39
40
    /**
41
     * Get default value of column.
42
     *
43
     * @return mixed Default value of column.
44
     */
45
    public function getDefault()
46
    {
47
        return $this->default;
48
    }
49
50
    /**
51
     * Check if column not allows null value.
52
     *
53
     * @return boolean Column not allows null value.
54
     */
55
    public function isNotNull()
56
    {
57
        return $this->isNotNull;
58
    }
59
60
    /**
61
     * Set the table instance.
62
     *
63
     * @param Table $table Table instance.
64
     *
65
     * @return void
66
     */
67
    public function setTable(Table $table)
68
    {
69
        $this->table = $table;
0 ignored issues
show
Bug introduced by
The property table does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
70
    }
71
72
    /**
73
     * Get the table instance.
74
     *
75
     * @return Table
76
     */
77
    public function getTable()
78
    {
79
        return $this->table;
80
    }
81
82
    /**
83
     * Get column type name.
84
     *
85
     * @return string Column type name.
86
     */
87
    abstract public function getType();
88
89
    /**
90
     * Set column description.
91
     *
92
     * @param string $description Table description.
93
     */
94
    public function setDescription($description)
95
    {
96
        $this->description = $description;
97
    }
98
99
    /**
100
     * Get column description.
101
     *
102
     * @return string
103
     */
104
    public function getDescription()
105
    {
106
        return $this->description;
107
    }
108
}
109