Test Failed
Push — master ( 08de7a...d45f24 )
by Divine Niiquaye
11:57
created

GeneratedRoute::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Flight Routing.
7
 *
8
 * PHP version 7.4 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 Biurad Group (https://biurad.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Flight\Routing\Generator;
19
20
/**
21
 * @internal
22
 *
23
 * @author Divine Niiquaye Ibok <[email protected]>
24
 */
25
final class GeneratedRoute
26
{
27
    /** @var array<string,int> */
28
    private array $staticPaths;
29
30
    private ?string $dynamicRegex;
31
32
    /** @var array<int,mixed[]> */
33
    private array $variables;
34
35
    /**
36
     * @param array<string,int> $staticPaths
37
     * @param array<int,mixed[]> $variables
38
     */
39
    public function __construct(array $staticPaths, ?string $dynamicRegex, array $variables)
40
    {
41
        $this->dynamicRegex = $dynamicRegex;
42
        $this->staticPaths = $staticPaths;
43
        $this->variables = $variables;
44
    }
45
46
    /**
47
     * @internal
48
     */
49
    public function __serialize(): array
50
    {
51
        return [$this->staticPaths, $this->dynamicRegex, $this->variables];
52
    }
53
54
    /**
55
     * @internal
56
     *
57
     * @param array<int,mixed> $data
58
     */
59
    public function __unserialize(array $data): void
60
    {
61
        [$this->staticPaths, $this->dynamicRegex, $this->variables] = $data;
62
    }
63
64
    public function getData(): array
65
    {
66
        return [$this->staticPaths, $this->dynamicRegex, $this->variables];
67
    }
68
}
69