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
03:12
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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
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
>>>>>>> master
185
 * Class Requirement_PHP_Version
186
 */
187
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...
188
189
	/**
190
	 * @var string
191
	 */
192
	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...
193
194
	/**
195
	 * @return string
196
	 */
197
	public static function test() {
198
		return PHP_VERSION;
199
	}
200
}
201
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Version', 'PHP' );
202
203
/**
204
 * Class Requirement_Cron_Array
205
 */
206
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...
207
208
	/**
209
	 * @var string
210
	 */
211
	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...
212
213
	/**
214
	 * @return bool|mixed
215
	 */
216
	public static function test() {
217
218
		$cron = get_option( 'cron' );
219
220
		if ( ! $cron ) {
221
			return false;
222
		}
223
224
		return $cron;
225
226
	}
227
}
228
Requirements::register( 'HM\BackUpWordPress\Requirement_Cron_Array', 'Site' );
229
230
/**
231
 * Class Requirement_Cron_Array
232
 */
233
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...
234
235
	/**
236
	 * @var string
237
	 */
238
	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...
239
240
	/**
241
	 * @return bool|mixed
242
	 */
243
	public static function test() {
244
245
		// Since 4.0
246
		$language = get_option( 'WPLANG' );
247
248
		if ( $language ) {
249
			return $language;
250
		}
251
252
		if ( defined( 'WPLANG' ) && WPLANG ) {
253
			return WPLANG;
254
		}
255
256
		return 'en_US';
257
258
	}
259
}
260
Requirements::register( 'HM\BackUpWordPress\Requirement_Language', 'Site' );
261
262
/**
263
 * Class Requirement_Safe_Mode
264
 */
265
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...
266
267
	/**
268
	 * @var string
269
	 */
270
	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...
271
272
	/**
273
	 * @return bool
274
	 */
275
	public static function test() {
276
		return Backup_Utilities::is_safe_mode_on();
277
	}
278
}
279
Requirements::register( 'HM\BackUpWordPress\Requirement_Safe_Mode', 'PHP' );
280
281
/**
282
 * Class Requirement_Shell_Exec
283
 */
284
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...
285
286
	/**
287
	 * @var string
288
	 */
289
	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...
290
291
	/**
292
	 * @return bool
293
	 */
294
	public static function test() {
295
		return function_exists( 'proc_open' );
296
	}
297
}
298
Requirements::register( 'HM\BackUpWordPress\Requirement_Proc_Open', 'PHP' );
299
300
/**
301
 * Class Requirement_Memory_Limit
302
 */
303
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...
304
305
	/**
306
	 * @var string
307
	 */
308
	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...
309
310
	/**
311
	 * @return string
312
	 */
313
	public static function test() {
314
		return @ini_get( 'memory_limit' );
315
	}
316
}
317
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Memory_Limit', 'PHP' );
318
319
/**
320
 * Class Requirement_Backup_Path
321
 */
322
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...
323
324
	/**
325
	 * @var string
326
	 */
327
	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...
328
329
	/**
330
	 * @return string
331
	 */
332
	public static function test() {
333
		return Path::get_path();
334
	}
335
}
336
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path', 'Site' );
337
338
/**
339
 * Class Requirement_Backup_Path_Permissions
340
 */
341
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...
342
343
	/**
344
	 * @var string
345
	 */
346
	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...
347
348
	/**
349
	 * @return string
350
	 */
351
	public static function test() {
352
		return substr( sprintf( '%o', fileperms( Path::get_path() ) ), - 4 );
353
	}
354
}
355
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path_Permissions', 'Site' );
356
357
/**
358
 * Class Requirement_WP_CONTENT_DIR
359
 */
360
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...
361
362
	/**
363
	 * @var string
364
	 */
365
	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...
366
367
	/**
368
	 * @return string
369
	 */
370
	public static function test() {
371
		return WP_CONTENT_DIR;
372
	}
373
}
374
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR', 'Site' );
375
376
/**
377
 * Class Requirement_WP_CONTENT_DIR_Permissions
378
 */
379
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...
380
381
	/**
382
	 * @var string
383
	 */
384
	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...
385
386
	/**
387
	 * @return string
388
	 */
389
	public static function test() {
390
		return substr( sprintf( '%o', fileperms( WP_CONTENT_DIR ) ), - 4 );
391
	}
392
}
393
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR_Permissions', 'Site' );
394
395
/**
396
 * Class Requirement_ABSPATH
397
 */
398
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...
399
400
	/**
401
	 * @var string
402
	 */
403
	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...
404
405
	/**
406
	 * @return string
407
	 */
408
	public static function test() {
409
		return ABSPATH;
410
	}
411
}
412
Requirements::register( 'HM\BackUpWordPress\Requirement_ABSPATH', 'Site' );
413
414
/**
415
 * Class Requirement_Backup_Root_Path
416
 */
417
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...
418
419
	/**
420
	 * @var string
421
	 */
422
	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...
423
424
	/**
425
	 * @return string
426
	 */
427
	public static function test() {
428
		return Path::get_root();
429
	}
430
}
431
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Root_Path', 'Site' );
432
433
/**
434
 * Class Requirement_Calculated_Size
435
 */
436
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...
437
438
	/**
439
	 * @var string
440
	 */
441
	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...
442
443
	/**
444
	 * @return array
445
	 */
446
	public static function test() {
447
448
		$backup_sizes = array();
449
450
		$schedules = Schedules::get_instance();
451
452
		foreach ( $schedules->get_schedules() as $schedule ) {
453
454
			$site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
455
456
			if ( $site_size->is_site_size_cached() ) {
457
				$backup_sizes[ $schedule->get_type() ] = $site_size->get_formatted_site_size();
458
			}
459
		}
460
461
		return $backup_sizes;
462
463
	}
464
}
465
Requirements::register( 'HM\BackUpWordPress\Requirement_Calculated_Size', 'Site' );
466
467
/**
468
 * Class Requirement_WP_Cron_Test_Response
469
 */
470
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...
471
472
	/**
473
	 * @var string
474
	 */
475
	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...
476
477
	/**
478
	 * @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...
479
	 */
480
	public static function test() {
481
		return (bool) get_option( 'hmbkp_wp_cron_test_failed' );
482
	}
483
}
484
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_Cron_Test', 'Site' );
485
486
/**
487
 * Class Requirement_PHP_API
488
 */
489
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...
490
491
	/**
492
	 * @var string
493
	 */
494
	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...
495
496
	/**
497
	 * @return string
498
	 */
499
	public static function test() {
500
		return php_sapi_name();
501
	}
502
}
503
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_API', 'PHP' );
504
505
/**
506
 * Class Requirement_Server_Software
507
 */
508
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...
509
510
	/**
511
	 * @var string
512
	 */
513
	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...
514
515
	/**
516
	 * @return bool
517
	 */
518
	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...
519
520
		if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
521
			return $_SERVER['SERVER_SOFTWARE'];
522
		}
523
524
		return false;
525
526
	}
527
}
528
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_Software', 'Server' );
529
530
/**
531
 * Class Requirement_Server_OS
532
 */
533
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...
534
535
	/**
536
	 * @var string
537
	 */
538
	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...
539
540
	/**
541
	 * @return string
542
	 */
543
	public static function test() {
544
		return PHP_OS;
545
	}
546
}
547
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_OS', 'Server' );
548
549
/**
550
 * Class Requirement_PHP_Disable_Functions
551
 */
552
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...
553
554
	/**
555
	 * @var string
556
	 */
557
	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...
558
559
	/**
560
	 * @return string
561
	 */
562
	public static function test() {
563
		return @ini_get( 'disable_functions' );
564
	}
565
}
566
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Disable_Functions', 'PHP' );
567
568
/**
569
 * Class Requirement_PHP_Open_Basedir
570
 */
571
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...
572
573
	/**
574
	 * @var string
575
	 */
576
	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...
577
578
	/**
579
	 * @return string
580
	 */
581
	public static function test() {
582
		return @ini_get( 'open_basedir' );
583
	}
584
}
585
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Open_Basedir', 'PHP' );
586
587
/* CONSTANTS */
588
589
/**
590
 * Class Requirement_Define_HMBKP_PATH
591
 */
592
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...
593
594
	/**
595
	 * @var string
596
	 */
597
	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...
598
599
	/**
600
	 * @return string
601
	 */
602
	public static function test() {
603
		return defined( 'HMBKP_PATH' ) ? HMBKP_PATH : '';
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
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ROOT', 'constants' );
626
627
/**
628
 * Class Requirement_Define_HMBKP_MYSQLDUMP_PATH
629
 */
630
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...
631
632
	/**
633
	 * @var string
634
	 */
635
	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...
636
637
	/**
638
	 * @return string
639
	 */
640
	public static function test() {
641
		return defined( 'HMBKP_MYSQLDUMP_PATH' ) ? HMBKP_MYSQLDUMP_PATH : '';
642
	}
643
}
644
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_MYSQLDUMP_PATH', 'constants' );
645
646
/**
647
 * Class Requirement_Define_HMBKP_ZIP_PATH
648
 */
649
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...
650
651
	/**
652
	 * @var string
653
	 */
654
	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...
655
656
	/**
657
	 * @return string
658
	 */
659
	public static function test() {
660
		return defined( 'HMBKP_ZIP_PATH' ) ? HMBKP_ZIP_PATH : '';
661
	}
662
}
663
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ZIP_PATH', 'constants' );
664
665
/**
666
 * Class Requirement_Define_HMBKP_CAPABILITY
667
 */
668
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...
669
670
	/**
671
	 * @var string
672
	 */
673
	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...
674
675
	/**
676
	 * @return string
677
	 */
678
	public static function test() {
679
		return defined( 'HMBKP_CAPABILITY' ) ? HMBKP_CAPABILITY : '';
680
	}
681
}
682
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_CAPABILITY', 'constants' );
683
684
/**
685
 * Class Requirement_Define_HMBKP_EMAIL
686
 */
687
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...
688
689
	/**
690
	 * @var string
691
	 */
692
	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...
693
694
	/**
695
	 * @return string
696
	 */
697
	public static function test() {
698
		return defined( 'HMBKP_EMAIL' ) ? HMBKP_EMAIL : '';
699
	}
700
}
701
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EMAIL', 'constants' );
702
703
/**
704
 * Class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE
705
 */
706
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...
707
708
	/**
709
	 * @var string
710
	 */
711
	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...
712
713
	/**
714
	 * @return string
715
	 */
716
	public static function test() {
717
		return defined( 'HMBKP_ATTACHMENT_MAX_FILESIZE' ) ? HMBKP_ATTACHMENT_MAX_FILESIZE : '';
718
	}
719
}
720
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE', 'constants' );
721
722
/**
723
 * Class Requirement_Define_HMBKP_EXCLUDE
724
 */
725
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...
726
727
	/**
728
	 * @var string
729
	 */
730
	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...
731
732
	/**
733
	 * @return string
734
	 */
735
	public static function test() {
736
		return defined( 'HMBKP_EXCLUDE' ) ? HMBKP_EXCLUDE : '';
737
	}
738
}
739
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EXCLUDE', 'constants' );
740
741
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...
742
743
	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...
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 get_option( 'active_plugins' );
747
	}
748
}
749
Requirements::register( 'HM\BackUpWordPress\Requirement_Active_Plugins', 'Site' );
750
751
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...
752
753
	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...
754
755
	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...
756
		return home_url();
757
	}
758
}
759
Requirements::register( 'HM\BackUpWordPress\Requirement_Home_Url', 'Site' );
760
761
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...
762
763
	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...
764
765
	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...
766
		return site_url();
767
	}
768
}
769
Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' );
770
771
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...
772
	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...
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 Plugin::PLUGIN_VERSION;
776
	}
777
}
778
Requirements::register( 'HM\BackUpWordPress\Requirement_Plugin_Version', 'constants' );
779
780
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...
781
782
	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...
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 @ini_get( 'max_execution_time' );
786
	}
787
}
788
Requirements::register( 'HM\BackUpWordPress\Requirement_Max_Exec', 'PHP' );
789
790
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...
791
792
	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...
793
794
	public static function test() {
795
796
		if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) {
797
			return implode( ', ', \PDO::getAvailableDrivers() );
798
		}
799
800
		return false;
801
802
	}
803
}
804
Requirements::register( 'HM\BackUpWordPress\Requirement_PDO', 'PHP' );
805