-
-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathError.php
More file actions
85 lines (74 loc) · 1.56 KB
/
Copy pathError.php
File metadata and controls
85 lines (74 loc) · 1.56 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
* This file is part of the PHPBench package
*
* (c) Daniel Leech <daniel@dantleech.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
namespace PhpBench\Model;
/**
* Represents an Error. Typically this is
* a serializable representation of an Exception.
*/
class Error
{
private $message;
private $code;
private $line;
private $file;
private $class;
private $trace;
public function __construct(
$message,
$class,
$code,
$file,
$line,
$trace
) {
$this->message = $message;
$this->class = $class;
$this->line = $line;
$this->file = $file;
$this->code = $code;
$this->trace = $trace;
}
public static function fromException(\Exception $exception)
{
return new self(
$exception->getMessage(),
get_class($exception),
$exception->getCode(),
$exception->getFile(),
$exception->getLine(),
$exception->getTraceAsString()
);
}
public function getCode()
{
return $this->code;
}
public function getLine()
{
return $this->line;
}
public function getFile()
{
return $this->file;
}
public function getMessage()
{
return $this->message;
}
public function getClass()
{
return $this->class;
}
public function getTrace()
{
return $this->trace;
}
}