Completed
Branch develop (e3b860)
by Luke
13:48
created

getComponentProjectFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
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\Command;
12
13
use ComponentManager\Component;
14
use ComponentManager\Moodle;
15
use ComponentManager\PlatformUtil;
16
use ComponentManager\Project\ComponentProjectFile;
17
use ComponentManager\Project\Project;
18
use ComponentManager\Project\ProjectFile;
19
use ComponentManager\Project\ProjectLockFile;
20
use Symfony\Component\Console\Command\Command;
21
22
/**
23
 * Project-aware command trait.
24
 *
25
 * Provides helpful utility methods for accessing the project in the currrent
26
 * working directory. Import this into command implementations to reduce
27
 * duplication.
28
 */
29
abstract class ComponentProjectAwareCommand extends Command {
30
    /**
31
     * Component project file.
32
     *
33
     * Lazily loaded -- be sure to call getProject() in order to ensure the
34
     * value is defined.
35
     *
36
     * @var \ComponentManager\Project\ComponentProjectFile
37
     */
38
    protected $componentProjectFile;
39
40
    /**
41
     * Get component project file.
42
     *
43
     * @return \ComponentManager\Project\ComponentProjectFile
44
     */
45
    protected function getComponentProjectFile() {
46
        if ($this->componentProjectFile === null) {
47
            $this->componentProjectFile = new ComponentProjectFile(
48
                    ComponentProjectFile::FILENAME);
49
        }
50
51
        return $this->componentProjectFile;
52
    }
53
}
54