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.

Requirements::get_requirement_groups()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace HM\BackUpWordPress;
4
5
/**
6
 * A singleton to handle the registering, unregistering
7
 * and storage of individual requirements
8
 */
9
class Requirements {
10
11
	/**
12
	 * The array of requirements
13
	 *
14
	 * Should be of the format array( (string) group => __CLASS__ );
15
	 * @var array
16
	 */
17
	private static $requirements = array();
18
19
20
	/**
21
	 * Get the array of registered requirements
22
	 *
23
	 * @param bool $group
24
	 * @return array
25
	 */
26
	public static function get_requirements( $group = false ) {
27
28
		$requirements = $group ? self::$requirements[ $group ] : self::$requirements;
29
30
		ksort( $requirements );
31
32
		return array_map( array( 'self', 'instantiate' ), $requirements );
33
34
	}
35
36
	/**
37
	 * Get the requirement groups
38
	 *
39
	 * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<integer|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...
40
	 */
41
	public static function get_requirement_groups() {
42
		return array_keys( self::$requirements );
43
	}
44
45
	/**
46
	 * Register a new requirement
47
	 *
48
	 * @param        $class
49
	 * @param string $group
50
	 * @return WP_Error
0 ignored issues
show
Documentation introduced by
Should the return type not be WP_Error|null?

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...
51
	 */
52
	public static function register( $class, $group = 'misc' ) {
53
		self::$requirements[ $group ][] = $class;
54
	}
55
56
	/**
57
	 * Instantiate the individual requirement classes
58
	 *
59
	 * @access private
60
	 * @param string $class
61
	 * @return array An array of instantiated classes
62
	 */
63
	private static function instantiate( $class ) {
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
64
65
		$$class = new $class;
66
67
		return $$class;
68
69
	}
70
}
71