Type   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 31
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isReadOperation() 0 3 1
A post() 0 3 1
A get() 0 3 1
A __toString() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\RestResource;
4
5
final class Type implements RelationshipType
6
{
7
    /** @var string */
8
    private $type;
9
    /** @var bool */
10
    private $isReadOperation;
11
12
    public function __construct(string $type, bool $isReadOperation)
13
    {
14
        $this->type = $type;
15
        $this->isReadOperation = $isReadOperation;
16
    }
17
18
    public static function get(string $type): self
19
    {
20
        return new self($type, true);
21
    }
22
23
    public static function post(string $type): self
24
    {
25
        return new self($type, false);
26
    }
27
28
    public function __toString(): string
29
    {
30
        return $this->type;
31
    }
32
33
    public function isReadOperation(): bool
34
    {
35
        return $this->isReadOperation;
36
    }
37
}
38