Passed
Push — master ( 4c95d5...ad70ef )
by Alexander
01:34
created

CommentRepository::findAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Blog\Comment;
6
7
use App\Blog\Entity\Comment;
8
use Cycle\ORM\Select;
0 ignored issues
show
Bug introduced by
The type Cycle\ORM\Select was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Yiisoft\Data\Reader\DataReaderInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Data\Reader\DataReaderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Yiisoft\Data\Reader\Sort;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Data\Reader\Sort was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Yiisoft\Yii\Cycle\Data\Reader\EntityReader;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\Cycle\Data\Reader\EntityReader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Yiisoft\Yii\Cycle\Data\Writer\EntityWriter;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\Cycle\Data\Writer\EntityWriter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
final class CommentRepository extends Select\Repository
0 ignored issues
show
Bug introduced by
The type Cycle\ORM\Select\Repository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
{
16
    public function __construct( Select $select)
17
    {
18
        parent::__construct($select);
19
    }
20
    /**
21
     * @psalm-return DataReaderInterface<int, Comment>
22
     */
23
    public function getReader(): DataReaderInterface
24
    {
25
        return (new EntityReader($this->select()))
26
            ->withSort($this->getSort());
27
    }
28
29
    public function getSort(): Sort
30
    {
31
        return Sort::only(['id', 'public', 'created_at', 'post_id', 'user_id'])->withOrder(['id' => 'asc']);
32
    }
33
34
    public function findAll(array $scope = [], array $orderBy = []): DataReaderInterface
35
    {
36
        return new EntityReader($this
37
            ->select()
38
            ->where($scope)
39
            ->orderBy($orderBy));
40
    }
41
}
42