BaseModel::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace TarfinLabs\Parasut\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Sushi\Sushi;
7
8
class BaseModel extends Model
9
{
10
    use Sushi;
0 ignored issues
show
introduced by
The trait Sushi\Sushi requires some properties which are not provided by TarfinLabs\Parasut\Models\BaseModel: $schema, $class, $rows
Loading history...
11
12 10
    public function __construct(array $attributes = [])
13
    {
14 10
        parent::__construct($attributes);
15
16 10
        $this->fillable = array_keys($this->schema);
0 ignored issues
show
Bug introduced by
The property schema does not seem to exist on TarfinLabs\Parasut\Models\BaseModel. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
17 10
    }
18
19 10
    public function getRows(): array
20
    {
21 10
        return [array_merge(['id' => 'integer'], $this->schema)];
0 ignored issues
show
Bug introduced by
The property schema does not seem to exist on TarfinLabs\Parasut\Models\BaseModel. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
22
    }
23
}
24