Total Complexity | 2 |
Total Lines | 83 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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) |
|
90 |