FileRepo   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 64
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPage() 0 4 1
A getByFilesystemName() 0 4 1
A getPublicByFilesystemName() 0 4 1
A getByUser() 0 4 1
A getPublicByCategoryIdentifiers() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Files\Orm;
6
7
use AbterPhp\Admin\Domain\Entities\User;
8
use AbterPhp\Files\Domain\Entities\File as Entity;
9
use AbterPhp\Files\Orm\DataMappers\FileSqlDataMapper; // @phan-suppress-current-line PhanUnreferencedUseNormal
10
use AbterPhp\Framework\Orm\IGridRepo;
11
use Opulence\Orm\Repositories\Repository;
12
13
class FileRepo extends Repository implements IGridRepo
14
{
15
    /**
16
     * @param int      $limitFrom
17
     * @param int      $pageSize
18
     * @param string[] $orders
19
     * @param array    $conditions
20
     * @param array    $params
21
     *
22
     * @return Entity[]
23
     * @throws \Opulence\Orm\OrmException
24
     */
25
    public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array
26
    {
27
        /** @see FileSqlDataMapper::getPage() */
28
        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...
29
    }
30
31
    /**
32
     * @param User $user
33
     *
34
     * @return Entity[]
35
     * @throws \Opulence\Orm\OrmException
36
     */
37
    public function getByUser(User $user): array
38
    {
39
        /** @see FileSqlDataMapper::getByUserId() */
40
        return $this->getFromDataMapper('getByUserId', [$user->getId()]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat... array($user->getId())) 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...
41
    }
42
43
    /**
44
     * @param string $filesystemName
45
     *
46
     * @return Entity|null
47
     * @throws \Opulence\Orm\OrmException
48
     */
49
    public function getByFilesystemName(string $filesystemName): ?Entity
50
    {
51
        /** @see FileSqlDataMapper::getByFilesystemName() */
52
        return $this->getFromDataMapper('getByFilesystemName', [$filesystemName]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...array($filesystemName)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Files\Domain\Entities\File|null. Consider adding an additional type-check to rule them out.
Loading history...
53
    }
54
55
    /**
56
     * @param string $filesystemName
57
     *
58
     * @return Entity|null
59
     * @throws \Opulence\Orm\OrmException
60
     */
61
    public function getPublicByFilesystemName(string $filesystemName): ?Entity
62
    {
63
        /** @see FileSqlDataMapper::getPublicByFilesystemName() */
64
        return $this->getFromDataMapper('getPublicByFilesystemName', [$filesystemName]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...array($filesystemName)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Files\Domain\Entities\File|null. Consider adding an additional type-check to rule them out.
Loading history...
65
    }
66
67
    /**
68
     * @param string[] $identifiers
69
     *
70
     * @return Entity[]
71
     * @throws \Opulence\Orm\OrmException
72
     */
73
    public function getPublicByCategoryIdentifiers(array $identifiers): array
74
    {
75
        /** @see FileSqlDataMapper::getPublicByCategoryIdentifiers() */
76
        return $this->getFromDataMapper('getPublicByCategoryIdentifiers', [$identifiers]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...', array($identifiers)) 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...
77
    }
78
}
79