1
<?php
2

3
declare(strict_types=1);
4

5
namespace Kreait\Firebase\Messaging;
6

7
use JsonSerializable;
8

9
final class WebPushConfig implements JsonSerializable
10
{
11
    /** @var array<string, mixed> */
12
    private $rawConfig;
13

14 12
    private function __construct()
15
    {
16
    }
17

18
    /**
19
     * @param array<string, mixed> $data
20
     */
21 12
    public static function fromArray(array $data): self
22
    {
23 12
        $config = new self();
24 12
        $config->rawConfig = $data;
25

26 12
        return $config;
27
    }
28

29
    /**
30
     * @return array<string, mixed>
31
     */
32 12
    public function jsonSerialize(): array
33
    {
34
        return \array_filter($this->rawConfig, static function ($value) {
35 12
            return $value !== null;
36 12
        });
37
    }
38
}

Read our documentation on viewing source code .

Loading