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 ( 659162...ca95e4 )
by Marceau
01:57
created

FieldHasUiModifiers::withHelp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
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
     * Set a custom label for the field.
29
     *
30
     * @param   string $name
31
     * @return  self
32
     */
33
    public function withLabel($name)
34
    {
35
        $this->label = $name;
36
37
        return $this;
38
    }
39
40
    /**
41
     * Defines a placeholder for the field.
42
     *
43
     * @param   string $placeholder
44
     * @return  self
45
     */
46
    public function withPlaceholder($placeholder)
47
    {
48
        $this->placeholder = $placeholder;
49
50
        return $this;
51
    }
52
53
    /**
54
     * Appends an help message to the input.
55
     *
56
     * @param   string $help
57
     * @return  self
58
     */
59
    public function withHelp($help)
60
    {
61
        $this->help = $help;
62
63
        return $this;
64
    }
65
66
    /**
67
     * Returns the field's label.
68
     *
69
     * @param   void
70
     * @return  string
71
     */
72
    public function getLabel()
73
    {
74
        if (empty($this->label))
75
        {
76
            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...
77
        }
78
79
        return $this->label;
80
    }
81
82
    /**
83
     * Returns the field's placeholder.
84
     *
85
     * @param   void
86
     * @return  string
87
     */
88
    public function getPlaceholder()
89
    {
90
        if (empty($this->placeholder))
91
        {
92
            return null;
93
        }
94
95
        return $this->placeholder;
96
    }
97
98
    /**
99
     * Returns the field's help.
100
     *
101
     * @param   void
102
     * @return  string
103
     */
104
    public function getHelp()
105
    {
106
        if (empty($this->help))
107
        {
108
            return null;
109
        }
110
111
        return $this->help;
112
    }
113
114
    /**
115
     * Return fields specific scripts files from public folder.
116
     * Example: ['js/field.js']
117
     *
118
     * @param   void
119
     * @return  array
120
     */
121
    public function getScripts()
122
    {
123
        return [];
124
    }
125
126
    /**
127
     * Return fields specific stylesheets files from public folder.
128
     * Example: ['css/field.css']
129
     *
130
     * @param   void
131
     * @return  array
132
     */
133
    public function getCss()
134
    {
135
        return [];
136
    }
137
}
138