Users   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 60
ccs 8
cts 8
cp 1
rs 10
c 2
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getById() 0 4 1
A getByEmail() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Model\Repository;
6
7
use Nymfonya\Component\Container;
8
use App\Component\Model\Orm\IOrm;
9
use App\Component\Model\Orm\Orm;
10
11
class Users extends Orm implements IOrm
12
{
13
14
    /**
15
     * table name
16
     * @var string
17
     */
18
    protected $tablename = 'users';
19
20
    /**
21
     * table primary key
22
     * @var string
23
     */
24
    protected $primary = 'id';
25
26
    /**
27
     * database name
28
     * @var string
29
     */
30
    protected $database = 'nymfonya';
31
32
    /**
33
     * pool name
34
     * @var string
35
     */
36
    protected $slot = 'test';
37
38
    /**
39
     * instanciate
40
     *
41
     * @param Container $container
42
     * @return self
43
     */
44 4
    public function __construct(Container $container)
45
    {
46 4
        parent::__construct($container);
47
    }
48
49
    /**
50
     * find a user for a given id
51
     *
52
     * @param integer $uid
53
     * @return Users
54
     */
55 1
    public function getById(int $uid): Users
56
    {
57 1
        $this->find(['*'], ['id' => $uid]);
58 1
        return $this;
59
    }
60
61
    /**
62
     * find a user for a given email
63
     *
64
     * @param integer $uid
65
     * @return Users
66
     */
67 1
    public function getByEmail(string $email): Users
68
    {
69 1
        $this->find(['*'], ['email' => $email]);
70 1
        return $this;
71
    }
72
}
73