Skip to content

Instantly share code, notes, and snippets.

@GiacomoP
Created August 22, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GiacomoP/5684bd3b060cc1275a0e17b0240e5c7f to your computer and use it in GitHub Desktop.
Save GiacomoP/5684bd3b060cc1275a0e17b0240e5c7f to your computer and use it in GitHub Desktop.
Example of a Config class
<?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