Completed
Push — master ( 195ecd...eadbb0 )
by Ryota
7s
created

ClientException::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Polidog\Esa\Exception;
4
5
class ClientException extends \RuntimeException
6
{
7
    /**
8
     * @var string
9
     */
10
    private $method;
11
12
    /**
13
     * @var string
14
     */
15
    private $path;
16
17
    /**
18
     * @var array
19
     */
20
    private $params;
21
22
    /**
23
     * @return string
24
     */
25
    public function getMethod()
26
    {
27
        return $this->method;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getPath()
34
    {
35
        return $this->path;
36
    }
37
38
    /**
39
     * @return array
40
     */
41
    public function getParams()
42
    {
43
        return $this->params;
44
    }
45
46
    /**
47
     * @param \Exception $e
48
     * @param            $method
49
     * @param            $path
50
     * @param array      $params
51
     *
52
     * @return ClientException
53
     */
54
    public static function newException(\Exception $e, $method, $path, array $params)
55
    {
56
        $self = new self(sprintf('Api method error: %s : %s', $method, $path), $e->getCode(), $e);
57
        $self->method = $method;
58
        $self->path = $path;
59
        $self->params = $params;
60
61
        return $self;
62
    }
63
}
64