1 | <?php |
||
12 | abstract class Stencil_Abstract_Installable implements Stencil_Installable_Interface { |
||
13 | /** |
||
14 | * Slug of this module. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $slug; |
||
19 | |||
20 | /** |
||
21 | * Readable name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $name; |
||
26 | |||
27 | /** |
||
28 | * Version of this module. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $version = '0.0.0'; |
||
33 | |||
34 | /** |
||
35 | * Stencil_Installable constructor. |
||
36 | * |
||
37 | * @param string $slug Slug of the module. |
||
38 | * @param string $name Name of this module. |
||
39 | */ |
||
40 | public function __construct( $slug, $name ) { |
||
44 | |||
45 | /** |
||
46 | * Get slug name. |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | public function get_slug() { |
||
53 | |||
54 | /** |
||
55 | * Is this installable installed. |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function is_installed() { |
||
62 | |||
63 | /** |
||
64 | * Check if there is an upgrade available |
||
65 | * |
||
66 | * @return bool|mixed |
||
67 | */ |
||
68 | public function has_upgrade() { |
||
71 | |||
72 | /** |
||
73 | * Do all requirements pass so it is usable. |
||
74 | * |
||
75 | * @return bool|array TRUE if passed, array of errors if failed. |
||
76 | */ |
||
77 | public function passed_requirements() { |
||
80 | |||
81 | /** |
||
82 | * Get the name. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function __toString() { |
||
89 | |||
90 | /** |
||
91 | * Remove/uninstall |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | public function remove() { |
||
98 | |||
99 | /** |
||
100 | * Install |
||
101 | * |
||
102 | * @param bool $upgrading Installing or upgrading. |
||
103 | * |
||
104 | * @return bool|WP_Error True on succes, WP_Error on failure |
||
105 | */ |
||
106 | public function install( $upgrading = false ) { |
||
206 | |||
207 | /** |
||
208 | * Upgrade |
||
209 | * |
||
210 | * @return bool |
||
211 | * @throws Exception When an upgrade is already in progress for this package. |
||
212 | */ |
||
213 | public function upgrade() { |
||
216 | |||
217 | /** |
||
218 | * Cancel installer. |
||
219 | * |
||
220 | * @param WP_Upgrader_Skin $skin Skin to set message on. |
||
221 | * @param WP_Error|string $error Error to display. |
||
222 | */ |
||
223 | protected function cancel_installer( $skin, $error ) { |
||
228 | } |
||
229 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.