removeAnnotation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace TheCodingMachine\FluidSchema;
5
6
7
use function addslashes;
8
use function var_export;
9
10
class TdbmFluidJunctionTableGraphqlOptions
11
{
12
    /**
13
     * @var TdbmFluidJunctionTableOptions
14
     */
15
    private $tdbmFluidJunctionTableOptions;
16
    /**
17
     * @var TdbmFluidTable
18
     */
19
    private $tdbmFluidTable;
20
21
    public function __construct(TdbmFluidJunctionTableOptions $tdbmFluidJunctionTableOptions, TdbmFluidTable $tdbmFluidTable)
22
    {
23
        $this->tdbmFluidJunctionTableOptions = $tdbmFluidJunctionTableOptions;
24
        $this->tdbmFluidTable = $tdbmFluidTable;
25
    }
26
27
    public function logged(bool $mustBeLogged = true): self
28
    {
29
        if ($mustBeLogged) {
30
            $this->addAnnotation('TheCodingMachine\\GraphQLite\\Annotations\\Logged');
31
        } else {
32
            $this->removeAnnotation('TheCodingMachine\\GraphQLite\\Annotations\\Logged');
33
        }
34
        return $this;
35
    }
36
37
    public function right(string $rightName): self
38
    {
39
        $this->addAnnotation('TheCodingMachine\\GraphQLite\\Annotations\\Right', ['name'=>$rightName]);
40
        return $this;
41
    }
42
43
    public function failWith($value): self
44
    {
45
        $this->addAnnotation('TheCodingMachine\\GraphQLite\\Annotations\\FailWith', $value, true, true);
46
        return $this;
47
    }
48
49
    /**
50
     * @param string $annotation
51
     * @param mixed $content
52
     * @param bool $replaceExisting
53
     * @return TdbmFluidJunctionTableGraphqlOptions
54
     */
55
    public function addAnnotation(string $annotation, $content = null, bool $replaceExisting = true, bool $explicitNull = false): self
56
    {
57
        $this->tdbmFluidTable->addAnnotation($annotation, $content, $replaceExisting, $explicitNull);
58
        return $this;
59
    }
60
61
    public function removeAnnotation(string $annotation): self
62
    {
63
        $this->tdbmFluidTable->removeAnnotation($annotation);
64
        return $this;
65
    }
66
67
    public function endGraphql(): TdbmFluidJunctionTableOptions
68
    {
69
        return $this->tdbmFluidJunctionTableOptions;
70
    }
71
}
72