1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WebTheory\Saveyour\Controllers; |
4
|
|
|
|
5
|
|
|
use WebTheory\Saveyour\Contracts\DataFormatterInterface; |
6
|
|
|
use WebTheory\Saveyour\Contracts\FieldDataManagerInterface; |
7
|
|
|
use WebTheory\Saveyour\Contracts\FormFieldControllerInterface; |
8
|
|
|
use WebTheory\Saveyour\Contracts\FormFieldInterface; |
9
|
|
|
|
10
|
|
|
abstract class AbstractBuilderField |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var string |
14
|
|
|
*/ |
15
|
|
|
protected $requestVar; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var bool |
19
|
|
|
*/ |
20
|
|
|
protected $processingDisabled = false; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
protected $mustAwait = []; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* |
29
|
|
|
*/ |
30
|
|
|
public function __construct(string $requestVar) |
31
|
|
|
{ |
32
|
|
|
$this->requestVar = $requestVar; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Get the value of processingDisabled |
37
|
|
|
* |
38
|
|
|
* @return bool |
39
|
|
|
*/ |
40
|
|
|
public function getProcessingDisabled(): bool |
41
|
|
|
{ |
42
|
|
|
return $this->processingDisabled; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Set the value of processingDisabled |
47
|
|
|
* |
48
|
|
|
* @param bool $processingDisabled |
49
|
|
|
* |
50
|
|
|
* @return self |
51
|
|
|
*/ |
52
|
|
|
public function setProcessingDisabled(bool $processingDisabled) |
53
|
|
|
{ |
54
|
|
|
$this->processingDisabled = $processingDisabled; |
55
|
|
|
|
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get the value of mustAwait |
61
|
|
|
* |
62
|
|
|
* @return array |
63
|
|
|
*/ |
64
|
|
|
public function getMustAwait(): array |
65
|
|
|
{ |
66
|
|
|
return $this->mustAwait; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Set the value of mustAwait |
71
|
|
|
* |
72
|
|
|
* @param array $mustAwait |
73
|
|
|
* |
74
|
|
|
* @return self |
75
|
|
|
*/ |
76
|
|
|
public function setMustAwait(array $mustAwait) |
77
|
|
|
{ |
78
|
|
|
$this->mustAwait = $mustAwait; |
79
|
|
|
|
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* |
85
|
|
|
*/ |
86
|
|
|
public function init(): FormFieldControllerInterface |
87
|
|
|
{ |
88
|
|
|
return new FormFieldController( |
89
|
|
|
$this->defineRequestVar(), |
90
|
|
|
$this->defineFormField(), |
|
|
|
|
91
|
|
|
$this->defineDataManager(), |
|
|
|
|
92
|
|
|
$this->defineDataFormatter(), |
|
|
|
|
93
|
|
|
$this->defineFilters(), |
|
|
|
|
94
|
|
|
$this->defineRules(), |
|
|
|
|
95
|
|
|
$this->defineEscaper(), |
|
|
|
|
96
|
|
|
$this->defineProcessingDisabled(), |
97
|
|
|
$this->defineMustAwait() |
98
|
|
|
); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* |
103
|
|
|
*/ |
104
|
|
|
protected function defineRequestVar(): string |
105
|
|
|
{ |
106
|
|
|
return $this->requestVar; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* |
111
|
|
|
*/ |
112
|
|
|
protected function defineFormField(): ?FormFieldInterface |
113
|
|
|
{ |
114
|
|
|
return null; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* |
119
|
|
|
*/ |
120
|
|
|
protected function defineDataManager(): ?FieldDataManagerInterface |
121
|
|
|
{ |
122
|
|
|
return null; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* |
127
|
|
|
*/ |
128
|
|
|
protected function defineDataFormatter(): ?DataFormatterInterface |
129
|
|
|
{ |
130
|
|
|
return null; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* |
135
|
|
|
*/ |
136
|
|
|
protected function defineFilters(): ?array |
137
|
|
|
{ |
138
|
|
|
return null; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* |
143
|
|
|
*/ |
144
|
|
|
protected function defineRules(): ?array |
145
|
|
|
{ |
146
|
|
|
return null; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* |
151
|
|
|
*/ |
152
|
|
|
protected function defineEscaper(): ?callable |
153
|
|
|
{ |
154
|
|
|
return null; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* |
159
|
|
|
*/ |
160
|
|
|
protected function defineProcessingDisabled(): ?bool |
161
|
|
|
{ |
162
|
|
|
return $this->processingDisabled; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* |
167
|
|
|
*/ |
168
|
|
|
protected function defineMustAwait(): ?array |
169
|
|
|
{ |
170
|
|
|
return $this->mustAwait; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.