本文整理汇总了PHP中Kohana_Exception::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana_Exception::__construct方法的具体用法?PHP Kohana_Exception::__construct怎么用?PHP Kohana_Exception::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana_Exception
的用法示例。
在下文中一共展示了Kohana_Exception::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs a new exception for the specified model
*
* @param string $alias The alias to use when looking for error messages
* @param Validation $object The Validation object of the model
* @param string $message The error message
* @param array $values The array of values for the error message
* @param integer $code The error code for the exception
*
* @return void
*/
public function __construct($alias, Validation $object, $message = 'Failed to validate array', array $values = null, $code = 0, Exception $previous = null)
{
$this->_alias = $alias;
$this->_objects['_object'] = $object;
$this->_objects['_has_many'] = false;
parent::__construct($message, $values, $code, $previous);
}
示例2: __construct
public function __construct($message = "", array $variables = NULL, $code = NULL, Exception $previous = NULL)
{
if (NULL === $code) {
$code = $this->code;
}
parent::__construct($message, $variables, $code, $previous);
}
示例3: __construct
/**
* Constructs a new exception for the specified model
*
* @param string $alias The alias to use when looking for error messages
* @param Validation $object The Validation object of the model
* @param string $message The error message
* @param array $values The array of values for the error message
* @param integer $code The error code for the exception
* @return void
*/
public function __construct($alias, Validation $object, $message = 'Failed to validate array', array $values = NULL, $code = 0)
{
$this->_alias = $alias;
$this->_objects['_object'] = $object;
$this->_objects['_has_many'] = FALSE;
parent::__construct($message, $values, $code);
}
示例4: join
function __construct($message, $model, $fields = NULL)
{
$this->_model = $model;
$fields[':model'] = $model->meta()->model();
$fields[':errors'] = join(', ', $model->errors()->messages_all());
parent::__construct($message, $fields);
}
示例5: __construct
/**
* Constructor
*/
public function __construct($message, array $migration, array $variables = array(), $code = 0)
{
$variables[':migration-id'] = $migration['id'];
$variables[':migration-group'] = $migration['group'];
$this->_migration = $migration;
parent::__construct($message, $variables, $code);
}
示例6:
function __construct($sender, $method, array $args = NULL)
{
$this->args = $args;
$this->sender = $sender;
$fields[':sender'] = get_class($sender);
$fields[':method'] = $this->method = $method;
parent::__construct('Object :sender does not have a method :method', $fields);
}
示例7: __construct
/**
* Create a new PHP error exception.
*
* @return void
*/
public function __construct($code, $error, $file, $line, $context = NULL)
{
parent::__construct($error);
// Set the error code, file, line, and context manually
$this->code = $code;
$this->file = $file;
$this->line = $line;
}
示例8: __construct
/**
* Set internal properties.
*
* @param string URI of page
* @param string custom error template
*/
public function __construct($page = NULL)
{
if ($page === NULL) {
// Use the complete URI
$page = Router::$complete_uri;
}
parent::__construct('The page you requested, %page%, could not be found.', array('%page%' => $page));
}
示例9: __construct
public function __construct($status = 404, $message = NULL, array $values = NULL, $code = 0)
{
$this->_status = $status;
if (!$message) {
$message = arr::get(Request::$messages, $status);
}
parent::__construct($message, $values, $code);
}
示例10: __construct
/**
* Construct the exception
*
* @param string $msg
* @param int $code
* @param Exception $previous
* @return void
*/
public function __construct($msg = '', $code = 0, Exception $previous = null)
{
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
parent::__construct($msg, (int) $code);
$this->_previous = $previous;
} else {
parent::__construct($msg, (int) $code, $previous);
}
}
示例11: __construct
public function __construct($message = "", array $variables = NULL, $code = 0, Exception $previous = NULL, $data = array())
{
if ($data and !is_array($data)) {
$data = json_decode($data, TRUE);
}
parent::__construct($message, $variables, $code, $previous, $data);
if (is_array($data)) {
$this->data = $data;
}
}
示例12: __construct
/**
* Creates a new translated exception.
*
* throw new Kohana_Exception('Something went terrible wrong, :user',
* array(':user' => $user));
*
* @param string status message, custom content to display with error
* @param array translation variables
* @param integer the http status code
* @return void
*/
public function __construct($message = NULL, array $variables = NULL, $code = 0)
{
if ($code == 0) {
$code = $this->_code;
}
if (!isset(Response::$messages[$code])) {
throw new Kohana_Exception('Unrecognized HTTP status code: :code . Only valid HTTP status codes are acceptable, see RFC 2616.', array(':code' => $code));
}
parent::__construct($message, $variables, $code);
}
示例13: __construct
/**
* @param object Authorize.Net response
*/
public function __construct($response)
{
$this->response = $response;
if ($response instanceof AuthorizeNetResponse) {
parent::__construct($response->response_reason_text, NULL, $response->response_reason_code);
} elseif ($response instanceof AuthorizeNetXMLResponse) {
parent::__construct($response->getMessageText(), NULL, $response->getMessageCode());
} else {
throw new Kohana_Exception('Unsupported Authorize.Net response used in :class', array(':class' => get_class($this)));
}
}
示例14: __construct
/**
* Sets exception message and debug info.
*
* @param string message
* @param mixed debug info
* @return void
*/
public function __construct($message, array $variables = NULL, $debug = NULL)
{
// Failure message
parent::__construct($message, $variables);
// Set the debug information
$this->debug = $debug;
// Load the stack trace
$trace = $this->getTrace();
// Set the error location to the assertation call
$this->file = $trace[0]['file'];
$this->line = $trace[0]['line'];
}
示例15: __construct
public function __construct($code = NULL, $message = NULL, array $variables = NULL, $errno = NULL, array $debug = NULL, Exception $previous = NULL)
{
$this->_errno = (int) $errno;
$this->_debug = $debug;
$code = NULL === $code ? $this->code : $code;
if (NULL === $message) {
if (isset(Response::$messages[$code])) {
$message = Response::$messages[$code];
} else {
$message = 'RestfulAPI_Exception [ :code ] - unknown';
$variables = [':code' => $code];
$code = 500;
}
}
parent::__construct($message, $variables, $code, $previous);
}