Passed
Push — master ( df8555...a1b33e )
by Daimona
02:22 queued 28s
created

PageBotList::getAdminsList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php declare( strict_types=1 );
2
3
namespace BotRiconferme\Wiki\Page;
4
5
use BotRiconferme\Config;
6
7
/**
8
 * Singleton class representing the JSON list of admins
9
 */
10
class PageBotList extends Page {
11
	/**
12
	 * @private Use self::get()
13
	 */
14
	public function __construct() {
15
		parent::__construct( Config::getInstance()->get( 'list-title' ) );
16
	}
17
18
	/**
19
	 * Instance getter
20
	 *
21
	 * @return self
22
	 */
23
	public static function get() : self {
24
		static $instance = null;
25
		if ( $instance === null ) {
26
			$instance = new self;
27
		}
28
		return $instance;
29
	}
30
31
	/**
32
	 * Get the actual list of admins
33
	 *
34
	 * @return array[]
35
	 */
36
	public function getAdminsList() : array {
37
		return json_decode( $this->getContent(), true );
38
	}
39
}
40