CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetadata() 0 3 1
A getAttributes() 0 3 1
A getUser() 0 3 1
A serviceRespondedWithAnError() 0 3 1
A __construct() 0 6 1
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