Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Config
- {
- /**
- * local_variables
- *
- * An array of all the local variables
- */
- private static $local_variables = array(
- ['name' => 'SQL_USERNAME', 'data' => 'username'],
- ['name' => 'SQL_PASSWORD', 'data' => 'password'],
- ['name' => 'SQL_HOSTNAME', 'data' => 'hostname'],
- ['name' => 'SQL_DATABASE', 'data' => 'database'],
- );
- /**
- * GetConfig
- *
- * Gets a public config variable
- *
- * @param string $name The name of the config you wish you get.
- */
- public static function GetConfig($name)
- {
- $serverVariable = GetServerVariable($name);
- if($serverVariable !== false) {
- return $serverVariable;
- }
- $localVariable = GetLocalVariable($name);
- if($localVariable !== false) {
- return $localVariable;
- }
- return false;
- }
- /**
- * GetServerVariable
- *
- * Gets a variable that's stored on the sql database.
- *
- * @param string $name The name of the variable you wish to get from the server.
- */
- private static function GetServerVariable($name)
- {
- if(!DoesServerVariableExist($name)) {
- return false;
- }
- }
- /**
- * DoesServerVariableExist
- *
- * Checks of a variable exists on the database.
- *
- * @param string $name The name of the variable you wish to lookup.
- */
- private static function DoesServerVariableExist($name)
- {
- }
- /**
- * GetLocalVariable
- *
- * Gets a variable from local storag.
- *
- * @param string $name The name of the variable you wish to get.
- */
- private static function GetLocalVariable($name)
- {
- if(!DoesLocalVariableExist($name)) {
- return false;
- }
- }
- /**
- * DoesLocalVariableExist
- *
- * Checks if a local variable exists
- *
- * @param string $name The name of the variable you wish to lookup.
- */
- private static function DoesLocalVariableExist($name)
- {
- for($i = 0; $i < count($local_variables); $i++) {
- if($local_variables[$i]['name'] === $name) {
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement