Type::isReadOperation()   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
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
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