From 52c8a730f3cae804d64599df9f28b0417b1ae3e7 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Mon, 29 Sep 2014 22:07:18 -0400 Subject: [PATCH] Dropped pickles.ph made some assumptions Wanted to be 100% reliant on the autoloader so I dropped the manual include of pickles.php. Also moved some of the PHP ini logic out of here and baked in some assumptions about environments and settings. Basically anything other than "production" will set display errors to true, production is false. --- src/Config.php | 9 +++++++++ src/pickles.php | 45 --------------------------------------------- 2 files changed, 9 insertions(+), 45 deletions(-) delete mode 100644 src/pickles.php diff --git a/src/Config.php b/src/Config.php index bdb1255..308047b 100644 --- a/src/Config.php +++ b/src/Config.php @@ -38,6 +38,9 @@ class Config extends \ArrayObject */ public function __construct() { + ini_set('display_errors', true); + error_reporting(-1); + $filename = getcwd() . '/../../pickles.php'; $environments = false; $environment = false; @@ -129,6 +132,12 @@ class Config extends \ArrayObject $config['environment'] = $environment; } + // Disable display errors in production + if ($environment == 'production') + { + ini_set('display_errors', false); + } + // Defaults expected Pickles options to false $this['pickles'] = [ 'cache' => false, diff --git a/src/pickles.php b/src/pickles.php deleted file mode 100644 index 69b263c..0000000 --- a/src/pickles.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Copyright 2007-2014, Josh Sherman - * @license http://www.opensource.org/licenses/mit-license.html - * @package PICKLES - * @link https://github.com/joshtronic/pickles - * @usage require_once 'pickles.php'; - */ - -// Turns on error before the config is loaded to help catch parse errors -ini_set('display_errors', true); -error_reporting(-1); - -// Defaults timezone to UTC if not set -if (ini_get('date.timezone') == '') -{ - ini_set('date.timezone', 'Etc/UTC'); -} - -// Loads the base config -$config = Pickles\Config::getInstance(); - -// Configures any available PHP configuration options -if (isset($config['php']) && is_array($config['php'])) -{ - foreach ($config['php'] as $variable => $value) - { - ini_set($variable, $value); - } -} -