Passed
Push — master ( cd4631...f63432 )
by Peter
02:15
created

UserRepo::getByClientId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Orm;
6
7
use AbterPhp\Admin\Domain\Entities\User as Entity;
8
use AbterPhp\Admin\Orm\DataMappers\UserSqlDataMapper;
9
use AbterPhp\Framework\Orm\IGridRepo;
10
use Opulence\Orm\Repositories\Repository;
11
12
class UserRepo extends Repository implements IGridRepo
13
{
14
    /**
15
     * @param int      $limitFrom
16
     * @param int      $pageSize
17
     * @param string[] $orders
18
     * @param array    $conditions
19
     * @param array    $params
20
     *
21
     * @return Entity[]
22
     */
23
    public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array
24
    {
25
        /** @see UserSqlDataMapper::getPage() */
26
        return $this->getFromDataMapper('getPage', [$limitFrom, $pageSize, $orders, $conditions, $params]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat... $conditions, $params)) could return the type object which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
27
    }
28
29
    /**
30
     * @param string $clientId
31
     *
32
     * @return Entity|null
33
     */
34
    public function getByClientId(string $clientId): ?Entity
35
    {
36
        /** @see UserSqlDataMapper::getByClientId() */
37
        return $this->getFromDataMapper('getByClientId', [$clientId]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...tId', array($clientId)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
38
    }
39
40
    /**
41
     * @param string $username
42
     *
43
     * @return Entity|null
44
     */
45
    public function getByUsername(string $username): ?Entity
46
    {
47
        /** @see UserSqlDataMapper::getByUsername() */
48
        return $this->getFromDataMapper('getByUsername', [$username]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...ame', array($username)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
49
    }
50
51
    /**
52
     * @param string $email
53
     *
54
     * @return Entity|null
55
     */
56
    public function getByEmail(string $email): ?Entity
57
    {
58
        /** @see UserSqlDataMapper::getByEmail() */
59
        return $this->getFromDataMapper('getByEmail', [$email]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...yEmail', array($email)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
60
    }
61
62
    /**
63
     * @param string $identifier
64
     *
65
     * @return Entity|null
66
     */
67
    public function find(string $identifier): ?Entity
68
    {
69
        /** @see UserSqlDataMapper::find() */
70
        return $this->getFromDataMapper('find', [$identifier]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...d', array($identifier)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
71
    }
72
}
73