Test Failed
Push — master ( 27dc48...91c9bc )
by Maximo
02:29
created

Users   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 46
ccs 16
cts 18
cp 0.8889
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 18 1
A getKey() 0 3 1
A getSource() 0 3 1
1
<?php
0 ignored issues
show
Coding Style introduced by
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
declare(strict_types=1);
3
4
namespace Gewaer\Models;
5
6
use Gewaer\Traits\PermissionsTrait;
7
8
class Users extends \Baka\Auth\Models\Users
9
{
10
    use PermissionsTrait;
0 ignored issues
show
introduced by
The trait Gewaer\Traits\PermissionsTrait requires some properties which are not provided by Gewaer\Models\Users: $defaultCompany, $di, $roles, $app
Loading history...
11
12
    /**
13
     * Initialize method for model.
14
     */
15 5
    public function initialize()
16
    {
17 5
        parent::initialize();
18
19 5
        $this->setSource('users');
20
21 5
        $this->hasOne(
22 5
            'id',
23 5
            'Gewaer\Models\UserRoles',
24 5
            'users_id',
25 5
            ['alias' => 'permission']
26
        );
27
28 5
        $this->hasMany(
29 5
            'id',
30 5
            'Gewaer\Models\UserRoles',
31 5
            'users_id',
32 5
            ['alias' => 'permissions']
33
        );
34 5
    }
35
36
    /**
37
     * Returns table name mapped in the model.
38
     *
39
     * @return string
40
     */
41 4
    public function getSource(): string
42
    {
43 4
        return 'users';
44
    }
45
46
    /**
47
     * Get the User key for redis
48
     *
49
     * @return string
50
     */
51
    public function getKey(): string
52
    {
53
        return $this->id;
54
    }
55
}
56