Config   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __callStatic() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Facade style, class proxy.
6
 *
7
 * @since 0.2.0
8
 * @author Glynn Quelch <[email protected]>
9
 * @license http://www.opensource.org/licenses/mit-license.html  MIT License
10
 * @package PinkCrab\Perique
11
 */
12
13
namespace PinkCrab\Perique\Application;
14
15
use PinkCrab\Perique\Application\App;
16
use PinkCrab\Perique\Application\App_Config;
17
18
19
class Config {
20
21
22
	/**
23
	 * Holds the current config object.
24
	 *
25
	 * @var App_Config|null
26
	 */
27
	protected static ?App_Config $config_cache = null;
28
29
	/**
30
	 * Calls the static method from the config.
31
	 * Sets the config cache on first call.
32
	 *
33
	 * @param string $method
34
	 * @param array<int, mixed> $params
35
	 * @return mixed
36
	 */
37
	public static function __callStatic( $method, $params ) {
38
		if ( ! self::$config_cache ) {
39
			/** @phpstan-ignore-next-line */
40
			self::$config_cache = App::make( App_Config::class );
41
		}
42
43
		return self::$config_cache->{$method}( ...$params );
44
	}
45
}
46