AssetPrefixTokenProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace NVBooster\PHPCRAssetsBundle\Routing;
3
4
use Symfony\Cmf\Component\RoutingAuto\TokenProviderInterface;
5
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
6
use Symfony\Cmf\Component\RoutingAuto\UriContext;
7
8
/**
9
 * @author nvb
10
 *
11
 */
12
class AssetPrefixTokenProvider implements TokenProviderInterface
13
{
14
    private $prefix;
15
    
16
    /**
17
     * @param string $prefix
18
     */
19
    public function __construct($prefix = '')
20
    {
21
        $this->prefix = preg_replace('@^\/|\/$@', '', $prefix);    
22
    }
23
    
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function provideValue(UriContext $uriContext, $options)
28
    {
29
        return $this->prefix;
30
    }
31
    
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function configureOptions(OptionsResolverInterface $optionsResolver)
36
    {
37
    }
38
}