Completed
Push — master ( 14eda7...a429c1 )
by Pierre
03:00
created

Users::auth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
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\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