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
Push — master ( 2437e1...f65359 )
by Marceau
02:19
created

FieldHasUiModifiers::isDisplayedInColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Akibatech\Crud\Traits;
4
5
/**
6
 * Class FieldHasUiModifiers
7
 *
8
 * @package Akibatech\Crud\Traits
9
 */
10
trait FieldHasUiModifiers
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $label;
16
17
    /**
18
     * @var string
19
     */
20
    protected $placeholder;
21
22
    /**
23
     * @var string
24
     */
25
    protected $help;
26
27
    /**
28
     * Displayed or not the field in the columns.
29
     *
30
     * @var bool
31
     */
32
    protected $columnize = true;
33
34
    /**
35
     * Set a custom label for the field.
36
     *
37
     * @param   string $name
38
     * @return  self
39
     */
40
    public function withLabel($name)
41
    {
42
        $this->label = $name;
43
44
        return $this;
45
    }
46
47
    /**
48
     * Defines a placeholder for the field.
49
     *
50
     * @param   string $placeholder
51
     * @return  self
52
     */
53
    public function withPlaceholder($placeholder)
54
    {
55
        $this->placeholder = $placeholder;
56
57
        return $this;
58
    }
59
60
    /**
61
     * Appends an help message to the input.
62
     *
63
     * @param   string $help
64
     * @return  self
65
     */
66
    public function withHelp($help)
67
    {
68
        $this->help = $help;
69
70
        return $this;
71
    }
72
73
    /**
74
     * Returns the field's label.
75
     *
76
     * @param   void
77
     * @return  string
78
     */
79
    public function getLabel()
80
    {
81
        if (empty($this->label))
82
        {
83
            return title_case($this->identifier);
0 ignored issues
show
Bug introduced by
The property identifier 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...
84
        }
85
86
        return $this->label;
87
    }
88
89
    /**
90
     * Returns the field's placeholder.
91
     *
92
     * @param   void
93
     * @return  string
94
     */
95
    public function getPlaceholder()
96
    {
97
        if (empty($this->placeholder))
98
        {
99
            return null;
100
        }
101
102
        return $this->placeholder;
103
    }
104
105
    /**
106
     * Returns the field's help.
107
     *
108
     * @param   void
109
     * @return  string
110
     */
111
    public function getHelp()
112
    {
113
        if (empty($this->help))
114
        {
115
            return null;
116
        }
117
118
        return $this->help;
119
    }
120
121
    /**
122
     * @param   bool $state
123
     * @return  self
124
     */
125
    public function displayInColumns($state = true)
126
    {
127
        $this->columnize = $state;
128
129
        return $this;
130
    }
131
132
    /**
133
     * @param   void
134
     * @return  bool
135
     */
136
    public function isDisplayedInColumns()
137
    {
138
        return $this->columnize === true;
139
    }
140
141
    /**
142
     * Return fields specific scripts files from public folder.
143
     * Example: ['js/field.js']
144
     *
145
     * @param   void
146
     * @return  array
147
     */
148
    public function getScripts()
149
    {
150
        return [];
151
    }
152
153
    /**
154
     * Return fields specific stylesheets files from public folder.
155
     * Example: ['css/field.css']
156
     *
157
     * @param   void
158
     * @return  array
159
     */
160
    public function getCss()
161
    {
162
        return [];
163
    }
164
}
165