Model   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
abstract class Model extends Cortex
0 ignored issues
show
Bug introduced by
The type Cortex 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...
4
{
5
    protected $app;
6
    protected $db = 'DB';
7
    protected $fieldConf = array(
8
        'created_at' => array(
9
            'type' => Schema::DT_TIMESTAMP,
0 ignored issues
show
Bug introduced by
The type Schema 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...
10
            'default' => Schema::DF_CURRENT_TIMESTAMP
11
            ),
12
        'updated_at' => array(
13
            'type' => Schema::DT_TIMESTAMP,
14
            'default' => '0-0-0 0:0:0'
15
            ),
16
        'deleted_at' => array(
17
            'type' => Schema::DT_TIMESTAMP,
18
            'default' => '0-0-0 0:0:0'
19
            )
20
        );
21
22
    public function __construct()
23
    {
24
        if (property_exists($this, 'fields')) {
25
            $this->fieldConf = array_merge($this->fields, $this->fieldConf);
26
        }
27
28
        parent::__construct();
29
        $this->app = f3();
30
        //$this->beforesave($this->validate(get_called_class()));
31
    }
32
33
    /*private function validate($caller, $parent) {
34
        $valid = true;
35
        foreach($this->getFieldConfiguration() as $field => $conf) {
36
            if(isset($conf['type']) && !isset($conf['relType'])){
37
                $val = $this->get($field);
38
                $model = strtolower(str_replace('\\','.',$class));
39
                // check required fields
40
                if ($valid && isset($conf['required']))
41
                    $valid = \Validation::instance()->required($val,$field,'error.'.$model.'.'.$field);
42
                // check unique
43
                if ($valid && isset($conf['unique']))
44
                    $valid = \Validation::instance()->unique($self,$val,$field,'error.'.$model.'.'.$field);
45
                if (!$valid)
46
                    break;
47
            }
48
        }
49
        return $valid;
50
    }*/
51
}
52