PrefixCandidates::getPrefixes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher MultiTenancy Bundle.
5
 *
6
 * Copyright 2016 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR;
16
17
use SWP\Component\MultiTenancy\PathBuilder\TenantAwarePathBuilderInterface;
18
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\PrefixCandidates as BasePrefixCandidates;
19
20
/**
21
 * Class PrefixCandidates.
22
 */
23
class PrefixCandidates extends BasePrefixCandidates
24
{
25
    /**
26
     * @var TenantAwarePathBuilderInterface
27
     */
28
    protected $pathBuilder;
29
30
    /**
31
     * @var array
32
     */
33
    protected $routePathsNames = [];
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getPrefixes()
39
    {
40
        $this->idPrefixes = (array) $this->pathBuilder->build($this->routePathsNames);
41
42
        return $this->idPrefixes;
43
    }
44
45
    /**
46
     * Sets path builder.
47
     *
48
     * @param TenantAwarePathBuilderInterface $pathBuilder
49
     */
50
    public function setPathBuilder(TenantAwarePathBuilderInterface $pathBuilder)
51
    {
52
        $this->pathBuilder = $pathBuilder;
53
    }
54
55
    /**
56
     * @param array $routePathsNames
57
     */
58
    public function setRoutePathsNames(array $routePathsNames = [])
59
    {
60
        $this->routePathsNames = $routePathsNames;
61
    }
62
}
63