XPathType   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 7
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A DataTypeAsString() 0 3 1
A jsonSerialize() 0 3 1
A __construct() 0 3 1
A __toString() 0 3 1
A DataTypeFromString() 0 3 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\DataTypes\DataType\Text;
8
9
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\DataType as Upstream;
10
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\DataType\Text as Base;
11
12
/**
13
* @template T as XPathType
14
*
15
* @template-implements Base<T>
16
*/
17
class XPathType implements Base
18
{
19
    /**
20
    * @var string
21
    */
22
    protected $text;
23
24 1
    protected function __construct(string $text)
25
    {
26 1
        $this->text = $text;
27 1
    }
28
29 1
    public function __toString() : string
30
    {
31 1
        return $this->text;
32
    }
33
34 1
    public function DataTypeAsString() : string
35
    {
36 1
        return $this->text;
37
    }
38
39 1
    public function jsonSerialize() : string
40
    {
41 1
        return $this->DataTypeAsString();
42
    }
43
44
    /**
45
    * @psalm-return T
46
    */
47 1
    public static function DataTypeFromString(string $value) : Upstream
48
    {
49 1
        return new static($value);
50
    }
51
}
52