Completed
Pull Request — master (#26)
by Paulo Rodrigues
04:47
created

ManifestVersionStrategy   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 28
rs 10
c 0
b 0
f 0
ccs 8
cts 11
cp 0.7272

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getVersion() 0 4 1
A applyVersion() 0 12 3
1
<?php
2
3
namespace Rj\FrontendBundle\VersionStrategy;
4
5
use Rj\FrontendBundle\Manifest\Loader\ManifestLoaderInterface;
6
7
class ManifestVersionStrategy implements VersionStrategyInterface
8
{
9
    private $loader;
10
    private $manifest = null;
11
12 3
    public function __construct(ManifestLoaderInterface $loader)
13
    {
14 3
        $this->loader = $loader;
15 3
    }
16
17
    public function getVersion($path)
18
    {
19
        return '';
20
    }
21
22 3
    public function applyVersion($path)
23
    {
24 3
        if ($this->manifest === null) {
25 3
            $this->manifest = $this->loader->load();
26
        }
27
28 3
        if (!$this->manifest->has($path)) {
29
            return $path;
30
        }
31
32 3
        return $this->manifest->get($path);
33
    }
34
}
35