SystemModulesController::onConstruct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 10
c 2
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Api\Controllers;
6
7
use Canvas\Models\SystemModules;
8
use Phalcon\Http\Response;
0 ignored issues
show
Bug introduced by
The type Phalcon\Http\Response 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * Class SystemModulesController.
12
 *
13
 * @package Canvas\Api\Controllers
14
 *
15
 */
16
class SystemModulesController extends BaseController
17
{
18
    /*
19
     * fields we accept to create
20
     *
21
     * @var array
22
     */
23
    protected $createFields = [
24
        'name',
25
        'slug',
26
        'model_name',
27
        'browse_fields',
28
        'show',
29
        'protected'
30
    ];
31
32
    /*
33
     * fields we accept to create
34
     *
35
     * @var array
36
     */
37
    protected $updateFields = [
38
        'name',
39
        'slug',
40
        'model_name',
41
        'browse_fields',
42
        'show',
43
        'protected'
44
    ];
45
46
    /**
47
     * set objects.
48
     *
49
     * @return void
50
     */
51
    public function onConstruct()
52
    {
53
        $this->model = new SystemModules();
0 ignored issues
show
Bug Best Practice introduced by
The property model does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
54
        $this->model->apps_id = $this->app->getId();
55
        $this->additionalSearchFields = [
0 ignored issues
show
Bug Best Practice introduced by
The property additionalSearchFields does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
56
            ['is_deleted', ':', '0'],
57
            ['apps_id', ':', $this->app->getId()],
58
        ];
59
    }
60
61
    /**
62
     * Delete a Record.
63
     *
64
     * @throws Exception
65
     *
66
     * @return Response
67
     */
68
    public function delete($id) : Response
69
    {
70
        return $this->response('Cant delete System Modules at the moment');
71
    }
72
}
73