Passed
Push — master ( b5f26b...e951dd )
by Arthur
03:06
created
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.
src/Extension/JWTTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                     [
Please login to merge, or discard this patch.
src/Blocks/ContentManager.php 1 patch
Spacing   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,15 +80,13 @@  discard block
 block discarded – undo
80 80
     protected function startMethod(MethodOptions $methodOptions) : void
81 81
     {
82 82
         // get params
83
-        $params           = $this->getMethodParams($methodOptions->getParams());
83
+        $params = $this->getMethodParams($methodOptions->getParams());
84 84
         $this->sourceCode .= PhpInterface::TAB_PSR4 . $methodOptions->getModifier() . PhpInterface::SPACE .
85
-            (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE :
86
-                '') .
85
+            (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE : '') .
87 86
             PhpInterface::PHP_FUNCTION . PhpInterface::SPACE .
88 87
             $methodOptions->getName()
89 88
             . PhpInterface::OPEN_PARENTHESES . $params . PhpInterface::CLOSE_PARENTHESES .
90
-            ((empty($methodOptions->getReturnType())) ? '' :
91
-                PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) .
89
+            ((empty($methodOptions->getReturnType())) ? '' : PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) .
92 90
             PhpInterface::SPACE . PHP_EOL . PhpInterface::TAB_PSR4
93 91
             . PhpInterface::OPEN_BRACE . PHP_EOL;
94 92
     }
@@ -102,8 +100,7 @@  discard block
 block discarded – undo
102 100
     protected function setMethodReturn(string $value, $isString = false) : void
103 101
     {
104 102
         $this->setTabs(2);
105
-        $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value :
106
-                PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL;
103
+        $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value : PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL;
107 104
     }
108 105
 
109 106
     /**
@@ -146,7 +143,7 @@  discard block
 block discarded – undo
146 143
      */
147 144
     private function setArrayProperty($key, array $value) : void
148 145
     {
149
-        $val              = $this->setArrayToString($value);
146
+        $val = $this->setArrayToString($value);
150 147
         $this->sourceCode .= $this->quoteParam($key)
151 148
             . PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW
152 149
             . PhpInterface::SPACE . $val . PhpInterface::COMMA . PHP_EOL;
@@ -177,7 +174,7 @@  discard block
 block discarded – undo
177 174
      */
178 175
     protected function createPropertyArray(string $prop, string $modifier, array $value) : void
179 176
     {
180
-        $val              = $this->setArrayToString($value);
177
+        $val = $this->setArrayToString($value);
181 178
         $this->sourceCode .= PhpInterface::TAB_PSR4 . $modifier . PhpInterface::SPACE . PhpInterface::DOLLAR_SIGN .
182 179
             $prop . PhpInterface::SPACE . PhpInterface::EQUALS . PhpInterface::SPACE . $val . PhpInterface::SEMICOLON . PHP_EOL;
183 180
     }
@@ -417,7 +414,7 @@  discard block
 block discarded – undo
417 414
         if ($till === null) {
418 415
             $this->sourceCode .= mb_substr($this->resourceCode, $start, null, PhpInterface::ENCODING_UTF8);
419 416
         } else {
420
-            $end              = mb_strpos($this->resourceCode, $till, null, PhpInterface::ENCODING_UTF8) - 3;
417
+            $end = mb_strpos($this->resourceCode, $till, null, PhpInterface::ENCODING_UTF8) - 3;
421 418
             $this->sourceCode .= mb_substr($this->resourceCode, $start, $end - $start, PhpInterface::ENCODING_UTF8);
422 419
         }
423 420
     }
@@ -427,7 +424,7 @@  discard block
 block discarded – undo
427 424
      */
428 425
     private function setAfterMethods() : void
429 426
     {
430
-        $start            = mb_strpos($this->resourceCode, DefaultInterface::METHOD_END, null, PhpInterface::ENCODING_UTF8) - 3;
427
+        $start = mb_strpos($this->resourceCode, DefaultInterface::METHOD_END, null, PhpInterface::ENCODING_UTF8) - 3;
431 428
         $this->sourceCode .= $this->setTabs() . mb_substr($this->resourceCode, $start, null, PhpInterface::ENCODING_UTF8);
432 429
     }
433 430
 
Please login to merge, or discard this patch.
src/Extension/BaseJwt.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
      */
30 30
     public function handle($request, Closure $next)
31 31
     {
32
-        if(ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) {
33
-            if(empty($request->jwt)) {
32
+        if (ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) {
33
+            if (empty($request->jwt)) {
34 34
                 die('JWT token required.');
35 35
             }
36 36
             $token = (new Parser())->parse((string)$request->jwt);
37
-            if(Jwt::verify($token, $token->getHeader('jti')) === false) {
37
+            if (Jwt::verify($token, $token->getHeader('jti')) === false) {
38 38
                 header('HTTP/1.1 403 Forbidden');
39 39
                 die('Access forbidden.');
40 40
             }
Please login to merge, or discard this patch.
src/Extension/CustomSql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  */
12 12
 class CustomSql
13 13
 {
14
-    private $entity    = [];
14
+    private $entity = [];
15 15
     private $isEnabled;
16 16
 
17 17
     /**
Please login to merge, or discard this patch.
src/Extension/BitMask.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class BitMask
13 13
 {
14
-    private $entity    = [];
14
+    private $entity = [];
15 15
     private $field;
16 16
     private $isEnabled;
17 17
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function getFlags()
50 50
     {
51
-        if(empty($this->entity[$this->field][ConfigInterface::FLAGS])) {
51
+        if (empty($this->entity[$this->field][ConfigInterface::FLAGS])) {
52 52
             throw new AttributesException(ErrorsInterface::JSON_API_ERRORS[ErrorsInterface::HTTP_CODE_FSM_FLAGS], ErrorsInterface::HTTP_CODE_FSM_FLAGS);
53 53
         }
54 54
         return $this->entity[$this->field][ConfigInterface::FLAGS];
Please login to merge, or discard this patch.
src/Controllers/HistoryTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -351,10 +351,10 @@
 block discarded – undo
351 351
                     $this->historyTypes = $dataHistory[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS];
352 352
                     $this->types += array_merge_recursive($this->historyTypes, $this->currentTypes);
353 353
 
354
-                    $attrsCurrent += array_filter($this->currentTypes, function ($k) {
354
+                    $attrsCurrent += array_filter($this->currentTypes, function($k) {
355 355
                         return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false;
356 356
                     }, ARRAY_FILTER_USE_KEY);
357
-                    $attrsHistory += array_filter($this->historyTypes, function ($k) {
357
+                    $attrsHistory += array_filter($this->historyTypes, function($k) {
358 358
                         return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false;
359 359
                     }, ARRAY_FILTER_USE_KEY);
360 360
                 }
Please login to merge, or discard this patch.
src/Blocks/Migrations.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     public function create()
45 45
     {
46 46
         $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE .
47
-                         $this->tableName .
48
-                         PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE;
47
+                            $this->tableName .
48
+                            PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE;
49 49
         $attrKey = $this->generator->objectName . CustomsInterface::CUSTOM_TYPES_ATTRIBUTES;
50 50
 
51 51
         $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName);
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
             foreach($relations as $relationEntity)
81 81
             {
82 82
                 $entityFile = $this->generator->formatEntitiesPath()
83
-                              . PhpInterface::SLASH .
84
-                              $this->generator->objectName .
85
-                              ucfirst($relationEntity) .
86
-                              PhpInterface::PHP_EXT;
83
+                                . PhpInterface::SLASH .
84
+                                $this->generator->objectName .
85
+                                ucfirst($relationEntity) .
86
+                                PhpInterface::PHP_EXT;
87 87
                 if(file_exists($entityFile))
88 88
                 {
89 89
                     $this->setPivotContent($relationEntity);
90 90
 
91 91
                     $migrationMask = date(self::PATTERN_TIME) . (self::$counter + 1);
92 92
                     $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE
93
-                                     . $this->tableName
94
-                                     . PhpInterface::UNDERSCORE .
95
-                                     MigrationsHelper::getTableName($relationEntity) .
96
-                                     PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE;
93
+                                        . $this->tableName
94
+                                        . PhpInterface::UNDERSCORE .
95
+                                        MigrationsHelper::getTableName($relationEntity) .
96
+                                        PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE;
97 97
 
98 98
                     if(FileManager::migrationNotExists($this->generator, $migrationName))
99 99
                     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName);
52 52
         $isAdding = (true === $this->generator->isMerge && empty($this->generator->diffTypes[$attrKey]) === false);
53
-        if(true === $isFileExist)
53
+        if (true === $isFileExist)
54 54
         {
55 55
             $this->setContent();
56 56
         } else if (true === $isAdding) {
@@ -74,17 +74,17 @@  discard block
 block discarded – undo
74 74
         $formRequestEntity = $this->getFormRequestEntity($this->generator->version, $this->className);
75 75
         /** @var BaseFormRequest $formRequest **/
76 76
         $formRequest       = new $formRequestEntity();
77
-        if(method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS))
77
+        if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS))
78 78
         {
79 79
             $relations = $formRequest->relations();
80
-            foreach($relations as $relationEntity)
80
+            foreach ($relations as $relationEntity)
81 81
             {
82 82
                 $entityFile = $this->generator->formatEntitiesPath()
83 83
                               . PhpInterface::SLASH .
84 84
                               $this->generator->objectName .
85 85
                               ucfirst($relationEntity) .
86 86
                               PhpInterface::PHP_EXT;
87
-                if(file_exists($entityFile))
87
+                if (file_exists($entityFile))
88 88
                 {
89 89
                     $this->setPivotContent($relationEntity);
90 90
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
                                      MigrationsHelper::getTableName($relationEntity) .
96 96
                                      PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE;
97 97
 
98
-                    if(FileManager::migrationNotExists($this->generator, $migrationName))
98
+                    if (FileManager::migrationNotExists($this->generator, $migrationName))
99 99
                     {
100 100
                         $file = $this->generator->formatMigrationsPath() . $migrationMask
101 101
                                 . PhpInterface::UNDERSCORE . $migrationName . PhpInterface::PHP_EXT;
102 102
                         // if migration file with the same name ocasionally exists we do not override it
103 103
                         $isCreated = FileManager::createFile($file, $this->sourceCode);
104
-                        if($isCreated)
104
+                        if ($isCreated)
105 105
                         {
106 106
                             Console::out($file . PhpInterface::SPACE . Console::CREATED, Console::COLOR_GREEN);
107 107
                         }
Please login to merge, or discard this patch.