StaticUrlResolver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 21
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolve() 0 4 1
1
<?php
2
3
namespace Gaufrette\Extras\Resolvable\Resolver;
4
5
use Gaufrette\Extras\Resolvable\ResolverInterface;
6
7
/**
8
 * Resolves object path by prepending a static prefix.
9
 *
10
 * @author Albin Kerouanton <[email protected]>
11
 */
12
class StaticUrlResolver implements ResolverInterface
13
{
14
    /** @var string */
15
    private $prefix;
16
17
    /**
18
     * @param string $prefix
19
     */
20
    public function __construct($prefix)
21
    {
22
        $this->prefix = rtrim($prefix, '/');
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function resolve($path)
29
    {
30
        return $this->prefix . '/' . ltrim($path, '/');
31
    }
32
}
33