Completed
Push — 6.13 ( 299dc7...bbf433 )
by
unknown
46:15 queued 21:37
created

RelativeResolver   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isStored() 0 4 1
A resolve() 0 4 1
A store() 0 4 1
A remove() 0 4 1
A rewriteUrl() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Bundle\EzPublishCoreBundle\Imagine\Cache\Resolver;
8
9
use Liip\ImagineBundle\Binary\BinaryInterface;
10
use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface;
11
12
class RelativeResolver implements ResolverInterface
13
{
14
    /**
15
     * @var \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface
16
     */
17
    private $resolver;
18
19
    /**
20
     * @param \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface $resolver
21
     */
22
    public function __construct(ResolverInterface $resolver)
23
    {
24
        $this->resolver = $resolver;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function isStored($path, $filter)
31
    {
32
        return $this->resolver->isStored($path, $filter);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function resolve($path, $filter)
39
    {
40
        return $this->rewriteUrl($this->resolver->resolve($path, $filter));
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->rewriteUrl($this-...solve($path, $filter)); of type string|false adds false to the return on line 40 which is incompatible with the return type declared by the interface Liip\ImagineBundle\Imagi...olverInterface::resolve of type string. It seems like you forgot to handle an error condition.
Loading history...
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function store(BinaryInterface $binary, $path, $filter)
47
    {
48
        return $this->resolver->store($binary, $path, $filter);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function remove(array $paths, array $filters)
55
    {
56
        return $this->resolver->remove($paths, $filters);
57
    }
58
59
    /**
60
     * Returns relative image path.
61
     *
62
     * @param $url string
63
     * @return string
64
     */
65
    protected function rewriteUrl($url)
66
    {
67
        return parse_url($url, PHP_URL_PATH);
68
    }
69
}
70