1 | <?php |
||
2 | App::uses('VatNumberChecksAppController', 'VatNumberCheck.Controller'); |
||
3 | |||
4 | /** |
||
5 | * VatNumberChecks Controller |
||
6 | * |
||
7 | * @property VatNumberCheck.VatNumberCheck $VatNumberCheck |
||
8 | */ |
||
9 | class VatNumberChecksController extends VatNumberChecksAppController { |
||
10 | |||
11 | /** |
||
12 | * Constructor |
||
13 | * |
||
14 | * @param CakeRequest $request Request instance. |
||
0 ignored issues
–
show
|
|||
15 | * @param CakeResponse $response Response instance. |
||
0 ignored issues
–
show
The type
CakeResponse 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 ![]() |
|||
16 | */ |
||
17 | public function __construct($request = null, $response = null) { |
||
18 | parent::__construct($request, $response); |
||
19 | $this->constructClasses(); |
||
20 | if (!$this->Components->attached('RequestHandler') |
||
21 | ) { |
||
22 | $this->RequestHandler = $this->Components->load('RequestHandler'); |
||
0 ignored issues
–
show
|
|||
23 | } |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Called before the controller action. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function beforeFilter() { |
||
32 | parent::beforeFilter(); |
||
33 | |||
34 | if (in_array($this->request->action, ['check'], true)) { |
||
35 | // Disable Security component checks |
||
36 | if ($this->Components->enabled('Security')) { |
||
37 | $this->Components->disable('Security'); |
||
38 | } |
||
39 | |||
40 | // Allow action without authentication |
||
41 | if ($this->Components->enabled('Auth')) { |
||
42 | $this->Auth->allow($this->request->action); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Checks a given vat number (from POST data). |
||
49 | * |
||
50 | * @return void |
||
51 | */ |
||
52 | public function check() { |
||
53 | $vatNumber = $this->request->data('vatNumber'); |
||
54 | $vatNumber = $this->VatNumberCheck->normalize($vatNumber); |
||
55 | |||
56 | $jsonData = array_merge(compact('vatNumber'), ['status' => 'failure']); |
||
57 | try { |
||
58 | $vatNumberValid = $this->VatNumberCheck->check($vatNumber); |
||
59 | if ($vatNumberValid) { |
||
60 | $jsonData = array_merge(compact('vatNumber'), ['status' => 'ok']); |
||
61 | } |
||
62 | } catch (InternalErrorException $e) { |
||
63 | $this->response->statusCode(503); |
||
64 | } |
||
65 | |||
66 | $this->set(compact('jsonData')); |
||
67 | $this->set('_serialize', 'jsonData'); |
||
68 | } |
||
69 | |||
70 | } |
||
71 |
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