Completed
Push — master ( 3a2d63...6346ac )
by Albin
03:04
created

StaticUrlResolver   A

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
class StaticUrlResolver implements ResolverInterface
11
{
12
    /** @var string */
13
    private $prefix;
14
15
    /**
16
     * @param string $prefix
17
     */
18
    public function __construct($prefix)
19
    {
20
        $this->prefix = rtrim($prefix, '/');
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function resolve($path)
27
    {
28
        return $this->prefix . '/' . ltrim($path, '/');
29
    }
30
}
31