1
<?php
2

3
declare(strict_types=1);
4

5
namespace Kreait\Firebase\DynamicLink;
6

7
use Kreait\Firebase\DynamicLink;
8
use Kreait\Firebase\Value\Url;
9
use Psr\Http\Message\UriInterface;
10

11
final class GetStatisticsForDynamicLink
12
{
13
    public const DEFAULT_DURATION_IN_DAYS = 7;
14

15
    /** @var string */
16
    private $dynamicLink;
17

18
    /** @var int */
19
    private $durationInDays;
20

21 12
    private function __construct()
22
    {
23
    }
24

25
    /**
26
     * @param Url|UriInterface|string|DynamicLink|mixed $link
27
     */
28 12
    public static function forLink($link): self
29
    {
30 12
        $action = new self();
31 12
        $action->dynamicLink = (string) Url::fromValue((string) $link);
32 12
        $action->durationInDays = self::DEFAULT_DURATION_IN_DAYS;
33

34 12
        return $action;
35
    }
36

37 3
    public function withDurationInDays(int $durationInDays): self
38
    {
39 3
        $action = clone $this;
40 3
        $action->durationInDays = $durationInDays;
41

42 3
        return $action;
43
    }
44

45 12
    public function dynamicLink(): string
46
    {
47 12
        return $this->dynamicLink;
48
    }
49

50 12
    public function durationInDays(): int
51
    {
52 12
        return $this->durationInDays;
53
    }
54
}

Read our documentation on viewing source code .

Loading