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

CouldNotSendNotification::invalidMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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