Completed
Push — master ( 144614...3a2d63 )
by Albin
13s
created

StaticUrlResolver::__construct()   A

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
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 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