Test Failed
Push — moodle-from-git ( b024ad )
by Luke
02:50
created

ZipMoodleSource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A obtainMoodle() 0 9 1
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\MoodleSource;
12
13
use ComponentManager\MoodleVersion;
14
15
class ZipMoodleSource implements MoodleSource {
16
    /**
17
     * @inheritdoc MoodleSource
18
     */
19
    public function getId() {
20
        return 'Zip';
21
    }
22
23
    /**
24
     * @inheritdoc MoodleSource
25
     */
26
    public function obtainMoodle(MoodleVersion $moodleVersion,
27
                                 LoggerInterface $logger) {
28
        $uri = $moodleVersion->getDownloadUri();
29
30
        $logger->info('Downloading Moodle', [
31
            'uri'     => $uri,
32
            'archive' => $this->archive,
0 ignored issues
show
Bug introduced by
The property archive does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
        ]);
34
    }
35
}
36