Passed
Push — develop ( 9557ee...e4ecab )
by Enea
04:24
created

Grantable::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Created on 11/02/18 by enea dhack.
7
 */
8
9
namespace Enea\Authorization\Models;
10
11
use Illuminate\Database\Eloquent\Model;
12
13
abstract class Grantable extends Model
14
{
15 79
    public function __construct(array $attributes = [])
16
    {
17 79
        $this->setTable($this->getConfigTableName());
18 79
        parent::__construct($attributes);
19 79
    }
20
21
    abstract protected function getConfigTableName(): string;
22
23 79
    public function getFillable()
24
    {
25
        return [
26 79
            'secret_name',
27
            'display_name',
28
            'description'
29
        ];
30
    }
31
32 9
    public function __toString()
33
    {
34 9
        return $this->getAttribute('secret_name');
35
    }
36
}
37