Passed
Push — master ( 5e2a38...990aad )
by Andrés
03:46
created

CouldNotSendNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A serviceRespondedWithAnError() 0 6 3
1
<?php
2
3
namespace Andreshg112\PusherApiNotifications\Exceptions;
4
5
class CouldNotSendNotification extends \Exception
6
{
7
    public static function serviceRespondedWithAnError($response)
8
    {
9
        $encodedResponse = is_string($response) || is_bool($response)
10
            ? $response : json_encode($response);
11
12
        return new static("Message could not be sent: $encodedResponse");
13
    }
14
}
15