Completed
Pull Request — master (#75)
by
unknown
01:12
created

CouldNotSendNotification::invalidToken()   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 invalidToken()
21
    {
22
        return new static('The notifiable did not have a fcm token.');
23
    }
24
25
    public static function invalidMessage()
26
    {
27
        return new static('The toFcm() method only accepts instances of ' . Message::class);
28
    }
29
}
30