RestException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 8
c 4
b 0
f 0
dl 0
loc 28
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A errorMessage() 0 5 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace InShore\Bookwhen\Exceptions;
6
7
/**
8
 * InshoreBookwhenRestException Class
9
 *
10
 * @package inshore\bookwhen
11
 */
12
class RestException extends InshoreBookwhenException
13
{
14
    /** @var \Exception the thrown exception. */
15
    private $e;
16
17
    /** @var \Monolog\Logger the thrown exception. */
18
    private $logger;
19
20
    /**
21
     *
22
     * @param \Exception $e
23
     * @param \Monolog\Logger $logger
24
     */
25
    public function __construct($e, $logger)
26
    {
27
        $this->e = $e;
28
        $this->logger = $logger;
29
    }
30
31
    /**
32
     *
33
     * @return string the error messsage.
34
     */
35
    public function errorMessage(): string
36
    {
37
        $this->logger->error($this->e->getMessage());
38
        $this->logger->debug(var_export($this->e->getMessage(), true));
39
        return $this->e->getMessage();
40
    }
41
}
42
43
//EOF!
44