Passed
Push — master ( 813b52...b69cbb )
by Arthur
03:02
created
src/Blocks/Tests.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
         $this->startMethod($methodOpts);
80 80
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO,
81 81
             [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName
82
-             . PhpInterface::SPACE . MethodsInterface::VIEW]);
82
+                . PhpInterface::SPACE . MethodsInterface::VIEW]);
83 83
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_GET,
84 84
             [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName)
85
-             . PhpInterface::SLASH . $id]);
85
+                . PhpInterface::SLASH . $id]);
86 86
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON);
87 87
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false);
88 88
         $this->endMethod();
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
         $this->startMethod($methodOpts);
98 98
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO,
99 99
             [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName
100
-             . PhpInterface::SPACE . MethodsInterface::CREATE]);
100
+                . PhpInterface::SPACE . MethodsInterface::CREATE]);
101 101
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_POST,
102 102
             [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName),
103
-             $this->getJsonApiRequest()]);
103
+                $this->getJsonApiRequest()]);
104 104
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON);
105 105
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false);
106 106
         $this->endMethod();
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         $this->startMethod($methodOpts);
117 117
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO,
118 118
             [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName
119
-             . PhpInterface::SPACE . MethodsInterface::UPDATE]);
119
+                . PhpInterface::SPACE . MethodsInterface::UPDATE]);
120 120
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_PATCH,
121 121
             [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName)
122
-             . PhpInterface::SLASH . $id, $this->getJsonApiRequest()]);
122
+                . PhpInterface::SLASH . $id, $this->getJsonApiRequest()]);
123 123
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON);
124 124
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false);
125 125
         $this->endMethod();
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $this->startMethod($methodOpts);
139 139
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO,
140 140
             [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName
141
-             . PhpInterface::SPACE . MethodsInterface::DELETE]);
141
+                . PhpInterface::SPACE . MethodsInterface::DELETE]);
142 142
         $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_DELETE,
143 143
             [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName) . PhpInterface::SLASH . $id]);
144 144
         $this->endMethod();
Please login to merge, or discard this patch.
src/Blocks/FormRequest.php 2 patches
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,8 +133,7 @@  discard block
 block discarded – undo
133 133
         // attrs validation
134 134
         $this->startArray();
135 135
         if (empty($relationTypes) === false) {
136
-            $rel = empty($relationTypes[ApiInterface::RAML_TYPE]) ? $relationTypes :
137
-                $relationTypes[ApiInterface::RAML_TYPE];
136
+            $rel = empty($relationTypes[ApiInterface::RAML_TYPE]) ? $relationTypes : $relationTypes[ApiInterface::RAML_TYPE];
138 137
 
139 138
             $rels = explode(PhpInterface::PIPE, str_replace('[]', '', $rel));
140 139
             foreach ($rels as $k => $rel) {
@@ -230,7 +229,7 @@  discard block
 block discarded – undo
230 229
                   [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false
231 230
         ) {
232 231
             $this->setAccessTokenContent();
233
-            $fileForm  = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir
232
+            $fileForm = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir
234 233
                 . PhpInterface::SLASH . JSONApiInterface::CLASS_API_ACCESS_TOKEN
235 234
                 . PhpInterface::PHP_EXT;
236 235
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@
 block discarded – undo
264 264
     public function createAccessToken()
265 265
     {
266 266
         if (empty($this->generator->types[CustomsInterface::CUSTOM_TYPES_QUERY_PARAMS][ApiInterface::RAML_PROPS]
267
-                  [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false
267
+                    [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false
268 268
         ) {
269 269
             $this->setAccessTokenContent();
270 270
             $fileForm  = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir
Please login to merge, or discard this patch.
src/Blocks/FileManager.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
     public static function migrationNotExists(Command $obj, string $migrationName): bool
105 105
     {
106 106
         $path  = FileManager::getModulePath($obj) . self::DATABASE_DIR . PhpInterface::SLASH
107
-                 . $obj->migrationsDir . PhpInterface::SLASH;
107
+                    . $obj->migrationsDir . PhpInterface::SLASH;
108 108
         $file  = $path . PhpInterface::ASTERISK . $migrationName
109
-                 . PhpInterface::PHP_EXT;
109
+                    . PhpInterface::PHP_EXT;
110 110
         $files = glob($file);
111 111
 
112 112
         return empty($files) ? true : false;
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
     public static function getPivotFile(string $firstEntity, string $secondEntity): string
124 124
     {
125 125
         return DirsInterface::MODULES_DIR . PhpInterface::SLASH
126
-               . ConfigHelper::getModuleName() . PhpInterface::SLASH .
127
-               DirsInterface::ENTITIES_DIR . PhpInterface::SLASH .
128
-               $firstEntity . $secondEntity . PhpInterface::PHP_EXT;
126
+                . ConfigHelper::getModuleName() . PhpInterface::SLASH .
127
+                DirsInterface::ENTITIES_DIR . PhpInterface::SLASH .
128
+                $firstEntity . $secondEntity . PhpInterface::PHP_EXT;
129 129
     }
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public static function createFile($fileName, $content, $isNew = false): bool
28 28
     {
29
-        if($isNew === true || file_exists($fileName) === false)
29
+        if ($isNew === true || file_exists($fileName) === false)
30 30
         {
31 31
             $fp = fopen($fileName, self::FILE_MODE_CREATE);
32 32
             fwrite($fp, $content);
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public static function createPath($path)
46 46
     {
47
-        if(is_dir($path) === false)
47
+        if (is_dir($path) === false)
48 48
         {
49
-            if(mkdir($path, self::DIR_MODE, true) === false)
49
+            if (mkdir($path, self::DIR_MODE, true) === false)
50 50
             {
51 51
                 throw new DirectoryException(
52 52
                     'Couldn`t create directory '
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         /** @var ApiGenerator $obj */
74 74
         $path = $obj->modulesDir . PhpInterface::SLASH . strtoupper($obj->version) . PhpInterface::SLASH;
75 75
 
76
-        if($http === true)
76
+        if ($http === true)
77 77
         {
78 78
             $path .= $obj->httpDir . PhpInterface::SLASH;
79 79
         }
Please login to merge, or discard this patch.
src/Blocks/ConfigTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
     private function openCache(string $entity): void
104 104
     {
105 105
         $this->openEntity(strtolower($entity), 2);
106
-        $this->setParam(ConfigInterface::ENABLED,  ApiInterface::RAML_TYPE_BOOLEAN,PhpInterface::PHP_TYPES_BOOL_TRUE, 3);
106
+        $this->setParam(ConfigInterface::ENABLED, ApiInterface::RAML_TYPE_BOOLEAN, PhpInterface::PHP_TYPES_BOOL_TRUE, 3);
107 107
     }
108 108
 
109 109
     /**
Please login to merge, or discard this patch.
src/Extension/ApiController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
         }
159 159
 
160 160
         $resource = Json::getResource($this->formRequest, $item, $this->entity, false, $meta);
161
-        return $this->getResponse(Json::prepareSerializedData($resource,  $data));
161
+        return $this->getResponse(Json::prepareSerializedData($resource, $data));
162 162
     }
163 163
 
164 164
     /**
Please login to merge, or discard this patch.
src/Extension/SpellCheck.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Extension/OptionsTrait.php 1 patch
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,12 +34,9 @@
 block discarded – undo
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]
Please login to merge, or discard this patch.
src/Extension/StateMachine.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Extension/BitMaskTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.