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_PHP_User   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A Requirement_PHP_Version::test() 0 3 1
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
		if ( is_bool( $test ) || empty( $test ) ) {
39
40
			if ( $test ) {
41
				return 'Yes';
42
			}
43
44
			return 'No';
45
46
		}
47
48
		return var_export( $test, true );
49
50
	}
51
52
	public function raw_result() {
53
		return $this->test();
54
	}
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
}
82
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Archive', 'PHP' );
83
84
/**
85
 * Class Requirement_Directory_Iterator_Follow_Symlinks
86
 *
87
 * Tests whether the FOLLOW_SYMLINKS class constant is available on Directory Iterator
88
 */
89
class Requirement_Directory_Iterator_Follow_Symlinks 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...
90
91
	/**
92
	 * @var string
93
	 */
94
	var $name = 'DirectoryIterator FOLLOW_SYMLINKS';
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...
95
96
	/**
97
	 * @return bool
98
	 */
99
	public static function test() {
100
101
		if ( defined( 'RecursiveDirectoryIterator::FOLLOW_SYMLINKS' ) ) {
1 ignored issue
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return defined('Recursiv...tor::FOLLOW_SYMLINKS');.
Loading history...
102
			return true;
103
		}
104
105
		return false;
106
107
	}
108
109
}
110
Requirements::register( 'HM\BackUpWordPress\Requirement_Directory_Iterator_Follow_Symlinks', 'PHP' );
111
112
/**
113
 * Class Requirement_Zip_Command
114
 *
115
 * Tests whether the zip command is available and if it is what path it's available at
116
 */
117
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...
118
119
	/**
120
	 * @var string
121
	 */
122
	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...
123
124
	/**
125
	 * @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...
126
	 */
127
	public static function test() {
128
129
		$backup = new Zip_File_Backup_Engine;
130
131
		return $backup->get_zip_executable_path();
132
133
	}
134
135
}
136
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Command_Path', 'Server' );
137
138
/**
139
 * Class Requirement_Mysqldump_Command
140
 *
141
 * Tests whether the zip command is available and if it is what path it's available at
142
 */
143
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...
144
145
	/**
146
	 * @var string
147
	 */
148
	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...
149
150
	/**
151
	 * @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...
152
	 */
153
	public static function test() {
154
155
		$backup = new Mysqldump_Database_Backup_Engine;
156
157
		return $backup->get_mysqldump_executable_path();
158
159
	}
160
161
}
162
Requirements::register( 'HM\BackUpWordPress\Requirement_Mysqldump_Command_Path', 'Server' );
163
164
/**
165
 * Class Requirement_PHP_Version
166
 */
167
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...
168
169
	/**
170
	 * @var string
171
	 */
172
	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...
173
174
	/**
175
	 * @return string
176
	 */
177
	public static function test() {
178
		return PHP_VERSION;
179
	}
180
181
}
182
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Version', 'PHP' );
183
184
/**
185
 * Class Requirement_Cron_Array
186
 */
187
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...
188
189
	/**
190
	 * @var string
191
	 */
192
	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...
193
194
	/**
195
	 * @return bool|mixed
196
	 */
197
	public static function test() {
198
199
		$cron = get_option( 'cron' );
200
201
		if ( ! $cron ) {
202
			return false;
203
		}
204
205
		return $cron;
206
207
	}
208
209
}
210
Requirements::register( 'HM\BackUpWordPress\Requirement_Cron_Array', 'Site' );
211
212
/**
213
 * Class Requirement_Cron_Array
214
 */
215
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...
216
217
	/**
218
	 * @var string
219
	 */
220
	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...
221
222
	/**
223
	 * @return bool|mixed
224
	 */
225
	public static function test() {
226
227
		// Since 4.0
228
		$language = get_option( 'WPLANG' );
229
230
		if ( $language ) {
231
			return $language;
232
		}
233
234
		if ( defined( 'WPLANG' ) && WPLANG ) {
235
			return WPLANG;
236
		}
237
238
		return 'en_US';
239
240
	}
241
242
}
243
Requirements::register( 'HM\BackUpWordPress\Requirement_Language', 'Site' );
244
245
/**
246
 * Class Requirement_Safe_Mode
247
 */
248
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...
249
250
	/**
251
	 * @var string
252
	 */
253
	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...
254
255
	/**
256
	 * @return bool
257
	 */
258
	public static function test() {
259
		return Backup_Utilities::is_safe_mode_on();
260
	}
261
262
}
263
Requirements::register( 'HM\BackUpWordPress\Requirement_Safe_Mode', 'PHP' );
264
265
/**
266
 * Class Requirement_Shell_Exec
267
 */
268
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...
269
270
	/**
271
	 * @var string
272
	 */
273
	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...
274
275
	/**
276
	 * @return bool
277
	 */
278
	public static function test() {
279
		return function_exists( 'proc_open' );
280
	}
281
282
}
283
Requirements::register( 'HM\BackUpWordPress\Requirement_Proc_Open', 'PHP' );
284
285
/**
286
 * Class Requirement_Memory_Limit
287
 */
288
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...
289
290
	/**
291
	 * @var string
292
	 */
293
	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...
294
295
	/**
296
	 * @return string
297
	 */
298
	public static function test() {
299
		return @ini_get( 'memory_limit' );
300
	}
301
302
}
303
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Memory_Limit', 'PHP' );
304
305
/**
306
 * Class Requirement_Backup_Path
307
 */
308
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...
309
310
	/**
311
	 * @var string
312
	 */
313
	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...
314
315
	/**
316
	 * @return string
317
	 */
318
	public static function test() {
319
		return Path::get_path();
320
	}
321
322
}
323
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path', 'Site' );
324
325
/**
326
 * Class Requirement_Backup_Path_Permissions
327
 */
328
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...
329
330
	/**
331
	 * @var string
332
	 */
333
	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...
334
335
	/**
336
	 * @return string
337
	 */
338
	public static function test() {
339
		return substr( sprintf( '%o', fileperms( Path::get_path() ) ), - 4 );
340
	}
341
342
}
343
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path_Permissions', 'Site' );
344
345
/**
346
 * Class Requirement_WP_CONTENT_DIR
347
 */
348
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...
349
350
	/**
351
	 * @var string
352
	 */
353
	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...
354
355
	/**
356
	 * @return string
357
	 */
358
	public static function test() {
359
		return WP_CONTENT_DIR;
360
	}
361
362
}
363
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR', 'Site' );
364
365
/**
366
 * Class Requirement_WP_CONTENT_DIR_Permissions
367
 */
368
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...
369
370
	/**
371
	 * @var string
372
	 */
373
	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...
374
375
	/**
376
	 * @return string
377
	 */
378
	public static function test() {
379
		return substr( sprintf( '%o', fileperms( WP_CONTENT_DIR ) ), - 4 );
380
	}
381
382
}
383
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR_Permissions', 'Site' );
384
385
/**
386
 * Class Requirement_ABSPATH
387
 */
388
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...
389
390
	/**
391
	 * @var string
392
	 */
393
	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...
394
395
	/**
396
	 * @return string
397
	 */
398
	public static function test() {
399
		return ABSPATH;
400
	}
401
402
}
403
Requirements::register( 'HM\BackUpWordPress\Requirement_ABSPATH', 'Site' );
404
405
/**
406
 * Class Requirement_Backup_Root_Path
407
 */
408
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...
409
410
	/**
411
	 * @var string
412
	 */
413
	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...
414
415
	/**
416
	 * @return string
417
	 */
418
	public static function test() {
419
		return Path::get_root();
420
	}
421
422
}
423
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Root_Path', 'Site' );
424
425
/**
426
 * Class Requirement_Calculated_Size
427
 */
428
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...
429
430
	/**
431
	 * @var string
432
	 */
433
	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...
434
435
	/**
436
	 * @return array
437
	 */
438
	public static function test() {
439
440
		$backup_sizes = array();
441
442
		$schedules = Schedules::get_instance();
443
444
		foreach ( $schedules->get_schedules() as $schedule ) {
445
446
			$site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
447
448
			if ( $site_size->is_site_size_cached() ) {
449
				$backup_sizes[ $schedule->get_type() ] = $site_size->get_formatted_site_size();
450
			}
451
452
		}
453
454
		return $backup_sizes;
455
456
	}
457
458
}
459
Requirements::register( 'HM\BackUpWordPress\Requirement_Calculated_Size', 'Site' );
460
461
/**
462
 * Class Requirement_WP_Cron_Test_Response
463
 */
464
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...
465
466
	/**
467
	 * @var string
468
	 */
469
	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...
470
471
	/**
472
	 * @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...
473
	 */
474
	public static function test() {
475
		return (bool) get_option( 'hmbkp_wp_cron_test_failed' );
476
	}
477
478
}
479
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_Cron_Test', 'Site' );
480
481
/**
482
 * Class Requirement_PHP_API
483
 */
484
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...
485
486
	/**
487
	 * @var string
488
	 */
489
	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...
490
491
	/**
492
	 * @return string
493
	 */
494
	public static function test() {
495
		return php_sapi_name();
496
	}
497
498
}
499
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_API', 'PHP' );
500
501
/**
502
 * Class Requirement_Server_Software
503
 */
504
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...
505
506
	/**
507
	 * @var string
508
	 */
509
	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...
510
511
	/**
512
	 * @return bool
513
	 */
514
	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...
515
516
		if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) )
517
			return $_SERVER['SERVER_SOFTWARE'];
518
519
		return false;
520
521
	}
522
523
}
524
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_Software', 'Server' );
525
526
/**
527
 * Class Requirement_Server_OS
528
 */
529
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...
530
531
	/**
532
	 * @var string
533
	 */
534
	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...
535
536
	/**
537
	 * @return string
538
	 */
539
	public static function test() {
540
		return PHP_OS;
541
	}
542
543
}
544
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_OS', 'Server' );
545
546
/**
547
 * Class Requirement_PHP_Disable_Functions
548
 */
549
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...
550
551
	/**
552
	 * @var string
553
	 */
554
	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...
555
556
	/**
557
	 * @return string
558
	 */
559
	public static function test() {
560
		return @ini_get( 'disable_functions' );
561
	}
562
563
}
564
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Disable_Functions', 'PHP' );
565
566
/**
567
 * Class Requirement_PHP_Open_Basedir
568
 */
569
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...
570
571
	/**
572
	 * @var string
573
	 */
574
	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...
575
576
	/**
577
	 * @return string
578
	 */
579
	public static function test() {
580
		return @ini_get( 'open_basedir' );
581
	}
582
583
}
584
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Open_Basedir', 'PHP' );
585
586
/* CONSTANTS */
587
588
/**
589
 * Class Requirement_Define_HMBKP_PATH
590
 */
591
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...
592
593
	/**
594
	 * @var string
595
	 */
596
	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...
597
598
	/**
599
	 * @return string
600
	 */
601
	public static function test() {
602
		return defined( 'HMBKP_PATH' ) ? HMBKP_PATH : '';
603
	}
604
605
}
606
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_PATH', 'constants' );
607
608
/**
609
 * Class Requirement_Define_HMBKP_ROOT
610
 */
611
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...
612
613
	/**
614
	 * @var string
615
	 */
616
	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...
617
618
	/**
619
	 * @return string
620
	 */
621
	public static function test() {
622
		return defined( 'HMBKP_ROOT' ) ? HMBKP_ROOT : '';
623
	}
624
625
}
626
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ROOT', 'constants' );
627
628
/**
629
 * Class Requirement_Define_HMBKP_MYSQLDUMP_PATH
630
 */
631
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...
632
633
	/**
634
	 * @var string
635
	 */
636
	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...
637
638
	/**
639
	 * @return string
640
	 */
641
	public static function test() {
642
		return defined( 'HMBKP_MYSQLDUMP_PATH' ) ? HMBKP_MYSQLDUMP_PATH : '';
643
	}
644
645
}
646
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_MYSQLDUMP_PATH', 'constants' );
647
648
/**
649
 * Class Requirement_Define_HMBKP_ZIP_PATH
650
 */
651
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...
652
653
	/**
654
	 * @var string
655
	 */
656
	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...
657
658
	/**
659
	 * @return string
660
	 */
661
	public static function test() {
662
		return defined( 'HMBKP_ZIP_PATH' ) ? HMBKP_ZIP_PATH : '';
663
	}
664
665
}
666
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ZIP_PATH', 'constants' );
667
668
/**
669
 * Class Requirement_Define_HMBKP_CAPABILITY
670
 */
671
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...
672
673
	/**
674
	 * @var string
675
	 */
676
	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...
677
678
	/**
679
	 * @return string
680
	 */
681
	public static function test() {
682
		return defined( 'HMBKP_CAPABILITY' ) ? HMBKP_CAPABILITY : '';
683
	}
684
685
}
686
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_CAPABILITY', 'constants' );
687
688
/**
689
 * Class Requirement_Define_HMBKP_EMAIL
690
 */
691
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...
692
693
	/**
694
	 * @var string
695
	 */
696
	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...
697
698
	/**
699
	 * @return string
700
	 */
701
	public static function test() {
702
		return defined( 'HMBKP_EMAIL' ) ? HMBKP_EMAIL : '';
703
	}
704
705
}
706
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EMAIL', 'constants' );
707
708
/**
709
 * Class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE
710
 */
711
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...
712
713
	/**
714
	 * @var string
715
	 */
716
	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...
717
718
	/**
719
	 * @return string
720
	 */
721
	public static function test() {
722
		return defined( 'HMBKP_ATTACHMENT_MAX_FILESIZE' ) ? HMBKP_ATTACHMENT_MAX_FILESIZE : '';
723
	}
724
725
}
726
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE', 'constants' );
727
728
/**
729
 * Class Requirement_Define_HMBKP_EXCLUDE
730
 */
731
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...
732
733
	/**
734
	 * @var string
735
	 */
736
	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...
737
738
	/**
739
	 * @return string
740
	 */
741
	public static function test() {
742
		return defined( 'HMBKP_EXCLUDE' ) ? HMBKP_EXCLUDE : '';
743
	}
744
745
}
746
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EXCLUDE', 'constants' );
747
748
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...
749
750
	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...
751
752
	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...
753
		return get_option( 'active_plugins' );
754
	}
755
756
}
757
Requirements::register( 'HM\BackUpWordPress\Requirement_Active_Plugins', 'Site' );
758
759
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...
760
761
	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...
762
763
	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...
764
		return home_url();
765
	}
766
767
}
768
Requirements::register( 'HM\BackUpWordPress\Requirement_Home_Url', 'Site' );
769
770
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...
771
772
	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...
773
774
	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...
775
		return site_url();
776
	}
777
778
}
779
Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' );
780
781
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...
782
	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...
783
784
	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...
785
		return Plugin::PLUGIN_VERSION;
786
	}
787
}
788
Requirements::register( 'HM\BackUpWordPress\Requirement_Plugin_Version', 'constants' );
789
790
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...
791
792
	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...
793
794
	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...
795
		return @ini_get( 'max_execution_time' );
796
	}
797
}
798
Requirements::register( 'HM\BackUpWordPress\Requirement_Max_Exec', 'PHP' );
799
800
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...
801
802
	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...
803
804
	public static function test() {
805
806
		if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) {
807
			return implode( ', ', \PDO::getAvailableDrivers() );
808
		}
809
810
		return false;
811
812
	}
813
}
814
Requirements::register( 'HM\BackUpWordPress\Requirement_PDO', 'PHP' );
815