GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#1001)
by Paul
02:48
created

Requirement_Proc_Open::test()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace HM\BackUpWordPress;
4
5
/**
6
 * An abstract requirement class, individual requirements should
7
 * extend this class
8
 */
9
abstract class Requirement {
10
11
	/**
12
	 * @var string
13
	 */
14
	protected $name = '';
15
16
	/**
17
	 * @return mixed
18
	 */
19
	protected static function test() {}
20
21
	/**
22
	 * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
23
	 */
24
	public function name() {
25
		return $this->name;
26
	}
27
28
	/**
29
	 * @return mixed|string
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
30
	 */
31
	public function result() {
32
33
		$test = $this->test();
34
35
		if ( is_string( $test ) && $test ) {
36
			return $test;
37
		}
38
39
		if ( is_bool( $test ) || empty( $test ) ) {
40
41
			if ( $test ) {
42
				return 'Yes';
43
			}
44
45
			return 'No';
46
47
		}
48
49
		return var_export( $test, true );
50
51
	}
52
53
	public function raw_result() {
54
		return $this->test();
55
	}
56
}
57
58
/**
59
 * Class Requirement_Zip_Archive
60
 */
61
class Requirement_Zip_Archive extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
62
63
	/**
64
	 * @var string
65
	 */
66
	var $name = 'ZipArchive';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
67
68
	/**
69
	 * @return bool
70
	 */
71
	public static function test() {
72
73
		if ( class_exists( 'ZipArchive' ) ) {
1 ignored issue
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return class_exists('ZipArchive');.
Loading history...
74
			return true;
75
		}
76
77
		return false;
78
79
	}
80
}
81
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Archive', 'PHP' );
82
83
/**
84
 * Class Requirement_Zip_Command
85
 *
86
 * Tests whether the zip command is available and if it is what path it's available at
87
 */
88
class Requirement_Zip_Command_Path extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
89
90
	/**
91
	 * @var string
92
	 */
93
	var $name = 'zip command';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
94
95
	/**
96
	 * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string|false?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
97
	 */
98
	public static function test() {
99
100
		$backup = new Zip_File_Backup_Engine;
101
102
		return $backup->get_zip_executable_path();
103
104
	}
105
}
106
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Command_Path', 'Server' );
107
108
/**
109
 * Class Requirement_Mysqldump_Command
110
 *
111
 * Tests whether the zip command is available and if it is what path it's available at
112
 */
113
class Requirement_Mysqldump_Command_Path extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
114
115
	/**
116
	 * @var string
117
	 */
118
	var $name = 'mysqldump command';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
119
120
	/**
121
	 * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string|false?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
122
	 */
123
	public static function test() {
124
125
		$backup = new Mysqldump_Database_Backup_Engine;
126
127
		return $backup->get_mysqldump_executable_path();
128
129
	}
130
}
131
Requirements::register( 'HM\BackUpWordPress\Requirement_Mysqldump_Command_Path', 'Server' );
132
133
/**
134
 * Class Requirement_PHP_User
135
 */
136
class Requirement_PHP_User extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
137
138
	/**
139
	 * @var string
140
	 */
141
	var $name = 'User';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
142
143
	/**
144
	 * @return string
145
	 */
146
	public static function test() {
147
148
		if ( ! Backup_Utilities::is_exec_available() ) {
0 ignored issues
show
Bug introduced by
The method is_exec_available() does not seem to exist on object<HM\BackUpWordPress\Backup_Utilities>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
149
			return '';
150
		}
151
152
		return shell_exec( 'whoami' );
153
154
	}
155
}
156
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_User', 'PHP' );
157
158
/**
159
 * Class Requirement_PHP_Group
160
 */
161
class Requirement_PHP_Group extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
162
163
	/**
164
	 * @var string
165
	 */
166
	var $name = 'Group[s]';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
167
168
	/**
169
	 * @return string
170
	 */
171
	public static function test() {
172
173
		if ( ! Backup_Utilities::is_exec_available() ) {
0 ignored issues
show
Bug introduced by
The method is_exec_available() does not seem to exist on object<HM\BackUpWordPress\Backup_Utilities>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
174
			return '';
175
		}
176
177
		return shell_exec( 'groups' );
178
179
	}
180
}
181
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Group', 'PHP' );
182
183
/**
184
 * Class Requirement_PHP_Version
185
 */
186
class Requirement_PHP_Version extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
187
188
	/**
189
	 * @var string
190
	 */
191
	var $name = 'Version';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
192
193
	/**
194
	 * @return string
195
	 */
196
	public static function test() {
197
		return PHP_VERSION;
198
	}
199
}
200
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Version', 'PHP' );
201
202
/**
203
 * Class Requirement_Cron_Array
204
 */
205
class Requirement_Cron_Array extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
206
207
	/**
208
	 * @var string
209
	 */
210
	var $name = 'Cron Array';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
211
212
	/**
213
	 * @return bool|mixed
214
	 */
215
	public static function test() {
216
217
		$cron = get_option( 'cron' );
218
219
		if ( ! $cron ) {
220
			return false;
221
		}
222
223
		return $cron;
224
225
	}
226
}
227
Requirements::register( 'HM\BackUpWordPress\Requirement_Cron_Array', 'Site' );
228
229
/**
230
 * Class Requirement_Cron_Array
231
 */
232
class Requirement_Language extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
233
234
	/**
235
	 * @var string
236
	 */
237
	var $name = 'Language';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
238
239
	/**
240
	 * @return bool|mixed
241
	 */
242
	public static function test() {
243
244
		// Since 4.0
245
		$language = get_option( 'WPLANG' );
246
247
		if ( $language ) {
248
			return $language;
249
		}
250
251
		if ( defined( 'WPLANG' ) && WPLANG ) {
252
			return WPLANG;
253
		}
254
255
		return 'en_US';
256
257
	}
258
}
259
Requirements::register( 'HM\BackUpWordPress\Requirement_Language', 'Site' );
260
261
/**
262
 * Class Requirement_Safe_Mode
263
 */
264
class Requirement_Safe_Mode extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
265
266
	/**
267
	 * @var string
268
	 */
269
	var $name = 'Safe Mode';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
270
271
	/**
272
	 * @return bool
273
	 */
274
	public static function test() {
275
		return Backup_Utilities::is_safe_mode_on();
276
	}
277
}
278
Requirements::register( 'HM\BackUpWordPress\Requirement_Safe_Mode', 'PHP' );
279
280
/**
281
 * Class Requirement_Memory_Limit
282
 */
283
class Requirement_PHP_Memory_Limit extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
284
285
	/**
286
	 * @var string
287
	 */
288
	var $name = 'Memory Limit';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
289
290
	/**
291
	 * @return string
292
	 */
293
	public static function test() {
294
		return @ini_get( 'memory_limit' );
295
	}
296
}
297
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Memory_Limit', 'PHP' );
298
299
/**
300
 * Class Requirement_Backup_Path
301
 */
302
class Requirement_Backup_Path extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
303
304
	/**
305
	 * @var string
306
	 */
307
	var $name = 'Backup Path';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
308
309
	/**
310
	 * @return string
311
	 */
312
	public static function test() {
313
		return Path::get_path();
314
	}
315
}
316
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path', 'Site' );
317
318
/**
319
 * Class Requirement_Backup_Path_Permissions
320
 */
321
class Requirement_Backup_Path_Permissions extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
322
323
	/**
324
	 * @var string
325
	 */
326
	var $name = 'Backup Path Permissions';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
327
328
	/**
329
	 * @return string
330
	 */
331
	public static function test() {
332
		return substr( sprintf( '%o', fileperms( Path::get_path() ) ), - 4 );
333
	}
334
}
335
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path_Permissions', 'Site' );
336
337
/**
338
 * Class Requirement_WP_CONTENT_DIR
339
 */
340
class Requirement_WP_CONTENT_DIR extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
341
342
	/**
343
	 * @var string
344
	 */
345
	var $name = 'WP_CONTENT_DIR';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
346
347
	/**
348
	 * @return string
349
	 */
350
	public static function test() {
351
		return WP_CONTENT_DIR;
352
	}
353
}
354
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR', 'Site' );
355
356
/**
357
 * Class Requirement_WP_CONTENT_DIR_Permissions
358
 */
359
class Requirement_WP_CONTENT_DIR_Permissions extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
360
361
	/**
362
	 * @var string
363
	 */
364
	var $name = 'WP_CONTENT_DIR Permissions';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
365
366
	/**
367
	 * @return string
368
	 */
369
	public static function test() {
370
		return substr( sprintf( '%o', fileperms( WP_CONTENT_DIR ) ), - 4 );
371
	}
372
}
373
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR_Permissions', 'Site' );
374
375
/**
376
 * Class Requirement_ABSPATH
377
 */
378
class Requirement_ABSPATH extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
379
380
	/**
381
	 * @var string
382
	 */
383
	var $name = 'ABSPATH';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
384
385
	/**
386
	 * @return string
387
	 */
388
	public static function test() {
389
		return ABSPATH;
390
	}
391
}
392
Requirements::register( 'HM\BackUpWordPress\Requirement_ABSPATH', 'Site' );
393
394
/**
395
 * Class Requirement_Backup_Root_Path
396
 */
397
class Requirement_Backup_Root_Path extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
398
399
	/**
400
	 * @var string
401
	 */
402
	var $name = 'Site Root Path';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
403
404
	/**
405
	 * @return string
406
	 */
407
	public static function test() {
408
		return Path::get_root();
409
	}
410
}
411
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Root_Path', 'Site' );
412
413
/**
414
 * Class Requirement_Calculated_Size
415
 */
416
class Requirement_Calculated_Size extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
417
418
	/**
419
	 * @var string
420
	 */
421
	var $name = 'Calculated size of site';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
422
423
	/**
424
	 * @return array
425
	 */
426
	public static function test() {
427
428
		$backup_sizes = array();
429
430
		$schedules = Schedules::get_instance();
431
432
		foreach ( $schedules->get_schedules() as $schedule ) {
433
434
			$site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
435
436
			if ( $site_size->is_site_size_cached() ) {
437
				$backup_sizes[ $schedule->get_type() ] = $site_size->get_formatted_site_size();
438
			}
439
		}
440
441
		return $backup_sizes;
442
443
	}
444
}
445
Requirements::register( 'HM\BackUpWordPress\Requirement_Calculated_Size', 'Site' );
446
447
/**
448
 * Class Requirement_WP_Cron_Test_Response
449
 */
450
class Requirement_WP_Cron_Test extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
451
452
	/**
453
	 * @var string
454
	 */
455
	var $name = 'WP Cron Test Failed';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
456
457
	/**
458
	 * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
459
	 */
460
	public static function test() {
461
		return (bool) get_option( 'hmbkp_wp_cron_test_failed' );
462
	}
463
}
464
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_Cron_Test', 'Site' );
465
466
/**
467
 * Class Requirement_PHP_API
468
 */
469
class Requirement_PHP_API extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
470
471
	/**
472
	 * @var string
473
	 */
474
	var $name = 'Interface';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
475
476
	/**
477
	 * @return string
478
	 */
479
	public static function test() {
480
		return php_sapi_name();
481
	}
482
}
483
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_API', 'PHP' );
484
485
/**
486
 * Class Requirement_Server_Software
487
 */
488
class Requirement_Server_Software extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
489
490
	/**
491
	 * @var string
492
	 */
493
	var $name = 'Server';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
494
495
	/**
496
	 * @return bool
497
	 */
498
	public static function test() {
1 ignored issue
show
Coding Style introduced by
test uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
499
500
		if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
501
			return $_SERVER['SERVER_SOFTWARE'];
502
		}
503
504
		return false;
505
506
	}
507
}
508
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_Software', 'Server' );
509
510
/**
511
 * Class Requirement_Server_OS
512
 */
513
class Requirement_Server_OS extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
514
515
	/**
516
	 * @var string
517
	 */
518
	var $name = 'OS';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
519
520
	/**
521
	 * @return string
522
	 */
523
	public static function test() {
524
		return PHP_OS;
525
	}
526
}
527
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_OS', 'Server' );
528
529
/**
530
 * Class Requirement_PHP_Disable_Functions
531
 */
532
class Requirement_PHP_Disable_Functions extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
533
534
	/**
535
	 * @var string
536
	 */
537
	var $name = 'Disabled Functions';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
538
539
	/**
540
	 * @return string
541
	 */
542
	public static function test() {
543
		return @ini_get( 'disable_functions' );
544
	}
545
}
546
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Disable_Functions', 'PHP' );
547
548
/**
549
 * Class Requirement_PHP_Open_Basedir
550
 */
551
class Requirement_PHP_Open_Basedir extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
552
553
	/**
554
	 * @var string
555
	 */
556
	var $name = 'open_basedir';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
557
558
	/**
559
	 * @return string
560
	 */
561
	public static function test() {
562
		return @ini_get( 'open_basedir' );
563
	}
564
}
565
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Open_Basedir', 'PHP' );
566
567
/* CONSTANTS */
568
569
/**
570
 * Class Requirement_Define_HMBKP_PATH
571
 */
572
class Requirement_Define_HMBKP_PATH extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
573
574
	/**
575
	 * @var string
576
	 */
577
	var $name = 'HMBKP_PATH';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
578
579
	/**
580
	 * @return string
581
	 */
582
	public static function test() {
583
		return defined( 'HMBKP_PATH' ) ? HMBKP_PATH : '';
584
	}
585
}
586
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_PATH', 'constants' );
587
588
/**
589
 * Class Requirement_Define_HMBKP_ROOT
590
 */
591
class Requirement_Define_HMBKP_ROOT extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
592
593
	/**
594
	 * @var string
595
	 */
596
	var $name = 'HMBKP_ROOT';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
597
598
	/**
599
	 * @return string
600
	 */
601
	public static function test() {
602
		return defined( 'HMBKP_ROOT' ) ? HMBKP_ROOT : '';
603
	}
604
}
605
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ROOT', 'constants' );
606
607
/**
608
 * Class Requirement_Define_HMBKP_MYSQLDUMP_PATH
609
 */
610
class Requirement_Define_HMBKP_MYSQLDUMP_PATH extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
611
612
	/**
613
	 * @var string
614
	 */
615
	var $name = 'HMBKP_MYSQLDUMP_PATH';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
616
617
	/**
618
	 * @return string
619
	 */
620
	public static function test() {
621
		return defined( 'HMBKP_MYSQLDUMP_PATH' ) ? HMBKP_MYSQLDUMP_PATH : '';
622
	}
623
}
624
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_MYSQLDUMP_PATH', 'constants' );
625
626
/**
627
 * Class Requirement_Define_HMBKP_ZIP_PATH
628
 */
629
class Requirement_Define_HMBKP_ZIP_PATH extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
630
631
	/**
632
	 * @var string
633
	 */
634
	var $name = 'HMBKP_ZIP_PATH';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
635
636
	/**
637
	 * @return string
638
	 */
639
	public static function test() {
640
		return defined( 'HMBKP_ZIP_PATH' ) ? HMBKP_ZIP_PATH : '';
641
	}
642
}
643
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ZIP_PATH', 'constants' );
644
645
/**
646
 * Class Requirement_Define_HMBKP_CAPABILITY
647
 */
648
class Requirement_Define_HMBKP_CAPABILITY extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
649
650
	/**
651
	 * @var string
652
	 */
653
	var $name = 'HMBKP_CAPABILITY';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
654
655
	/**
656
	 * @return string
657
	 */
658
	public static function test() {
659
		return defined( 'HMBKP_CAPABILITY' ) ? HMBKP_CAPABILITY : '';
660
	}
661
}
662
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_CAPABILITY', 'constants' );
663
664
/**
665
 * Class Requirement_Define_HMBKP_EMAIL
666
 */
667
class Requirement_Define_HMBKP_EMAIL extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
668
669
	/**
670
	 * @var string
671
	 */
672
	var $name = 'HMBKP_EMAIL';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
673
674
	/**
675
	 * @return string
676
	 */
677
	public static function test() {
678
		return defined( 'HMBKP_EMAIL' ) ? HMBKP_EMAIL : '';
679
	}
680
}
681
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EMAIL', 'constants' );
682
683
/**
684
 * Class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE
685
 */
686
class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
687
688
	/**
689
	 * @var string
690
	 */
691
	var $name = 'HMBKP_ATTACHMENT_MAX_FILESIZE';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
692
693
	/**
694
	 * @return string
695
	 */
696
	public static function test() {
697
		return defined( 'HMBKP_ATTACHMENT_MAX_FILESIZE' ) ? HMBKP_ATTACHMENT_MAX_FILESIZE : '';
698
	}
699
}
700
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE', 'constants' );
701
702
/**
703
 * Class Requirement_Define_HMBKP_EXCLUDE
704
 */
705
class Requirement_Define_HMBKP_EXCLUDE extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
706
707
	/**
708
	 * @var string
709
	 */
710
	var $name = 'HMBKP_EXCLUDE';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
711
712
	/**
713
	 * @return string
714
	 */
715
	public static function test() {
716
		return defined( 'HMBKP_EXCLUDE' ) ? HMBKP_EXCLUDE : '';
717
	}
718
}
719
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EXCLUDE', 'constants' );
720
721
class Requirement_Active_Plugins extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
722
723
	var $name = 'Active Plugins';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
724
725
	public static function test() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
726
		return get_option( 'active_plugins' );
727
	}
728
}
729
Requirements::register( 'HM\BackUpWordPress\Requirement_Active_Plugins', 'Site' );
730
731
class Requirement_Home_Url extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
732
733
	var $name = 'Home URL';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
734
735
	public static function test() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
736
		return home_url();
737
	}
738
}
739
Requirements::register( 'HM\BackUpWordPress\Requirement_Home_Url', 'Site' );
740
741
class Requirement_Site_Url extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
742
743
	var $name = 'Site URL';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
744
745
	public static function test() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
746
		return site_url();
747
	}
748
}
749
Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' );
750
751
class Requirement_Plugin_Version extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
752
	var $name = 'Plugin Version';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
753
754
	public static function test() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
755
		return Plugin::PLUGIN_VERSION;
756
	}
757
}
758
Requirements::register( 'HM\BackUpWordPress\Requirement_Plugin_Version', 'constants' );
759
760
class Requirement_Max_Exec extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
761
762
	var $name = 'Max execution time';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
763
764
	public static function test() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
765
		return @ini_get( 'max_execution_time' );
766
	}
767
}
768
Requirements::register( 'HM\BackUpWordPress\Requirement_Max_Exec', 'PHP' );
769
770
class Requirement_PDO extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
771
772
	var $name = 'PDO';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
773
774
	public static function test() {
775
776
		if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) {
777
			return implode( ', ', \PDO::getAvailableDrivers() );
778
		}
779
780
		return false;
781
782
	}
783
}
784
785
Requirements::register( 'HM\BackUpWordPress\Requirement_PDO', 'PHP' );
786
787
/**
788
 * Class Requirement_Proc_Open
789
 */
790
class Requirement_Proc_Open extends Requirement {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
791
792
	/**
793
	 * @var string
794
	 */
795
	var $name = 'proc_open';
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $name.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
796
797
	/**
798
	 * @return bool
799
	 */
800
	public static function test() {
801
		return function_exists( 'proc_open' );
802
	}
803
}
804
Requirements::register( 'HM\BackUpWordPress\Requirement_Proc_Open', 'PHP' );
805