TopicMessageResponseEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of the FirebaseCloudMessagingBundle.
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\FirebaseCloudMessagingBundle\Event;
14
15
use Symfony\Contracts\EventDispatcher\Event;
16
17
/**
18
 * TopicMessageResponseEvent.
19
 *
20
 * @see https://firebase.google.com/docs/cloud-messaging/http-server-ref#table6
21
 *
22
 * @author Artem Henvald <[email protected]>
23
 */
24
class TopicMessageResponseEvent extends Event
25
{
26
    /**
27
     * The topic message ID when FCM has successfully received the request
28
     * and will attempt to deliver to all subscribed devices.
29
     *
30
     * @var int
31
     */
32
    private $messageId;
33
34
    /**
35
     * Error that occurred when processing the message.
36
     *
37
     * @var string
38
     */
39
    private $error;
40
41
    /**
42
     * @param int    $messageId
43
     * @param string $error
44
     */
45
    public function __construct(int $messageId, string $error)
46
    {
47
        $this->messageId = $messageId;
48
        $this->error = $error;
49
    }
50
51
    /**
52
     * @return int
53
     */
54
    public function getMessageId(): int
55
    {
56
        return $this->messageId;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getError(): string
63
    {
64
        return $this->error;
65
    }
66
}
67