PackageResource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 83
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstallMessage() 0 7 2
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Console\PackageResources;
4
5
abstract class PackageResource
6
{
7
    /**
8
     * The package resource description. A little summary of what this resource
9
     * contains.
10
     *
11
     * @var string
12
     */
13
    public $description;
14
15
    /**
16
     * The source items of this resource. Usually a set of paths to files
17
     * and/or folders.
18
     *
19
     * @var mixed
20
     */
21
    protected $source;
22
23
    /**
24
     * The install location of this resource. Usually a target folder or file.
25
     *
26
     * @var mixed
27
     */
28
    public $target;
29
30
    /**
31
     * Whether this resource is required for the package to work fine.
32
     *
33
     * @var bool
34
     */
35
    public $required;
36
37
    /**
38
     * A set of messages that will be used during the resource installation.
39
     * Usually, the array should contains keys for 'install', 'overwrite' and
40
     * 'success' messages.
41
     *
42
     * @var array
43
     */
44
    protected $messages;
45
46
    /**
47
     * Installs or publishes the resource.
48
     *
49
     * @return void
50
     */
51
    abstract public function install();
52
53
    /**
54
     * Uninstalls the resource.
55
     *
56
     * @return void
57
     */
58
    abstract public function uninstall();
59
60
    /**
61
     * Checks whether the resource already exists in the target location.
62
     *
63
     * @return bool
64
     */
65
    abstract public function exists();
66
67
    /**
68
     * Checks whether the resource is correctly installed, i.e. if the source
69
     * items matches with the items available at the target location.
70
     *
71
     * @return bool
72
     */
73
    abstract public function installed();
74
75
    /**
76
     * Gets an installation message.
77
     *
78
     * @param  string  $key  The message keyword
79
     * @return string|null
80
     */
81 19
    public function getInstallMessage($key)
82
    {
83 19
        if (! isset($this->messages[$key])) {
84 1
            return null;
85
        }
86
87 19
        return $this->messages[$key];
88
    }
89
}
90