| Total Complexity | 102 |
| Total Lines | 747 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like BaseController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BaseController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 24 | abstract class BaseController extends Controller |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * to use this class |
||
| 28 | * create message list as messages in message file |
||
| 29 | * override __constructor and define your model |
||
| 30 | * define your rules for index,store and update |
||
| 31 | */ |
||
| 32 | |||
| 33 | /** |
||
| 34 | * permission types 'admin'|'branch'|'own'|'guest' |
||
| 35 | * |
||
| 36 | * @var string |
||
| 37 | */ |
||
| 38 | protected $DEFAULT_PERMISSION_TYPE = 'admin'; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * permission types 'admin'|'branch'|'own'|'guest' |
||
| 42 | * |
||
| 43 | * @var string |
||
| 44 | */ |
||
| 45 | protected $DEFAULT_GROUP_TITLE = null; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var string |
||
| 49 | */ |
||
| 50 | protected $LOCALE_PREFIX = 'controller'; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @var int |
||
| 54 | */ |
||
| 55 | protected $DEFAULT_RESULT_PER_PAGE = 15; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @var int |
||
| 59 | */ |
||
| 60 | protected $DEFAULT_PAGE_NUMBER = 1; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @var array |
||
| 64 | */ |
||
| 65 | protected $pivotFields = []; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @var array |
||
| 69 | */ |
||
| 70 | protected $uniqueFields = []; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @var bool|string |
||
| 74 | */ |
||
| 75 | protected $modelName; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var string |
||
| 79 | */ |
||
| 80 | protected $messagePrefix = 'messages.api.v1.'; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * this model |
||
| 84 | */ |
||
| 85 | protected $model; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * index request validator rules |
||
| 89 | * |
||
| 90 | * @var array |
||
| 91 | */ |
||
| 92 | protected $indexValidateArray = [ |
||
| 93 | // |
||
| 94 | ]; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * array of relationship for eager loading |
||
| 98 | * |
||
| 99 | * @var array |
||
| 100 | */ |
||
| 101 | protected $indexLoad = [ |
||
| 102 | // |
||
| 103 | ]; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * array of relationship for eager loading |
||
| 107 | * |
||
| 108 | * @var array |
||
| 109 | */ |
||
| 110 | protected $editLoad = [ |
||
| 111 | // |
||
| 112 | ]; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * array of relationship for eager loading |
||
| 116 | * |
||
| 117 | * @var array |
||
| 118 | */ |
||
| 119 | protected $updateLoad = [ |
||
| 120 | // |
||
| 121 | ]; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * array of relationship for eager loading |
||
| 125 | * |
||
| 126 | * @var array |
||
| 127 | */ |
||
| 128 | protected $storeLoad = [ |
||
| 129 | // |
||
| 130 | ]; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * store request validator rules |
||
| 134 | * |
||
| 135 | * @var array |
||
| 136 | */ |
||
| 137 | protected $storeValidateArray = [ |
||
| 138 | // |
||
| 139 | ]; |
||
| 140 | |||
| 141 | /** |
||
| 142 | * update request validator rules |
||
| 143 | * |
||
| 144 | * @var array |
||
| 145 | */ |
||
| 146 | protected $updateValidateArray = [ |
||
| 147 | // |
||
| 148 | ]; |
||
| 149 | |||
| 150 | protected $middlewareParams = []; |
||
| 151 | |||
| 152 | /** |
||
| 153 | * defaultController constructor. |
||
| 154 | */ |
||
| 155 | public function __construct() |
||
| 156 | { |
||
| 157 | // dd("I have closest relationship with all US & UK celebrities"); |
||
| 158 | // init controller |
||
| 159 | $this->initController(); |
||
| 160 | |||
| 161 | // set local language |
||
| 162 | $this->setLocale(); |
||
| 163 | } |
||
| 164 | |||
| 165 | abstract public function initController(); |
||
| 166 | |||
| 167 | /** |
||
| 168 | * Display a listing of the resource. |
||
| 169 | * |
||
| 170 | * @param Request $request |
||
| 171 | * @return string |
||
| 172 | */ |
||
| 173 | public function index(Request $request) |
||
| 269 | } |
||
| 270 | } |
||
| 271 | |||
| 272 | public function checkRequestValidation(Request $request, $validationArray) |
||
| 273 | { |
||
| 274 | $requestParams = $request->toArray(); |
||
| 275 | $validator = Validator::make($request->all(), $validationArray); |
||
| 276 | if ($validator->fails()) { |
||
| 277 | return $validator->errors(); |
||
| 278 | } |
||
| 279 | return null; |
||
| 280 | } |
||
| 281 | |||
| 282 | /** |
||
| 283 | * @param $status |
||
| 284 | * @return mixed |
||
| 285 | */ |
||
| 286 | public function message($status) |
||
| 287 | { |
||
| 288 | $key = $this->messagePrefix . $this->modelName . '.' . debug_backtrace()[1]['function'] . '.' . $status; |
||
| 289 | return $this->getMessageFromFile($key); |
||
| 290 | } |
||
| 291 | |||
| 292 | /** |
||
| 293 | * @param $key |
||
| 294 | * @return mixed |
||
| 295 | */ |
||
| 296 | public function getMessageFromFile($key) |
||
| 297 | { |
||
| 298 | return config($key); |
||
| 299 | } |
||
| 300 | |||
| 301 | /** |
||
| 302 | * Show the form for creating a new resource. |
||
| 303 | * |
||
| 304 | * @return \Illuminate\Http\JsonResponse |
||
| 305 | */ |
||
| 306 | public function create() |
||
| 315 | } |
||
| 316 | |||
| 317 | /** |
||
| 318 | * Store a newly created resource in storage. |
||
| 319 | * |
||
| 320 | * @param \Illuminate\Http\Request $request |
||
| 321 | * @return \Illuminate\Http\JsonResponse |
||
| 322 | */ |
||
| 323 | public function store(Request $request) |
||
| 324 | { |
||
| 325 | // handle permission |
||
| 326 | $request = $this->handlePermission(__FUNCTION__, $request); |
||
| 327 | |||
| 328 | // Create Response Model |
||
| 329 | $response = new ResponseModel(); |
||
| 330 | |||
| 331 | if (!isset($userId)) { |
||
| 332 | $userId = 1; |
||
| 333 | } |
||
| 334 | |||
| 335 | //add author id into the request if doesn't exist |
||
| 336 | if (is_null($request->get('author_id'))) { |
||
| 337 | $request['author_id'] = $userId; |
||
| 338 | } |
||
| 339 | |||
| 340 | //add user id into the request if doesn't exist |
||
| 341 | if (is_null($request->get('user_id'))) { |
||
| 342 | $request['user_id'] = $userId; |
||
| 343 | } |
||
| 344 | |||
| 345 | $validationErrors = $this->checkRequestValidation($request, $this->storeValidateArray); |
||
| 346 | |||
| 347 | if ($validationErrors != null) { |
||
| 348 | if (env('APP_DEBUG', false)) { |
||
| 349 | $response->setData(collect($validationErrors->toArray())); |
||
| 350 | } |
||
| 351 | $response->setMessage($this->getTrans(__FUNCTION__, 'validation_failed')); |
||
| 352 | $response->setStatus(false); |
||
| 353 | $response->setError(99); |
||
| 354 | return SmartResponse::response($response); |
||
| 355 | |||
| 356 | } |
||
| 357 | |||
| 358 | try { |
||
| 359 | // get result of model creation |
||
| 360 | $result = $this->model->create($request->all()); |
||
| 361 | // sync many to many relation |
||
| 362 | foreach ($this->pivotFields as $pivotField) { |
||
| 363 | if (collect($request[$pivotField])->count()) { |
||
| 364 | $pivotField = (new StringHelper())->toCamel($pivotField); |
||
| 365 | $this->model->find($result['id'])->$pivotField()->sync(json_decode($request[$pivotField])); |
||
| 366 | } |
||
| 367 | } |
||
| 368 | $response->setMessage($this->getTrans('store', 'successful')); |
||
| 369 | |||
| 370 | |||
| 371 | $response->setData($this->model |
||
| 372 | ->where($this->model->getKeyName(), $result['id']) |
||
| 373 | ->with(collect($this->updateLoad)->count() == 0 ? $this->indexLoad : $this->updateLoad) |
||
| 374 | ->get()); |
||
| 375 | |||
| 376 | $response->setStatus(true); |
||
| 377 | } catch (QueryException $exception) { |
||
| 378 | $response->setError($exception->getCode()); |
||
| 379 | $response->setMessage($this->getTrans('store', 'failed')); |
||
| 380 | $response->setStatus(false); |
||
| 381 | if (env('APP_DEBUG', false)) { |
||
| 382 | $response->setData(collect($exception->getMessage())); |
||
| 383 | } |
||
| 384 | } |
||
| 385 | return SmartResponse::response($response); |
||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Display the specdefaultied resource. |
||
| 390 | * |
||
| 391 | * @param int $id |
||
| 392 | * @return \Illuminate\Http\JsonResponse |
||
| 393 | */ |
||
| 394 | public function show($id) |
||
| 395 | { |
||
| 396 | // handle permission |
||
| 397 | $filters = $this->handlePermission(__FUNCTION__); |
||
| 398 | |||
| 399 | // Create Response Model |
||
| 400 | $response = new ResponseModel(); |
||
| 401 | |||
| 402 | // try to get data |
||
| 403 | try { |
||
| 404 | $response->setMessage($this->getTrans('show', 'successful')); |
||
| 405 | |||
| 406 | // add filter to get desired record |
||
| 407 | array_push($filters, |
||
| 408 | [$this->model->getKeyName(), '=', $id] |
||
| 409 | ); |
||
| 410 | $data = $this->model |
||
| 411 | ->where($filters) |
||
| 412 | ->get(); |
||
| 413 | $response->setData($data); |
||
| 414 | |||
| 415 | // catch exception |
||
| 416 | } catch (Exception $exception) { |
||
| 417 | $response->setError($exception->getCode()); |
||
| 418 | $response->setMessage($this->getTrans('show', 'failed')); |
||
| 419 | $response->setStatus(false); |
||
| 420 | if (env('APP_DEBUG', false)) { |
||
| 421 | $response->setData(collect($exception->getMessage())); |
||
| 422 | } |
||
| 423 | } |
||
| 424 | return SmartResponse::response($response); |
||
| 425 | } |
||
| 426 | |||
| 427 | /** |
||
| 428 | * Show the form for editing the specified resource. |
||
| 429 | * |
||
| 430 | * @param int $id |
||
| 431 | * @return \Illuminate\Http\JsonResponse |
||
| 432 | */ |
||
| 433 | public function edit($id) |
||
| 434 | { |
||
| 435 | // handle permission |
||
| 436 | $filters = $this->handlePermission(__FUNCTION__); |
||
| 437 | |||
| 438 | // Create Response Model |
||
| 439 | $response = new ResponseModel(); |
||
| 440 | |||
| 441 | try { |
||
| 442 | $response->setMessage($this->getTrans('edit', 'successful')); |
||
| 443 | |||
| 444 | // add filter to get desired record |
||
| 445 | array_push($filters, |
||
| 446 | [$this->model->getKeyName(), '=', $id] |
||
| 447 | ); |
||
| 448 | $data = $this->model |
||
| 449 | ->where($filters) |
||
| 450 | ->with(collect($this->editLoad)->count() == 0 ? $this->indexLoad : $this->editLoad) |
||
| 451 | ->get(); |
||
| 452 | $response->setData($data); |
||
| 453 | |||
| 454 | } catch (ModelNotFoundException $exception) { |
||
| 455 | $response->setError($exception->getCode()); |
||
| 456 | $response->setMessage($this->getTrans('edit', 'failed')); |
||
| 457 | $response->setStatus(false); |
||
| 458 | if (env('APP_DEBUG', false)) { |
||
| 459 | $response->setData(collect($exception->getMessage())); |
||
| 460 | } |
||
| 461 | |||
| 462 | } |
||
| 463 | |||
| 464 | return SmartResponse::response($response); |
||
| 465 | } |
||
| 466 | |||
| 467 | /** |
||
| 468 | * Update the specified resource in storage. |
||
| 469 | * |
||
| 470 | * @param \Illuminate\Http\Request $request |
||
| 471 | * @param int $id |
||
| 472 | * @return \Illuminate\Http\JsonResponse |
||
| 473 | */ |
||
| 474 | public function update(Request $request, $id) |
||
| 475 | { |
||
| 476 | // Handle permission |
||
| 477 | $request = $this->handlePermission(__FUNCTION__,$request); |
||
| 478 | $filters = $request['permission_filters']; |
||
| 479 | |||
| 480 | // Create Response Model |
||
| 481 | $response = new ResponseModel(); |
||
| 482 | |||
| 483 | // Filters |
||
| 484 | array_push($filters, |
||
| 485 | [$this->model->getKeyName(), '=', $id] |
||
| 486 | ); |
||
| 487 | |||
| 488 | $validationErrors = $this->checkRequestValidation($request, $this->updateValidateArray); |
||
| 489 | if ($validationErrors != null) { |
||
| 490 | if (env('APP_DEBUG', false)) { |
||
| 491 | $response->setData(collect($validationErrors->toArray())); |
||
| 492 | } |
||
| 493 | $response->setMessage($this->getTrans(__FUNCTION__, 'validation_failed')); |
||
| 494 | $response->setStatus(false); |
||
| 495 | $response->setError(99); |
||
| 496 | return SmartResponse::response($response); |
||
| 497 | |||
| 498 | } |
||
| 499 | |||
| 500 | try { |
||
| 501 | // sync many to many relation |
||
| 502 | foreach ($this->pivotFields as $pivotField) { |
||
| 503 | if (collect($request[$pivotField])->count()) { |
||
| 504 | $pivotMethod = (new StringHelper())->toCamel($pivotField); |
||
| 505 | $this->model->findOrFail($id)->$pivotMethod()->sync(json_decode($request[$pivotField], true)); |
||
| 506 | } |
||
| 507 | } |
||
| 508 | //get result of update |
||
| 509 | $result = $this->model->where($filters)->firstOrFail()->update($request->all()); |
||
| 510 | |||
| 511 | // return response |
||
| 512 | $response->setData($this->model |
||
| 513 | ->where($filters) |
||
| 514 | ->with(collect($this->updateLoad)->count() == 0 ? $this->indexLoad : $this->updateLoad) |
||
| 515 | ->get()); |
||
| 516 | $response->setMessage( |
||
| 517 | $this->getTrans(__FUNCTION__, 'successful1') . |
||
| 518 | $result . |
||
| 519 | $this->getTrans(__FUNCTION__, 'successful2') |
||
| 520 | ); |
||
| 521 | |||
| 522 | } catch (ModelNotFoundException $exception) { |
||
| 523 | $response->setStatus(false); |
||
| 524 | $response->setMessage($this->getTrans(__FUNCTION__, 'model_not_found')); |
||
| 525 | $response->setError($exception->getCode()); |
||
| 526 | if (env('APP_DEBUG', false)) { |
||
| 527 | $response->setData(collect($exception->getMessage())); |
||
| 528 | } |
||
| 529 | |||
| 530 | } catch (QueryException $exception) { |
||
| 531 | $response->setStatus(false); |
||
| 532 | $response->setMessage($this->getTrans(__FUNCTION__, 'failed')); |
||
| 533 | $response->setError($exception->getCode()); |
||
| 534 | if (env('APP_DEBUG', false)) { |
||
| 535 | $response->setData(collect($exception->getMessage())); |
||
| 536 | } |
||
| 537 | |||
| 538 | } |
||
| 539 | |||
| 540 | return SmartResponse::response($response); |
||
| 541 | } |
||
| 542 | |||
| 543 | /** |
||
| 544 | * Remove the specified resource from storage. |
||
| 545 | * |
||
| 546 | * @param int $id |
||
| 547 | * @return \Illuminate\Http\JsonResponse |
||
| 548 | */ |
||
| 549 | public function destroy($id) |
||
| 569 | } |
||
| 570 | |||
| 571 | /** |
||
| 572 | * @param $method |
||
| 573 | * @param $status |
||
| 574 | * @return array|\Illuminate\Contracts\Translation\Translator|null|string |
||
| 575 | */ |
||
| 576 | public function getTrans($method, $status) |
||
| 577 | { |
||
| 578 | return trans('laravel_smart_restful::' . $this->LOCALE_PREFIX . '.' . get_class($this->model) . '.' . $method . '.' . $status); |
||
| 579 | } |
||
| 580 | |||
| 581 | /** |
||
| 582 | * set local |
||
| 583 | */ |
||
| 584 | public function setLocale() |
||
| 585 | { |
||
| 586 | if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
||
| 587 | app('translator')->setLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']); |
||
| 588 | } |
||
| 589 | } |
||
| 590 | |||
| 591 | public function handlePermission($functionName, Request $request = null, $params = []) |
||
| 609 | } |
||
| 610 | } |
||
| 611 | |||
| 612 | public function handleAdminPermission($functionName, Request $request = null, $params = []) |
||
| 613 | { |
||
| 614 | return $request; |
||
| 615 | switch ($functionName) { |
||
| 616 | case 'index': |
||
| 617 | case 'store': |
||
| 618 | case 'show': |
||
| 619 | case 'edit': |
||
| 620 | case 'create': |
||
| 621 | case 'update': |
||
| 622 | case 'destroy': |
||
| 623 | default: |
||
| 624 | return $params; |
||
| 625 | } |
||
| 626 | } |
||
| 627 | |||
| 628 | public function handleBranchPermission($functionName, Request $request = null, $params) |
||
| 629 | { |
||
| 630 | switch ($functionName) { |
||
| 631 | case 'index': |
||
| 632 | case 'store': |
||
| 633 | case 'show': |
||
| 634 | case 'edit': |
||
| 635 | case 'create': |
||
| 636 | case 'update': |
||
| 637 | case 'destroy': |
||
| 638 | default: |
||
| 639 | return $params; |
||
| 640 | } |
||
| 641 | } |
||
| 642 | |||
| 643 | public function handleOwnPermission($functionName, Request $request = null, $params) |
||
| 644 | { |
||
| 645 | switch ($functionName) { |
||
| 646 | case 'index': |
||
| 647 | if (isset($request['filters'])) { |
||
| 648 | $filters = json_decode($request['filters'], true); |
||
| 649 | } else { |
||
| 650 | $filters = []; |
||
| 651 | } |
||
| 652 | array_push($filters, |
||
| 653 | [ |
||
| 654 | 'key' => 'owner_id', |
||
| 655 | 'operator' => '=', |
||
| 656 | 'value' => auth()->id() |
||
| 657 | ] |
||
| 658 | ); |
||
| 659 | if (!is_null($this->DEFAULT_GROUP_TITLE)) { |
||
| 660 | array_push($filters, |
||
| 661 | [ |
||
| 662 | 'key' => 'group.title', |
||
| 663 | 'operator' => '=', |
||
| 664 | 'value' => $this->DEFAULT_GROUP_TITLE |
||
| 665 | ] |
||
| 666 | ); |
||
| 667 | } |
||
| 668 | $request['filters'] = json_encode($filters); |
||
| 669 | return $request; |
||
| 670 | case 'store': |
||
| 671 | // check for group of user |
||
| 672 | if (!is_null($this->DEFAULT_GROUP_TITLE)) { |
||
| 673 | // get group model |
||
| 674 | $group = new Group(); |
||
| 675 | $group = $group->where('title', $this->DEFAULT_GROUP_TITLE)->first(); |
||
| 676 | $request['group_id'] = $group['id']; |
||
| 677 | } |
||
| 678 | |||
| 679 | $request['owner_id'] = auth()->id(); |
||
| 680 | return $request; |
||
| 681 | |||
| 682 | case 'show': |
||
| 683 | $filters = []; |
||
| 684 | array_push($filters, |
||
| 685 | ["owner_id", "=", auth()->id()] |
||
| 686 | ); |
||
| 687 | |||
| 688 | // check for group of user |
||
| 689 | if (!is_null($this->DEFAULT_GROUP_TITLE)) { |
||
| 690 | |||
| 691 | // get group model |
||
| 692 | $group = new Group(); |
||
| 693 | $group = $group->where('title', $this->DEFAULT_GROUP_TITLE)->first(); |
||
| 694 | |||
| 695 | // put group_id filter |
||
| 696 | array_push($filters, |
||
| 697 | ['group_id', '=', $group['id']]); |
||
| 698 | } |
||
| 699 | |||
| 700 | return $filters; |
||
| 701 | case 'edit': |
||
| 702 | $filters = []; |
||
| 703 | array_push($filters, |
||
| 704 | ["owner_id", "=", auth()->id()] |
||
| 705 | ); |
||
| 706 | |||
| 707 | // check gor group of user |
||
| 708 | if (!is_null($this->DEFAULT_GROUP_TITLE)) { |
||
| 709 | // get group model |
||
| 710 | $group = new Group(); |
||
| 711 | $group = $group->where('title', $this->DEFAULT_GROUP_TITLE)->first(); |
||
| 712 | |||
| 713 | // put group_id filter |
||
| 714 | array_push($filters, |
||
| 715 | ['group_id', '=', $group['id']]); |
||
| 716 | } |
||
| 717 | |||
| 718 | return $filters; |
||
| 719 | case 'create': |
||
| 720 | case 'update': |
||
| 721 | |||
| 722 | $filters = []; |
||
| 723 | // put to filter |
||
| 724 | array_push($filters, |
||
| 725 | ["owner_id", "=", auth()->id()] |
||
| 726 | ); |
||
| 727 | |||
| 728 | // put to request |
||
| 729 | $request['owner_id'] = auth()->id(); |
||
| 730 | |||
| 731 | // check for group of user |
||
| 732 | if (!is_null($this->DEFAULT_GROUP_TITLE)) { |
||
| 733 | // get group model |
||
| 734 | $group = new Group(); |
||
| 735 | $group = $group->where('title', $this->DEFAULT_GROUP_TITLE)->first(); |
||
| 736 | |||
| 737 | // put group_id filter |
||
| 738 | array_push($filters, |
||
| 739 | ['group_id', '=', $group['id']]); |
||
| 740 | |||
| 741 | // put to request |
||
| 742 | $request['group_id'] = $group['id']; |
||
| 743 | } |
||
| 744 | |||
| 745 | $request['permission_filters'] = $filters; |
||
| 746 | return $request; |
||
| 747 | case 'destroy': |
||
| 748 | $filters = []; |
||
| 749 | array_push($filters, |
||
| 750 | ["owner_id", "=", auth()->id()], |
||
| 751 | ["group_id", "=", $this->DEFAULT_GROUP_TITLE] |
||
| 752 | ); |
||
| 753 | return $filters; |
||
| 754 | default: |
||
| 755 | return $params; |
||
| 756 | } |
||
| 757 | } |
||
| 758 | |||
| 759 | public function handleGuestPermission($functionName, Request $request = null, $params) |
||
| 771 | } |
||
| 772 | } |
||
| 773 | |||
| 774 | } |
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