Passed
Pull Request — master (#2)
by Sergey
03:11
created

RunModel::isResultAuth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * Created by PhpStorm.
5
 * Project: json-rpc-server
6
 * User: sv
7
 * Date: 06.01.2021
8
 * Time: 19:17
9
 */
10
11
declare(strict_types=1);
12
13
namespace Onnov\JsonRpcServer\Model;
14
15
use Onnov\JsonRpcServer\ApiFactoryInterface;
16
17
/**
18
 * Class RunModel
19
 * @package Onnov\JsonRpcServer\Model
20
 */
21
class RunModel
22
{
23
    /** @var ApiFactoryInterface */
24
    private $apiFactory;
25
26
    /** @var string */
27
    private $json;
28
29
    /** @var bool */
30
    private $resultAuth;
31
32
    /** @var string[] */
33
    private $methodsWithoutAuth;
34
35
    /** @var bool */
36
    private $responseCheck;
37
38
    /**
39
     * RunModel constructor.
40
     * @param ApiFactoryInterface $apiFactory
41
     * @param string $json
42
     * @param bool $resultAuth
43
     * @param string[] $methodsWithoutAuth
44
     * @param bool $responseCheck
45
     */
46 6
    public function __construct(
47
        ApiFactoryInterface $apiFactory,
48
        string $json,
49
        bool $resultAuth = true,
50
        array $methodsWithoutAuth = [],
51
        bool $responseCheck = false
52
    ) {
53
        $this
54 6
            ->setApiFactory($apiFactory)
55 6
            ->setJson($json)
56 6
            ->setResultAuth($resultAuth)
57 6
            ->setMethodsWithoutAuth($methodsWithoutAuth)
58 6
            ->setResponseCheck($responseCheck);
59 6
    }
60
61
    /**
62
     * @return ApiFactoryInterface
63
     */
64 3
    public function getApiFactory(): ApiFactoryInterface
65
    {
66 3
        return $this->apiFactory;
67
    }
68
69
    /**
70
     * @param ApiFactoryInterface $apiFactory
71
     * @return RunModel
72
     */
73 6
    public function setApiFactory(ApiFactoryInterface $apiFactory): self
74
    {
75 6
        $this->apiFactory = $apiFactory;
76
77 6
        return $this;
78
    }
79
80
    /**
81
     * @return string
82
     */
83 6
    public function getJson(): string
84
    {
85 6
        return $this->json;
86
    }
87
88
    /**
89
     * @param string $json
90
     * @return RunModel
91
     */
92 6
    public function setJson(string $json): self
93
    {
94 6
        $this->json = $json;
95
96 6
        return $this;
97
    }
98
99
    /**
100
     * @return bool
101
     */
102 4
    public function isResultAuth(): bool
103
    {
104 4
        return $this->resultAuth;
105
    }
106
107
    /**
108
     * @param bool $resultAuth
109
     * @return RunModel
110
     */
111 6
    public function setResultAuth(bool $resultAuth): self
112
    {
113 6
        $this->resultAuth = $resultAuth;
114
115 6
        return $this;
116
    }
117
118
    /**
119
     * @return string[]
120
     */
121 4
    public function getMethodsWithoutAuth(): array
122
    {
123 4
        return $this->methodsWithoutAuth;
124
    }
125
126
    /**
127
     * @param string[] $methodsWithoutAuth
128
     * @return RunModel
129
     */
130 6
    public function setMethodsWithoutAuth(array $methodsWithoutAuth): self
131
    {
132 6
        $this->methodsWithoutAuth = $methodsWithoutAuth;
133
134 6
        return $this;
135
    }
136
137
    /**
138
     * @return bool
139
     */
140 2
    public function isResponseCheck(): bool
141
    {
142 2
        return $this->responseCheck;
143
    }
144
145
    /**
146
     * @param bool $responseCheck
147
     * @return RunModel
148
     */
149 6
    public function setResponseCheck(bool $responseCheck): self
150
    {
151 6
        $this->responseCheck = $responseCheck;
152
153 6
        return $this;
154
    }
155
}
156