RestException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
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