Test Failed
Pull Request — master (#2)
by Sergey
03:54
created

RunModel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
rs 10
cc 1
nc 1
nop 5
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
    public function __construct(
47
        ApiFactoryInterface $apiFactory,
48
        string $json,
49
        bool $resultAuth = true,
50
        array $methodsWithoutAuth = [],
51
        bool $responseCheck = false
52
    ) {
53
        $this
54
            ->setApiFactory($apiFactory)
55
            ->setJson($json)
56
            ->setResultAuth($resultAuth)
57
            ->setMethodsWithoutAuth($methodsWithoutAuth)
58
            ->setResponseCheck($responseCheck);
59
    }
60
61
    /**
62
     * @return ApiFactoryInterface
63
     */
64
    public function getApiFactory(): ApiFactoryInterface
65
    {
66
        return $this->apiFactory;
67
    }
68
69
    /**
70
     * @param ApiFactoryInterface $apiFactory
71
     * @return RunModel
72
     */
73
    public function setApiFactory(ApiFactoryInterface $apiFactory): self
74
    {
75
        $this->apiFactory = $apiFactory;
76
77
        return $this;
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getJson(): string
84
    {
85
        return $this->json;
86
    }
87
88
    /**
89
     * @param string $json
90
     * @return RunModel
91
     */
92
    public function setJson(string $json): self
93
    {
94
        $this->json = $json;
95
96
        return $this;
97
    }
98
99
    /**
100
     * @return bool
101
     */
102
    public function isResultAuth(): bool
103
    {
104
        return $this->resultAuth;
105
    }
106
107
    /**
108
     * @param bool $resultAuth
109
     * @return RunModel
110
     */
111
    public function setResultAuth(bool $resultAuth): self
112
    {
113
        $this->resultAuth = $resultAuth;
114
115
        return $this;
116
    }
117
118
    /**
119
     * @return string[]
120
     */
121
    public function getMethodsWithoutAuth(): array
122
    {
123
        return $this->methodsWithoutAuth;
124
    }
125
126
    /**
127
     * @param string[] $methodsWithoutAuth
128
     * @return RunModel
129
     */
130
    public function setMethodsWithoutAuth(array $methodsWithoutAuth): self
131
    {
132
        $this->methodsWithoutAuth = $methodsWithoutAuth;
133
134
        return $this;
135
    }
136
137
    /**
138
     * @return bool
139
     */
140
    public function isResponseCheck(): bool
141
    {
142
        return $this->responseCheck;
143
    }
144
145
    /**
146
     * @param bool $responseCheck
147
     * @return RunModel
148
     */
149
    public function setResponseCheck(bool $responseCheck): self
150
    {
151
        $this->responseCheck = $responseCheck;
152
153
        return $this;
154
    }
155
}
156