const UNAUTHORIZED = 'unauthorized';
const NOT_IMPLEMENTED = 'not-found';
- private $extraParams = array();
+ private $extraParams = [];
/**
* Class constructor.
* @param Exception|NULL $previous
* A previous exception which caused this new exception.
*/
- public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) {
+ public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) {
// Using int for error code "old way") ?
if (is_numeric($error_code)) {
$code = $error_code;
$code = 0;
}
parent::__construct(ts($message), $code, $previous);
- $this->extraParams = $extraParams + array('error_code' => $error_code);
+ $this->extraParams = $extraParams + ['error_code' => $error_code];
}
/**
* @return array
*/
public function getErrorCodes() {
- return array(
+ return [
2000 => '$params was not an array',
2001 => 'Invalid Value for Date field',
2100 => 'String value is longer than permitted length',
self::UNAUTHORIZED => 'Unauthorized',
self::NOT_IMPLEMENTED => 'Entity or method is not implemented',
- );
+ ];
}
}
* API_Exception from the api wrapper as the namespace is more generic
*/
class CiviCRM_API3_Exception extends Exception {
- private $extraParams = array();
+ private $extraParams = [];
/**
* Class constructor.
* @param Exception|NULL $previous
* A previous exception which caused this new exception.
*/
- public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) {
+ public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) {
parent::__construct(ts($message));
- $this->extraParams = $extraParams + array('error_code' => $error_code);
+ $this->extraParams = $extraParams + ['error_code' => $error_code];
}
/**