Created
February 20, 2025 12:18
-
-
Save kasparsd/d76983fb909d2145d4036f1c8a6f0fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace YourVendor\Project; | |
class Config { | |
private static array $config = []; | |
private function __construct() { | |
// Private constructor to prevent direct instantiation | |
} | |
private function __clone() { | |
// Prevent cloning of the instance | |
} | |
public static function set( string $key, string $value ): void { | |
self::$config[ $key ] = $value; | |
} | |
public static function get( string $key ): ?string { | |
return self::$config[ $key ] ?? null; | |
} | |
public static function has( string $key ): bool { | |
return isset( self::$config[ $key ] ); | |
} | |
public static function delete( string $key ): void { | |
unset( self::$config[ $key ] ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment