-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoovicoException.php
More file actions
63 lines (56 loc) · 1.15 KB
/
Copy pathMoovicoException.php
File metadata and controls
63 lines (56 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* TODO: short description.
*
* TODO: long description.
*
*/
class MoovicoException extends Exception
{
/**
* payload
*
* @var mixed
* @access protected
*/
protected $payload = array();
/**
* TODO: short description.
*
* @param mixed $msg
* @param mixed $code Optional, defaults to 0.
*
*/
public function __construct($msg, $code = 0, Array $payload = array())
{
if (empty($code)) {
$code = $this->generateCode($msg);
}
if (!empty($payload)) {
$this->payload = $payload;
}
Moovico::Debug($msg, $code);
parent::__construct($msg, $code);
}
/**
* generateCode
*
* @param mixed $msg
* @access protected
* @return void
*/
protected function generateCode($msg) {
$trace = $this->getTrace();
$code = crc32($trace[0]['class'].$msg); // auto generate a code
return $code;
}
/**
* GetPayload
*
* @access public
* @return void
*/
public function GetPayload() {
return $this->payload;
}
}