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

Users::getByEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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