Failed Conditions
Push — master ( 5e6761...398dce )
by Adrien
04:14 queued 01:57
created

PostRepository::getAccessibleSubQuery()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
cc 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix\Blog\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Ecodev\Felix\Repository\LimitedAccessSubQuery;
9
10
/**
11
 * A fake repository
12
 */
13
final class PostRepository extends EntityRepository implements LimitedAccessSubQuery
14
{
15
    public function getAccessibleSubQuery(?\Ecodev\Felix\Model\User $user): string
16
    {
17
        if (!$user) {
18
            return 'SELECT id FROM post WHERE is_public = 1';
19
        }
20
21
        return '';
22
    }
23
}
24