Passed
Push — master ( dd1fbc...6aef8a )
by Daimona
01:29
created

PageBotList   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAdminsList() 0 2 1
A __construct() 0 2 1
A get() 0 6 2
1
<?php declare( strict_types=1 );
2
3
namespace BotRiconferme\Page;
4
5
use BotRiconferme\Config;
6
use BotRiconferme\Page\Page;
7
8
/**
9
 * Singleton class representing the JSON list of admins
10
 */
11
class PageBotList extends Page {
12
	/**
13
	 * @private Use self::get()
14
	 */
15
	public function __construct() {
16
		parent::__construct( Config::getInstance()->get( 'list-title' ) );
17
	}
18
19
	/**
20
	 * Instance getter
21
	 *
22
	 * @return self
23
	 */
24
	public static function get() : self {
25
		static $instance = null;
26
		if ( $instance = null ) {
27
			$instance = new self;
28
		}
29
		return $instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $instance could return the type null which is incompatible with the type-hinted return BotRiconferme\Page\PageBotList. Consider adding an additional type-check to rule them out.
Loading history...
30
	}
31
32
	/**
33
	 * Get the actual list of admins
34
	 *
35
	 * @return array[]
36
	 */
37
	public function getAdminsList() : array {
38
		return json_decode( $this->getContent(), true );
39
	}
40
}
41