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

RelativeResolver::isStored()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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