Ok::unparsed()   A
last analyzed

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Parser\Results;
4
5
use Stratadox\Parser\Result;
6
7
/**
8
 * Ok Result
9
 *
10
 * Successful parsing result.
11
 */
12
final class Ok implements Result
13
{
14
    public function __construct(
15
        private mixed $data,
16
        private string $unparsed,
17
    ) {}
18
19
    public static function with(mixed $data, string $unparsed): Result
20
    {
21
        return new self($data, $unparsed);
22
    }
23
24
    public function data(): mixed
25
    {
26
        return $this->data;
27
    }
28
29
    public function unparsed(): string
30
    {
31
        return $this->unparsed;
32
    }
33
34
    public function ok(): bool
35
    {
36
        return true;
37
    }
38
39
    public function use(): bool
40
    {
41
        return true;
42
    }
43
}
44