Files
roundcubemail/plugins/enigma/lib/enigma_error.php
Michael Voříšek b1a0067e5d Fix more CS (#9303)
* fix "class_attributes_separation"

* fix "ternary_to_null_coalescing"

* fix "no_extra_blank_lines"

* fix "php_unit_data_provider_name" - use snake_case

* fix remaining "function data_" manually

* move "php_unit_test_case_static_method_calls" to a better place in cnf

* fix 3.47.1 CS
2024-01-20 08:22:32 +01:00

60 lines
1.7 KiB
PHP

<?php
/*
+-------------------------------------------------------------------------+
| Error class for the Enigma Plugin |
| |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
+-------------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-------------------------------------------------------------------------+
*/
class enigma_error
{
private $code;
private $message;
private $data = [];
// error codes
public const OK = 0;
public const INTERNAL = 1;
public const NODATA = 2;
public const KEYNOTFOUND = 3;
public const DELKEY = 4;
public const BADPASS = 5;
public const EXPIRED = 6;
public const UNVERIFIED = 7;
public const NOMDC = 8;
public function __construct($code = null, $message = '', $data = [])
{
$this->code = $code;
$this->message = $message;
$this->data = $data;
}
public function getCode()
{
return $this->code;
}
public function getMessage()
{
return $this->message;
}
public function getData($name = null)
{
if ($name) {
return $this->data[$name] ?? null;
}
return $this->data;
}
}