Completed
Push — master ( eeb7ed...c2f085 )
by Atymic
01:10
created

CouldNotSendNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serviceRespondedWithAnError() 0 8 1
A invalidMessage() 0 4 1
1
<?php
2
3
namespace NotificationChannels\Fcm\Exceptions;
4
5
use Exception;
6
use Kreait\Firebase\Exception\MessagingException;
7
use Kreait\Firebase\Messaging\Message;
8
9
class CouldNotSendNotification extends Exception
10
{
11
    public static function serviceRespondedWithAnError(MessagingException $exception)
12
    {
13
        return new static(
14
            $exception->getMessage(),
15
            $exception->getCode(),
16
            $exception
17
        );
18
    }
19
20
    public static function invalidMessage()
21
    {
22
        return new static('The toFcm() method only accepts instances of ' . Message::class);
23
    }
24
}
25