Completed
Push — master ( 1d6005...a968e3 )
by Pierre
03:06
created

Users   A

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