Skip to content

Commit

Permalink
Resolve Exception namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Apr 17, 2014
1 parent ef9a1e0 commit e40d9bc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/Core/Configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Cake\Cache\Cache;
use Cake\Configure\ConfigEngineInterface;
use Cake\Configure\Engine\PhpConfig;
use Cake\Error;
use Cake\Error\Exception;
use Cake\Utility\Hash;

/**
Expand Down Expand Up @@ -283,10 +283,10 @@ public static function load($key, $config = 'default', $merge = true) {
public static function dump($key, $config = 'default', $keys = []) {
$engine = static::_getEngine($config);
if (!$engine) {
throw new Error\Exception(sprintf('There is no "%s" config engine.', $config));
throw new Exception(sprintf('There is no "%s" config engine.', $config));
}
if (!method_exists($engine, 'dump')) {
throw new Error\Exception(sprintf('The "%s" config engine, does not have a dump() method.', $config));
throw new Exception(sprintf('The "%s" config engine, does not have a dump() method.', $config));
}
$values = static::$_values;
if (!empty($keys) && is_array($keys)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Core/InstanceConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
namespace Cake\Core;

use Cake\Error;
use Cake\Error\Exception;
use Cake\Utility\Hash;

/**
Expand Down Expand Up @@ -156,7 +156,7 @@ protected function _configWrite($key, $value, $merge = null) {

foreach ($stack as $k) {
if (!is_array($update)) {
throw new Error\Exception(sprintf('Cannot set %s value', $key));
throw new Exception(sprintf('Cannot set %s value', $key));
}

if (!isset($update[$k])) {
Expand Down Expand Up @@ -188,7 +188,7 @@ protected function _configDelete($key) {

foreach ($stack as $i => $k) {
if (!is_array($update)) {
throw new Error\Exception(sprintf('Cannot unset %s value', $key));
throw new Exception(sprintf('Cannot unset %s value', $key));
}

if (!isset($update[$k])) {
Expand Down
4 changes: 2 additions & 2 deletions src/Core/StaticConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
namespace Cake\Core;

use Cake\Error;
use Cake\Error\Exception;

/**
* A trait that provides a set of static methods to manage configuration
Expand Down Expand Up @@ -79,7 +79,7 @@ public static function config($key, $config = null) {
return;
}
if (isset(static::$_config[$key])) {
throw new Error\Exception(sprintf('Cannot reconfigure existing key "%s"', $key));
throw new Exception(sprintf('Cannot reconfigure existing key "%s"', $key));
}
if (is_object($config)) {
$config = ['className' => $config];
Expand Down
4 changes: 2 additions & 2 deletions src/I18n/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Error;
use Cake\Error\Exception;
use Cake\Network\Request;
use Cake\Network\Session;
use Cake\Utility\Hash;
Expand Down Expand Up @@ -239,7 +239,7 @@ public static function translate($singular, $plural = null, $domain = null, $cat
$domain = static::$defaultDomain;
}
if ($domain === '') {
throw new Error\Exception('You cannot use "" as a domain.');
throw new Exception('You cannot use "" as a domain.');
}

$_this->domain = $domain . '_' . $_this->l10n->lang;
Expand Down
4 changes: 2 additions & 2 deletions src/Utility/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Cake\Utility;

use Cake\Core\Configure;
use Cake\Error;
use Cake\Error\Exception;
use Cake\Log\Log;

/**
Expand Down Expand Up @@ -627,7 +627,7 @@ public static function outputAs($format = null) {
return $self->_outputFormat;
}
if ($format !== false && !isset($self->_templates[$format])) {
throw new Error\Exception('Invalid Debugger output format.');
throw new Exception('Invalid Debugger output format.');
}
$self->_outputFormat = $format;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utility/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
namespace Cake\Utility;

use Cake\Error;
use Cake\Error\Exception;

/**
* Number helper library.
Expand Down Expand Up @@ -161,7 +161,7 @@ public static function fromReadableSize($size, $default = false) {
if ($default !== false) {
return $default;
}
throw new Error\Exception('No unit type.');
throw new Exception('No unit type.');
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Utility/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Utility;

use Cake\Core\Configure;
use Cake\Error;
use Cake\Error\Exception;

/**
* Security Library contains utility methods related to security
Expand Down Expand Up @@ -139,7 +139,7 @@ public static function setHash($hash) {
*/
public static function setCost($cost) {
if ($cost < 4 || $cost > 31) {
throw new Error\Exception(vsprintf(
throw new Exception(vsprintf(
'Invalid value, cost must be between %s and %s',
array(4, 31)
));
Expand All @@ -158,13 +158,13 @@ public static function setCost($cost) {
*/
public static function rijndael($text, $key, $operation) {
if (empty($key)) {
throw new Error\Exception('You cannot use an empty key for Security::rijndael()');
throw new Exception('You cannot use an empty key for Security::rijndael()');
}
if (empty($operation) || !in_array($operation, array('encrypt', 'decrypt'))) {
throw new Error\Exception('You must specify the operation for Security::rijndael(), either encrypt or decrypt');
throw new Exception('You must specify the operation for Security::rijndael(), either encrypt or decrypt');
}
if (strlen($key) < 32) {
throw new Error\Exception('You must use a key larger than 32 bytes for Security::rijndael()');
throw new Exception('You must use a key larger than 32 bytes for Security::rijndael()');
}
$algorithm = MCRYPT_RIJNDAEL_256;
$mode = MCRYPT_MODE_CBC;
Expand Down Expand Up @@ -213,7 +213,7 @@ protected static function _crypt($password, $salt = false) {
}

if ($salt === true || strpos($salt, '$2y$') !== 0 || strlen($salt) < 29) {
throw new Error\Exception(sprintf(
throw new Exception(sprintf(
'Invalid salt: %s for blowfish Please visit http://www.php.net/crypt and read the appropriate section for building blowfish salts.',
$salt
));
Expand Down Expand Up @@ -264,7 +264,7 @@ public static function encrypt($plain, $key, $hmacSalt = null) {
*/
protected static function _checkKey($key, $method) {
if (strlen($key) < 32) {
throw new Error\Exception(sprintf('Invalid key for %s, key must be at least 256 bits (32 bytes) long.', $method));
throw new Exception(sprintf('Invalid key for %s, key must be at least 256 bits (32 bytes) long.', $method));
}
}

Expand All @@ -280,7 +280,7 @@ protected static function _checkKey($key, $method) {
public static function decrypt($cipher, $key, $hmacSalt = null) {
self::_checkKey($key, 'decrypt()');
if (empty($cipher)) {
throw new Error\Exception('The data to decrypt cannot be empty.');
throw new Exception('The data to decrypt cannot be empty.');
}
if ($hmacSalt === null) {
$hmacSalt = Configure::read('Security.salt');
Expand Down

0 comments on commit e40d9bc

Please sign in to comment.