Test Failed
Push — master ( f875a7...aad9c2 )
by Luke
22:35
created

FilesystemPackageRepository::resolveComponent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * Moodle component manager.
5
 *
6
 * @author Luke Carrier <[email protected]>
7
 * @copyright 2016 Luke Carrier
8
 * @license GPL-3.0+
9
 */
10
11
namespace ComponentManager\PackageRepository;
12
13
use ComponentManager\Component;
14
use ComponentManager\ComponentSource\DirectoryComponentSource;
15
use ComponentManager\ComponentSpecification;
16
use ComponentManager\ComponentVersion;
17
18
/**
19
 * Filesystem package repository.
20
 *
21
 * Allows sourcing components from a local filesystem.
22
 */
23 View Code Duplication
class FilesystemPackageRepository extends AbstractPackageRepository
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
        implements PackageRepository {
25
    /**
26
     * @inheritdoc PackageRepository
27
     */
28
    public function getId() {
29
        return 'Filesystem';
30
    }
31
32
    /**
33
     * @inheritdoc PackageRepository
34
     */
35
    public function getName() {
36
        return 'Filesystem package repository';
37
    }
38
39
    /**
40
     * @inheritdoc PackageRepository
41
     */
42
    public function resolveComponent(ComponentSpecification $componentSpecification,
43
                                     LoggerInterface $logger) {
44
        return new Component($componentSpecification->getName(), [
45
            new ComponentVersion(null, null, null, [
46
                new DirectoryComponentSource($componentSpecification->getExtra('directory')),
47
            ]),
48
        ], $this);
49
    }
50
51
    /**
52
     * @inheritdoc PackageRepository
53
     */
54
    public function satisfiesVersion($versionSpecification, ComponentVersion $version) {
55
        return true;
56
    }
57
}
58