Config::__callStatic()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
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