Passed
Push — master ( 042e95...d37488 )
by Chris
02:46
created

AbstractBuilderField::defineMustAwait()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace WebTheory\Saveyour\Controllers;
4
5
use WebTheory\Saveyour\Contracts\DataTransformerInterface;
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 BaseFormFieldController(
89
            $this->defineRequestVar(),
90
            $this->defineFormField(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineFormField() targeting WebTheory\Saveyour\Contr...ield::defineFormField() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
91
            $this->defineDataManager(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineDataManager() targeting WebTheory\Saveyour\Contr...ld::defineDataManager() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
92
            $this->defineDataTransformer(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineDataTransformer() targeting WebTheory\Saveyour\Contr...defineDataTransformer() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
93
            $this->defineFilters(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineFilters() targeting WebTheory\Saveyour\Contr...rField::defineFilters() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
94
            $this->defineRules(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineRules() targeting WebTheory\Saveyour\Contr...derField::defineRules() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
95
            $this->defineEscaper(),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->defineEscaper() targeting WebTheory\Saveyour\Contr...rField::defineEscaper() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
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 defineDataTransformer(): ?DataTransformerInterface
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