1 | <?php |
||||
2 | |||||
3 | namespace Jobtech\LaravelChunky\Http\Requests; |
||||
4 | |||||
5 | use Illuminate\Foundation\Http\FormRequest; |
||||
0 ignored issues
–
show
|
|||||
6 | use Illuminate\Http\UploadedFile; |
||||
0 ignored issues
–
show
The type
Illuminate\Http\UploadedFile was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
7 | use Illuminate\Support\Arr; |
||||
8 | use Jobtech\LaravelChunky\Exceptions\ChunkyException; |
||||
9 | |||||
10 | class AddChunkRequest extends FormRequest |
||||
11 | { |
||||
12 | /** |
||||
13 | * Retrieve index rules. |
||||
14 | * |
||||
15 | * @return array |
||||
16 | */ |
||||
17 | public function indexRules(): array |
||||
18 | { |
||||
19 | $key = config('chunky.validation.index.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
20 | $rules = array_unique( |
||||
21 | array_merge([ |
||||
22 | 'required', 'integer', 'min:0', |
||||
23 | ], config('chunky.validation.index.rules', [])) |
||||
24 | ); |
||||
25 | |||||
26 | if (empty($key)) { |
||||
27 | throw new ChunkyException('Index key cannot be null'); |
||||
28 | } |
||||
29 | |||||
30 | return [ |
||||
31 | $key => $rules, |
||||
32 | ]; |
||||
33 | } |
||||
34 | |||||
35 | /** |
||||
36 | * Retrieve file rules. |
||||
37 | * |
||||
38 | * @return array |
||||
39 | */ |
||||
40 | public function fileRules(): array |
||||
41 | { |
||||
42 | $key = config('chunky.validation.file.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
43 | $rules = array_unique( |
||||
44 | array_merge([ |
||||
45 | 'required', 'file', |
||||
46 | ], config('chunky.validation.file.rules', [])) |
||||
47 | ); |
||||
48 | |||||
49 | if (empty($key)) { |
||||
50 | throw new ChunkyException('File key cannot be null'); |
||||
51 | } |
||||
52 | |||||
53 | return [ |
||||
54 | $key => $rules, |
||||
55 | ]; |
||||
56 | } |
||||
57 | |||||
58 | /** |
||||
59 | * Retrieve chunk file size rules. |
||||
60 | * |
||||
61 | * @return array |
||||
62 | */ |
||||
63 | public function chunkSizeRules(): array |
||||
64 | { |
||||
65 | $key = config('chunky.validation.chunkSize.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
66 | $rules = array_unique( |
||||
67 | array_merge([ |
||||
68 | 'required', 'integer', 'min:1', |
||||
69 | ], config('chunky.validation.chunkSize.rules', [])) |
||||
70 | ); |
||||
71 | |||||
72 | if (empty($key)) { |
||||
73 | throw new ChunkyException('Chunk file size key cannot be null'); |
||||
74 | } |
||||
75 | |||||
76 | return [ |
||||
77 | $key => $rules, |
||||
78 | ]; |
||||
79 | } |
||||
80 | |||||
81 | /** |
||||
82 | * Retrieve total file size rules. |
||||
83 | * |
||||
84 | * @return array |
||||
85 | */ |
||||
86 | public function totalSizeRules(): array |
||||
87 | { |
||||
88 | $key = config('chunky.validation.totalSize.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
89 | $rules = array_unique( |
||||
90 | array_merge([ |
||||
91 | 'required', 'integer', 'min:1', |
||||
92 | ], config('chunky.validation.totalSize.rules', [])) |
||||
93 | ); |
||||
94 | |||||
95 | if (empty($key)) { |
||||
96 | throw new ChunkyException('Total file size key cannot be null'); |
||||
97 | } |
||||
98 | |||||
99 | return [ |
||||
100 | $key => $rules, |
||||
101 | ]; |
||||
102 | } |
||||
103 | |||||
104 | public function additionalRules(): array |
||||
105 | { |
||||
106 | $rules = []; |
||||
107 | |||||
108 | foreach (config('chunky.validation') as $input => $config) { |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
109 | if ( |
||||
110 | ! in_array($input, ['index', 'file', 'chunkSize', 'totalSize']) |
||||
111 | && Arr::has($config, 'key') |
||||
112 | && Arr::has($config, 'rules') |
||||
113 | ) { |
||||
114 | $rules[$config['key']] = Arr::get($config, 'rules', []); |
||||
115 | } |
||||
116 | } |
||||
117 | |||||
118 | return $rules; |
||||
119 | } |
||||
120 | |||||
121 | /** |
||||
122 | * Retrieve index input. |
||||
123 | * |
||||
124 | * @return int |
||||
125 | */ |
||||
126 | public function indexInput(): int |
||||
127 | { |
||||
128 | $key = config('chunky.validation.index.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
129 | |||||
130 | if (empty($key)) { |
||||
131 | throw new ChunkyException('Index key cannot be null'); |
||||
132 | } |
||||
133 | |||||
134 | return $this->input($key); |
||||
135 | } |
||||
136 | |||||
137 | /** |
||||
138 | * Retrieve file input. |
||||
139 | * |
||||
140 | * @return \Illuminate\Http\UploadedFile |
||||
141 | */ |
||||
142 | public function fileInput(): UploadedFile |
||||
143 | { |
||||
144 | $key = config('chunky.validation.file.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
145 | |||||
146 | if (empty($key)) { |
||||
147 | throw new ChunkyException('File key cannot be null'); |
||||
148 | } |
||||
149 | |||||
150 | return $this->file($key); |
||||
151 | } |
||||
152 | |||||
153 | /** |
||||
154 | * Retrieve chunk file size input. |
||||
155 | * |
||||
156 | * @return int |
||||
157 | */ |
||||
158 | public function chunkSizeInput(): int |
||||
159 | { |
||||
160 | $key = config('chunky.validation.chunkSize.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
161 | |||||
162 | if (empty($key)) { |
||||
163 | throw new ChunkyException('Chunk file size key cannot be null'); |
||||
164 | } |
||||
165 | |||||
166 | return $this->input($key); |
||||
167 | } |
||||
168 | |||||
169 | /** |
||||
170 | * Retrieve total file size input. |
||||
171 | * |
||||
172 | * @return int |
||||
173 | */ |
||||
174 | public function totalSizeInput(): int |
||||
175 | { |
||||
176 | $key = config('chunky.validation.totalSize.key'); |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
177 | |||||
178 | if (empty($key)) { |
||||
179 | throw new ChunkyException('Total file size key cannot be null'); |
||||
180 | } |
||||
181 | |||||
182 | return $this->input($key); |
||||
183 | } |
||||
184 | |||||
185 | /** |
||||
186 | * Get the validation rules that apply to the request. |
||||
187 | * |
||||
188 | * @return array |
||||
189 | */ |
||||
190 | public function rules() |
||||
191 | { |
||||
192 | return array_merge( |
||||
193 | $this->additionalRules(), |
||||
194 | $this->indexRules(), |
||||
195 | $this->fileRules(), |
||||
196 | $this->chunkSizeRules(), |
||||
197 | $this->totalSizeRules() |
||||
198 | ); |
||||
199 | } |
||||
200 | } |
||||
201 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths