Skip to content

Commit

Permalink
Update Loader.php for improved data encapsulation
Browse files Browse the repository at this point in the history
The 'config' and 'components' properties in Loader.php have been switched from public to private access levels, enhancing data encapsulation. Additionally, two new methods, 'getConfig' and 'componentIsLoaded', were added to provide controlled access to these properties.
  • Loading branch information
krzysztofzylka committed Dec 29, 2023
1 parent 19c1dfc commit 1403039
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/Component/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,39 @@ class Loader
* Components
* @var array
*/
public static array $config = [];
private static array $config = [];

/**
* Components
* @var array
*/
public static array $components = [];
private static array $components = [];

/**
* Is ini
* @var bool
*/
public static bool $init = false;

/**
* Get component config
* @return array
*/
public static function getConfig(): array
{
return self::$config;
}

/**
* Component is loaded
* @param string $name
* @return bool
*/
public static function componentIsLoaded(string $name): bool
{
return array_key_exists($name, self::$components);
}

/**
* Constructor
* @throws Exception
Expand Down

0 comments on commit 1403039

Please sign in to comment.