Users::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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