@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->isEnabled = empty($this->entity[$this->field][ConfigInterface::ENABLED]) ? false : true; |
26 | 26 | $this->language = empty($this->entity[$this->field][ConfigInterface::LANGUAGE]) ? ConfigInterface::DEFAULT_LANGUAGE |
27 | 27 | : $this->entity[$this->field][ConfigInterface::LANGUAGE]; |
28 | - if($this->isEnabled === true) { |
|
28 | + if ($this->isEnabled === true) { |
|
29 | 29 | $this->speLink = pspell_new($this->language, '', '', '', PSPELL_FAST); |
30 | 30 | } |
31 | 31 | } |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $failed = []; |
42 | 42 | $cleanText = $this->cleanText($text); |
43 | 43 | $words = explode(PhpInterface::SPACE, $cleanText); |
44 | - foreach($words as $k => $word) { |
|
44 | + foreach ($words as $k => $word) { |
|
45 | 45 | $pass = pspell_check($this->speLink, $word); |
46 | - if($pass === false) { |
|
46 | + if ($pass === false) { |
|
47 | 47 | $failed[] = $word; |
48 | 48 | } |
49 | 49 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function getFlags() |
46 | 46 | { |
47 | - if(empty($this->entity[$this->field][ConfigInterface::FLAGS])) { |
|
47 | + if (empty($this->entity[$this->field][ConfigInterface::FLAGS])) { |
|
48 | 48 | throw new AttributesException(ErrorsInterface::JSON_API_ERRORS[ErrorsInterface::HTTP_CODE_FSM_FLAGS], ErrorsInterface::HTTP_CODE_FSM_FLAGS); |
49 | 49 | } |
50 | 50 | return $this->entity[$this->field][ConfigInterface::FLAGS]; |
@@ -34,12 +34,9 @@ |
||
34 | 34 | private function setSqlOptions(Request $request) : SqlOptions |
35 | 35 | { |
36 | 36 | $sqlOptions = new SqlOptions(); |
37 | - $page = ($request->input(ModelsInterface::PARAM_PAGE) === null) ? $this->defaultPage : |
|
38 | - $request->input(ModelsInterface::PARAM_PAGE); |
|
39 | - $limit = ($request->input(ModelsInterface::PARAM_LIMIT) === null) ? $this->defaultLimit : |
|
40 | - $request->input(ModelsInterface::PARAM_LIMIT); |
|
41 | - $sort = ($request->input(ModelsInterface::PARAM_SORT) === null) ? $this->defaultSort : |
|
42 | - $request->input(ModelsInterface::PARAM_SORT); |
|
37 | + $page = ($request->input(ModelsInterface::PARAM_PAGE) === null) ? $this->defaultPage : $request->input(ModelsInterface::PARAM_PAGE); |
|
38 | + $limit = ($request->input(ModelsInterface::PARAM_LIMIT) === null) ? $this->defaultLimit : $request->input(ModelsInterface::PARAM_LIMIT); |
|
39 | + $sort = ($request->input(ModelsInterface::PARAM_SORT) === null) ? $this->defaultSort : $request->input(ModelsInterface::PARAM_SORT); |
|
43 | 40 | $data = ($request->input(ModelsInterface::PARAM_DATA) === null) ? ModelsInterface::DEFAULT_DATA |
44 | 41 | : Json::decode($request->input(ModelsInterface::PARAM_DATA)); |
45 | 42 | $orderBy = ($request->input(ModelsInterface::PARAM_ORDER_BY) === null) ? [ApiInterface::RAML_ID => $sort] |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function setStates(string $field) : void |
68 | 68 | { |
69 | - if(empty($this->machine[$field][ConfigInterface::STATES])) { |
|
69 | + if (empty($this->machine[$field][ConfigInterface::STATES])) { |
|
70 | 70 | throw new AttributesException(ErrorsInterface::JSON_API_ERRORS[ErrorsInterface::HTTP_CODE_BULK_EXT_ERROR], ErrorsInterface::HTTP_CODE_BULK_EXT_ERROR); |
71 | 71 | } |
72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setInitial(string $field) : void |
81 | 81 | { |
82 | - if(empty($this->machine[$field][ConfigInterface::STATES][ConfigInterface::INITIAL][0])) { |
|
82 | + if (empty($this->machine[$field][ConfigInterface::STATES][ConfigInterface::INITIAL][0])) { |
|
83 | 83 | throw new AttributesException('There should be an initial value for: "' . $field . '" field."', ErrorsInterface::HTTP_CODE_FSM_INIT_ATTR); |
84 | 84 | } |
85 | 85 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | $data->map(function($v) { |
21 | 21 | $field = $this->bitMask->getField(); |
22 | - if(isset($v[$field])) { |
|
22 | + if (isset($v[$field])) { |
|
23 | 23 | $flags = $this->bitMask->getFlags(); |
24 | 24 | $mask = $v[$field]; |
25 | - foreach($flags as $flag => $fVal) { |
|
25 | + foreach ($flags as $flag => $fVal) { |
|
26 | 26 | $v[$flag] = (bool)($fVal & $mask); |
27 | 27 | } |
28 | 28 | } |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | protected function setFlagsView(BaseModel $data) |
40 | 40 | { |
41 | 41 | $field = $this->bitMask->getField(); |
42 | - if(isset($data[$field])) { |
|
42 | + if (isset($data[$field])) { |
|
43 | 43 | $flags = $this->bitMask->getFlags(); |
44 | 44 | $mask = $data[$field]; |
45 | - foreach($flags as $flag => $fVal) { |
|
45 | + foreach ($flags as $flag => $fVal) { |
|
46 | 46 | $data[$flag] = ($fVal & $mask) ? true : false; |
47 | 47 | } |
48 | 48 | } |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | { |
59 | 59 | $field = $this->bitMask->getField(); |
60 | 60 | $flags = $this->bitMask->getFlags(); |
61 | - foreach($flags as $flag => $fVal) { |
|
61 | + foreach ($flags as $flag => $fVal) { |
|
62 | 62 | if (isset($jsonProps[$flag])) { |
63 | - if (true === (bool) $jsonProps[$flag]) { |
|
63 | + if (true === (bool)$jsonProps[$flag]) { |
|
64 | 64 | $this->model->$field |= $fVal; |
65 | - } else if (false === (bool) $jsonProps[$flag]) { |
|
65 | + } else if (false === (bool)$jsonProps[$flag]) { |
|
66 | 66 | $this->model->$field &= ~$fVal; |
67 | 67 | } |
68 | 68 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | protected function setFlagsCreate() |
78 | 78 | { |
79 | 79 | $field = $this->bitMask->getField(); |
80 | - if(isset($this->model->$field)) { |
|
80 | + if (isset($this->model->$field)) { |
|
81 | 81 | $flags = $this->bitMask->getFlags(); |
82 | 82 | $mask = $this->model->$field; |
83 | - foreach($flags as $flag => $fVal) { |
|
83 | + foreach ($flags as $flag => $fVal) { |
|
84 | 84 | $this->model->$flag = (bool)($fVal & $mask); |
85 | 85 | } |
86 | 86 | } |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | { |
99 | 99 | $field = $this->bitMask->getField(); |
100 | 100 | $flags = $this->bitMask->getFlags(); |
101 | - foreach($flags as $flag => $fVal) { |
|
101 | + foreach ($flags as $flag => $fVal) { |
|
102 | 102 | if (isset($jsonProps[$flag])) { |
103 | - if (true === (bool) $jsonProps[$flag]) { |
|
103 | + if (true === (bool)$jsonProps[$flag]) { |
|
104 | 104 | $model->$field |= $fVal; |
105 | - } else if (false === (bool) $jsonProps[$flag]) { |
|
105 | + } else if (false === (bool)$jsonProps[$flag]) { |
|
106 | 106 | $model->$field &= ~$fVal; |
107 | 107 | } |
108 | 108 | } |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | protected function setFlagsUpdate(&$model) : void |
119 | 119 | { |
120 | 120 | $field = $this->bitMask->getField(); |
121 | - if(isset($model[$field])) { |
|
121 | + if (isset($model[$field])) { |
|
122 | 122 | $flags = $this->bitMask->getFlags(); |
123 | 123 | $mask = $model[$field]; |
124 | - foreach($flags as $flag => $fVal) { |
|
124 | + foreach ($flags as $flag => $fVal) { |
|
125 | 125 | $model[$flag] = (bool)($fVal & $mask); |
126 | 126 | } |
127 | 127 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | protected function createJwtUser() |
21 | 21 | { |
22 | - if(empty($this->model->password)) { |
|
22 | + if (empty($this->model->password)) { |
|
23 | 23 | Json::outputErrors( |
24 | 24 | [ |
25 | 25 | [ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | private function updateJwtUser(&$model, $jsonApiAttributes) |
48 | 48 | { |
49 | - if(password_verify($jsonApiAttributes[JwtInterface::PASSWORD], $model->password) === false) { |
|
49 | + if (password_verify($jsonApiAttributes[JwtInterface::PASSWORD], $model->password) === false) { |
|
50 | 50 | Json::outputErrors( |
51 | 51 | [ |
52 | 52 | [ |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class CustomSql |
9 | 9 | { |
10 | - private $entity = []; |
|
10 | + private $entity = []; |
|
11 | 11 | private $isEnabled; |
12 | 12 | |
13 | 13 | public function __construct(string $entity) |
@@ -11,12 +11,12 @@ |
||
11 | 11 | { |
12 | 12 | public function handle($request, Closure $next) |
13 | 13 | { |
14 | - if(ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) { |
|
15 | - if(empty($request->jwt)) { |
|
14 | + if (ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) { |
|
15 | + if (empty($request->jwt)) { |
|
16 | 16 | die('JWT token required.'); |
17 | 17 | } |
18 | 18 | $token = (new Parser())->parse((string)$request->jwt); |
19 | - if(Jwt::verify($token, $token->getHeader('jti')) === false) { |
|
19 | + if (Jwt::verify($token, $token->getHeader('jti')) === false) { |
|
20 | 20 | header('HTTP/1.1 403 Forbidden'); |
21 | 21 | die('Access forbidden.'); |
22 | 22 | } |