Completed
Pull Request — master (#33)
by Iakov
06:48
created

GetQueryBuilderStep::requiresBefore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Kami\ApiCoreBundle\RequestProcessor\Step\Common;
4
5
use Doctrine\Bundle\DoctrineBundle\Registry;
6
use Kami\Component\RequestProcessor\Artifact;
7
use Kami\Component\RequestProcessor\ArtifactCollection;
8
use Kami\Component\RequestProcessor\Step\AbstractStep;
9
use Symfony\Component\HttpFoundation\Request;
10
11
class GetQueryBuilderStep extends AbstractStep
12
{
13
    /**
14
     * @var Registry
15
     */
16
    private $doctrine;
17
18 1
    public function __construct(Registry $doctrine)
19
    {
20 1
        $this->doctrine = $doctrine;
21 1
    }
22
23
    public function execute(Request $request) : ArtifactCollection
24
    {
25
        return new ArtifactCollection([
26
            new Artifact('query_builder', $this->doctrine->getManager()->createQueryBuilder())
27
        ]);
28
    }
29
30
    public function getRequiredArtifacts() : array
31
    {
32
        return ['access_granted'];
33
    }
34
}