| Total Complexity | 9 |
| Total Lines | 100 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class TreeController extends Controller |
||
| 10 | { |
||
| 11 | protected $viewName = 'tree.main'; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Check user permissions |
||
| 15 | */ |
||
| 16 | protected function checkPermissions() |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @inheritDoc |
||
| 23 | */ |
||
| 24 | public function process(?Domain $domain, Module $module, Request $request) |
||
| 25 | { |
||
| 26 | // Pre-process |
||
| 27 | $this->preProcess($domain, $module, $request); |
||
| 28 | |||
| 29 | if (!app('uccello')->isTreeModule($module)) { |
||
| 30 | abort(404); |
||
| 31 | } |
||
| 32 | |||
| 33 | // Get model class |
||
| 34 | $modelClass = $module->model_class; |
||
| 35 | |||
| 36 | // Total count |
||
| 37 | $totalCount = $modelClass::inDomain($domain, $this->request->session()->get('descendants'))->count(); |
||
| 38 | |||
| 39 | return $this->autoView(compact('totalCount')); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Returns all root records where the user can access |
||
| 44 | * |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | public function root(?Domain $domain, Module $module, Request $request) |
||
| 48 | { |
||
| 49 | // Pre-process |
||
| 50 | $this->preProcess($domain, $module, $request); |
||
| 51 | |||
| 52 | // Get model class |
||
| 53 | $modelClass = $module->model_class; |
||
| 54 | |||
| 55 | // Get all roots records (according to the current domain) |
||
| 56 | $rootRecords = $modelClass::getRoots() |
||
| 57 | ->inDomain($domain, $this->request->session()->get('descendants')) |
||
| 58 | ->get(); |
||
| 59 | |||
| 60 | $roots = collect(); |
||
| 61 | foreach ($rootRecords as $record) { |
||
| 62 | $roots[] = $this->getFormattedRecordToAdd($record); |
||
| 63 | } |
||
| 64 | |||
| 65 | return $roots; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Returns all record's children. |
||
| 70 | * |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | public function children(?Domain $domain, Module $module, Request $request) |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Get formatted record to add to the tree |
||
| 97 | * |
||
| 98 | * @param mixed $record |
||
| 99 | * @return array|null |
||
| 100 | */ |
||
| 101 | protected function getFormattedRecordToAdd($record) |
||
| 109 | ] |
||
| 110 | ]; |
||
| 113 |
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