Test Setup Failed
Push — master ( 9b202d...2a8146 )
by Craig
10:47 queued 13s
created

CouldNotSendNotification::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace NotificationChannels\Interfax\Exceptions;
4
5
use Exception;
6
use NotificationChannels\Interfax\InterfaxMessage;
7
8
class CouldNotSendNotification extends Exception
9
{
10
    protected $interfaxMessage;
11
    protected $responseAttributes;
12
13 6
    final public function __construct(string $message, int $code, Exception $previous = null, InterfaxMessage $interfaxMessage, array $responseAttributes)
14
    {
15 6
        parent::__construct($message, $code, $previous);
16
17 6
        $this->interfaxMessage = $interfaxMessage;
18 6
        $this->responseAttributes = $responseAttributes;
19
    }
20
21 6
    public static function serviceRespondedWithAnError($message, $responseAttributes, string $exceptionMessage = 'The fax failed to send via InterFAX.')
22
    {
23 6
        return new static($exceptionMessage, $responseAttributes['status'], null, $message, $responseAttributes);
24
    }
25
26 1
    public function getUser()
27
    {
28 1
        return $this->interfaxMessage->user;
29
    }
30
31 1
    public function getMetadata()
32
    {
33 1
        return $this->interfaxMessage->metadata;
34
    }
35
36 1
    public function getAttributes()
37
    {
38 1
        return $this->responseAttributes;
39
    }
40
}
41