require_once 'CRM/Core/Exception.php';
require_once 'Log.php';
+
+/**
+ * Class CRM_Exception
+ */
class CRM_Exception extends PEAR_Exception {
// Redefine the exception so message isn't optional
+ /**
+ * Supported signatures:
+ * - PEAR_Exception(string $message);
+ * - PEAR_Exception(string $message, int $code);
+ * - PEAR_Exception(string $message, Exception $cause);
+ * - PEAR_Exception(string $message, Exception $cause, int $code);
+ * - PEAR_Exception(string $message, PEAR_Error $cause);
+ * - PEAR_Exception(string $message, PEAR_Error $cause, int $code);
+ * - PEAR_Exception(string $message, array $causes);
+ * - PEAR_Exception(string $message, array $causes, int $code);
+ * @param string exception message
+ * @param int|Exception|PEAR_Error|array|null exception cause
+ * @param int|null exception code or null
+ */
public function __construct($message = NULL, $code = 0, Exception$previous = NULL) {
parent::__construct($message, $code, $previous);
}
}
+/**
+ * Class CRM_Core_Error
+ */
class CRM_Core_Error extends PEAR_ErrorStack {
/**
/**
* singleton function used to manage this object.
*
+ * @param null $package
+ * @param bool $msgCallback
+ * @param bool $contextCallback
+ * @param bool $throwPEAR_Error
+ * @param string $stackClass
+ *
* @return object
* @static
*/
}
/**
- * construcor
+ * constructor
*/
function __construct() {
parent::__construct('CiviCRM');
$this->setDefaultCallback(array($this, 'handlePES'));
}
+ /**
+ * @param $error
+ * @param string $separator
+ *
+ * @return array|null|string
+ */
static public function getMessages(&$error, $separator = '<br />') {
if (is_a($error, 'CRM_Core_Error')) {
$errors = $error->getErrors();
// this function is used to trap and print errors
// during system initialization time. Hence the error
// message is quite ugly
+ /**
+ * @param $pearError
+ */
public static function simpleHandler($pearError) {
// create the error array
/**
* display an error page with an error message describing what happened
*
- * @param string message the error message
- * @param string code the error code if any
- * @param string email the email address to notify of this situation
+ * @param null $message
+ * @param null $code
+ * @param null $email
+ *
+ * @throws Exception
+ * @internal param \message $string the error message
+ * @internal param \code $string the error code if any
+ * @internal param \email $string the email address to notify of this situation
*
* @return void
* @static
* Similar to the function debug. Only difference is
* in the formatting of the output.
*
- * @param string variable name
- * @param mixed reference to variables that we need a trace of
- * @param bool should we use print_r ? (else we use var_dump)
- * @param bool should we log or return the output
+ * @param $variable_name
+ * @param $variable
+ * @param bool $print
+ * @param bool $log
+ * @param string $comp variable name
+ *
+ * @internal param \reference $mixed to variables that we need a trace of
+ * @internal param \should $bool we use print_r ? (else we use var_dump)
+ * @internal param \should $bool we log or return the output
*
* @return string the generated output
*
/**
* display the error message on terminal
*
- * @param string message to be output
- * @param bool should we log or return the output
+ * @param $message
+ * @param bool $out should we log or return the output
*
+ * @param string $comp message to be output
* @return string format of the backtrace
*
* @access public
/**
* Obtain a reference to the error log
*
+ * @param string $comp
+ *
* @return Log
*/
static function createDebugLogger($comp = '') {
return Log::singleton('file', $fileName);
}
+ /**
+ * @param string $msg
+ * @param bool $log
+ */
static function backtrace($msg = 'backTrace', $log = FALSE) {
$backTrace = debug_backtrace();
$message = self::formatBacktrace($backTrace);
return $msg;
}
+ /**
+ * @param $message
+ * @param int $code
+ * @param string $level
+ * @param null $params
+ *
+ * @return object
+ */
static function createError($message, $code = 8000, $level = 'Fatal', $params = NULL) {
$error = CRM_Core_Error::singleton();
$error->push($code, $level, array($params), $message);
/**
* Set a status message in the session, then bounce back to the referrer.
*
- * @param string $status The status message to set
+ * @param string $status The status message to set
*
+ * @param null $redirect
+ * @param string $title
* @return void
* @access public
* @static
* This function is no longer used by v3 api.
* @fixme Some core files call it but it should be re-thought & renamed or removed
*/
+ /**
+ * @param $msg
+ * @param null $data
+ *
+ * @return array
+ * @throws Exception
+ */
public static function &createAPIError($msg, $data = NULL) {
if (self::$modeException) {
throw new Exception($msg, $data);
return $values;
}
+ /**
+ * @param $file
+ */
public static function movedSiteError($file) {
$url = CRM_Utils_System::url('civicrm/admin/setting/updateConfigBackend',
'reset=1',
CRM_Utils_System::civiExit($code);
}
+ /**
+ * @param $error
+ * @param const $type
+ *
+ * @return bool
+ */
public static function isAPIError($error, $type = CRM_Core_Error::FATAL_ERROR) {
if (is_array($error) && !empty($error['is_error'])) {
$code = $error['error_message']['code'];