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