本文整理汇总了PHP中Error::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::__construct方法的具体用法?PHP Error::__construct怎么用?PHP Error::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* @param string $name
* @param string|null $message
*/
function __construct($name, $message = null)
{
if (empty($message)) {
$message = "Param '{$name}' is required";
}
parent::__construct($message);
}
示例2:
/**
* Construct the InvalidControllerActionError
*
* @access public
* @param string $controller Controller name
* @param string $action Controller action
* @param string $message Error message, if NULL default will be used
* @return InvalidControllerActionError
*/
function __construct($controller, $action, $message = null) {
if(is_null($message)) $message = "Invalid controller action $controller::$action()";
parent::__construct($message);
$this->setController($controller);
$this->setAction($action);
} // __construct
示例3:
/**
* Construct the FailedToMoveFileError
*
* @access public
* @param string $from_path
* @param string $to_path
* @param string $message If NULL default message will be used
* @return FailedToMoveFileError
*/
function __construct($from_path, $to_path, $message = null) {
if(is_null($message)) $message = "Failed to move file '$from_path' to '$to_path'";
parent::__construct($message);
$this->setFromPath($from_path);
$this->setToPath($to_path);
} // __construct
示例4:
/**
* @param string $name
* @param string $expected_location
* @param string|null $message
*/
function __construct($name, $expected_location, $message = null)
{
if (empty($message)) {
$message = "Theme '{$name}' was not found at '{$expected_location}'";
}
parent::__construct($message);
}
示例5:
/**
* Construct the OwnerCompanyDnxError
*
* @param string $message
* @return OwnerCompanyDnxError
*/
function __construct($message = null)
{
if (is_null($message)) {
$message = 'Owner company is not defined';
}
parent::__construct($message);
}
示例6: switch
/**
* Constructor
*
* @param void
* @return UploadError
*/
function __construct($code)
{
switch ($code) {
case UPLOAD_ERR_INI_SIZE:
$message = 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
break;
case UPLOAD_ERR_FORM_SIZE:
$message = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
break;
case UPLOAD_ERR_PARTIAL:
$message = 'The uploaded file was only partially uploaded';
break;
case UPLOAD_ERR_NO_FILE:
$message = 'No file was uploaded';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = 'Missing a temporary folder';
break;
case UPLOAD_ERR_CANT_WRITE:
$message = 'Failed to write file to disk';
break;
case UPLOAD_ERR_EXTENSION:
$message = 'File upload stopped by extension';
break;
default:
$message = 'Unknown file upload error';
}
// switch
parent::__construct($message);
}
示例7:
/**
* @param string $expected_location
* @param string|null $message
*/
function __construct($expected_location, $message = null)
{
if (empty($message)) {
$message = "Temp folder not found at '{$expected_location}'";
}
parent::__construct($message);
}
示例8:
/**
* @param string $expected_location
* @param string|null $message
*/
function __construct($expected_location, $message = null)
{
if (empty($message)) {
$message = "File '{$expected_location}' was not found";
}
parent::__construct($message);
}
示例9: __construct
/**
* @param \Exception $exception
*/
public function __construct(\Exception $exception)
{
parent::__construct($exception);
$this->fileName = $exception->getFile();
$this->line = $exception->getLine();
$this->trace = $exception->getTraceAsString();
}
示例10:
/**
* Constructor
*
* @param array $errors Array of errors
* @param string $message If NULL default message will be used
* @return FormSubmissionErrors
*/
function __construct($errors, $message = null) {
if(is_null($message)) {
$message = 'Form submission failed';
} // if
parent::__construct($message);
$this->setErrors($errors);
} // __construct
示例11: switch
/**
* Construct exception instance
*
* @param string $json
* @param int $json_error
* @param string|null $message
*/
function __construct($json, $json_error, $message = null)
{
$this->json = $json;
$this->json_error = $json_error;
if (empty($message)) {
switch ($json_error) {
case JSON_ERROR_DEPTH:
$message = 'The maximum stack depth has been exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$message = 'Invalid or malformed JSON';
break;
case JSON_ERROR_CTRL_CHAR:
$message = 'Control character error, possibly incorrectly encoded';
break;
case JSON_ERROR_SYNTAX:
$message = 'Syntax error';
break;
case JSON_ERROR_UTF8:
$message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
if (defined('JSON_ERROR_RECURSION') && $json_error === JSON_ERROR_RECURSION) {
$message = 'One or more recursive references in the value to be encoded';
} elseif (defined('JSON_ERROR_INF_OR_NAN') && $json_error === JSON_ERROR_INF_OR_NAN) {
$message = 'One or more NAN or INF values in the value to be encoded';
} elseif (defined('JSON_ERROR_UNSUPPORTED_TYPE') && $json_error === JSON_ERROR_UNSUPPORTED_TYPE) {
$message = 'A value of a type that cannot be encoded was given';
} else {
$message = 'Failed to parse JSON';
}
}
}
parent::__construct($message);
}
示例12: __construct
/**
* Construct the FileDnxError.
*
* @param string $file_path
* @param string $message
*/
public function __construct($file_path, $message = null)
{
if (is_null($message)) {
$message = "File '{$file_path}' doesn't exists";
}
parent::__construct($message, ['path' => $file_path]);
}
示例13:
/**
* Construct the AdministratorDnxError
*
* @param string $message
* @return AdministratorDnxError
*/
function __construct($message = null)
{
if (is_null($message)) {
$message = 'Administrator account is not defined';
}
parent::__construct($message);
}
示例14:
/**
* Construct the DirDnxError
*
* @access public
* @param string $dir_path
* @param string $message
* @return DirDnxError
*/
function __construct($dir_path, $message = null)
{
if (is_null($message)) {
$message = "Directory '{$dir_path}' doesn't exists";
}
parent::__construct($message);
$this->setDirPath($dir_path);
}
示例15:
/**
* Construct the ImageTypeNotSupportedError
*
* @access public
* @param void
* @return ImageTypeNotSupportedError
*/
function __construct($file_path, $type_value, $message = null)
{
if (is_null($message)) {
$message = "This type of image is not supported. SimpleGD supports only PNG, JPG and GIF image types. Type: {$type_value}";
}
parent::__construct($message);
$this->setFilePath($file_path);
}