Skip to content

Commit

Permalink
Updated Configure folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 25, 2012
1 parent 7c99d1d commit 4690cb4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Configure/ConfigReaderInterface.php
Expand Up @@ -12,6 +12,7 @@
* @since CakePHP(tm) v 1.0.0.2363
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Configure;

/**
* An interface for creating objects compatible with Configure::load()
Expand Down
7 changes: 5 additions & 2 deletions lib/Cake/Configure/IniReader.php
Expand Up @@ -16,7 +16,10 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Hash', 'Utility');

namespace Cake\Configure;
use Cake\Utility\Hash,
Cake\Error;

/**
* Ini file configuration engine.
Expand Down Expand Up @@ -94,7 +97,7 @@ public function read($file) {
if (!file_exists($filename)) {
$filename .= '.ini';
if (!file_exists($filename)) {
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($filename, 0, -4), $filename));
throw new Error\ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($filename, 0, -4), $filename));
}
}
$contents = parse_ini_file($filename, true);
Expand Down
9 changes: 6 additions & 3 deletions lib/Cake/Configure/PhpReader.php
Expand Up @@ -15,6 +15,9 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Configure;
use Cake\Core\App,
Cake\Error;

/**
* PHP Reader allows Configure to load configuration values from
Expand Down Expand Up @@ -60,7 +63,7 @@ public function __construct($path = null) {
*/
public function read($key) {
if (strpos($key, '..') !== false) {
throw new ConfigureException(__d('cake_dev', 'Cannot load configuration files with ../ in them.'));
throw new Error\ConfigureException(__d('cake_dev', 'Cannot load configuration files with ../ in them.'));
}
if (substr($key, -4) === '.php') {
$key = substr($key, 0, -4);
Expand All @@ -75,12 +78,12 @@ public function read($key) {
$file .= '.php';
if (!is_file($file)) {
if (!is_file(substr($file, 0, -4))) {
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
throw new Error\ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
}
}
include $file;
if (!isset($config)) {
throw new ConfigureException(
throw new Error\ConfigureException(
sprintf(__d('cake_dev', 'No variable $config found in %s.php'), $file)
);
}
Expand Down

0 comments on commit 4690cb4

Please sign in to comment.