FileDownloadRepo   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getByUser() 0 4 1
A getByFile() 0 4 1
A getPage() 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;
9
use AbterPhp\Files\Domain\Entities\FileDownload as Entity;
10
use AbterPhp\Files\Orm\DataMappers\FileDownloadSqlDataMapper; // @phan-suppress-current-line PhanUnreferencedUseNormal
11
use AbterPhp\Framework\Orm\IGridRepo;
12
use Opulence\Orm\Repositories\Repository;
13
14
class FileDownloadRepo extends Repository implements IGridRepo
15
{
16
    /**
17
     * @param int      $limitFrom
18
     * @param int      $pageSize
19
     * @param string[] $orders
20
     * @param array    $conditions
21
     * @param array    $params
22
     *
23
     * @return Entity[]
24
     * @throws \Opulence\Orm\OrmException
25
     */
26
    public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array
27
    {
28
        /** @see FileDownloadSqlDataMapper::getPage() */
29
        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...
30
    }
31
32
    /**
33
     * @param File $file
34
     *
35
     * @return Entity[]
36
     * @throws \Opulence\Orm\OrmException
37
     */
38
    public function getByFile(File $file): array
39
    {
40
        /** @see FileDownloadSqlDataMapper::getByFileId() */
41
        return $this->getFromDataMapper('getByFileId', [$file->getId()]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat... array($file->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...
42
    }
43
44
    /**
45
     * @param User $user
46
     *
47
     * @return Entity[]
48
     * @throws \Opulence\Orm\OrmException
49
     */
50
    public function getByUser(User $user): array
51
    {
52
        /** @see FileDownloadSqlDataMapper::getByUserId() */
53
        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...
54
    }
55
}
56