Failed Conditions
Push — master ( 27554e...857869 )
by Luca
09:08
created

Random   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
eloc 2
c 0
b 0
f 0
dl 0
loc 9
ccs 2
cts 4
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Api\Input\Sorting;
6
7
use Doctrine\ORM\Mapping\ClassMetadata;
8
use Doctrine\ORM\QueryBuilder;
9
use GraphQL\Doctrine\Factory\UniqueNameFactory;
10
use GraphQL\Doctrine\Sorting\SortingInterface;
11
12
class Random implements SortingInterface
13
{
14 1
    public function __construct()
15
    {
16 1
    }
17
18
    public function __invoke(UniqueNameFactory $uniqueNameFactory, ClassMetadata $metadata, QueryBuilder $queryBuilder, string $alias, string $order): void
19
    {
20
        $queryBuilder->addOrderBy('RAND()');
21
    }
22
}
23