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

Grantable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 3 1
A getFillable() 0 6 1
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