Created
August 22, 2016 18:05
-
-
Save GiacomoP/5684bd3b060cc1275a0e17b0240e5c7f to your computer and use it in GitHub Desktop.
Example of a Config class
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 Survey; | |
/** | |
* Helper to get configuration values. | |
*/ | |
class Config | |
{ | |
/** | |
* @var array | |
*/ | |
private static $configArray; | |
/** | |
* Returns the entire configuration array for the App. | |
* | |
* @return mixed[] | |
*/ | |
public static function getArray() | |
{ | |
if (!is_array(static::$configArray)) { | |
static::$configArray = array_merge(require 'config/config.default.php', require('config/config.php')); | |
} | |
return static::$configArray; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment