Passed
Push — master ( 303f89...eaed60 )
by Fran
12:51 queued 11s
created
src/functions.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@
 block discarded – undo
31 31
     function getallheaders()
32 32
     {
33 33
         $headers = array();
34
-        foreach ($_SERVER as $h => $v)
35
-            if (preg_match('/HTTP_(.+)/', $h, $hp))
34
+        foreach ($_SERVER as $h => $v) {
35
+                    if (preg_match('/HTTP_(.+)/', $h, $hp))
36 36
                 $headers[$hp[1]] = $v;
37
+        }
37 38
         return $headers;
38 39
     }
39 40
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
     /* @var $file SplFileInfo */
47 47
     foreach ($finder as $file) {
48 48
         $path = $file->getRealPath();
49
-        if(!in_array($path, $loaded_files)) {
49
+        if (!in_array($path, $loaded_files)) {
50 50
             $loaded_files[] = $path;
51 51
             require_once($path);
52 52
         }
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
  */
8 8
 Trait BoostrapTrait {}
9 9
 
10
-require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
11 10
\ No newline at end of file
11
+require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
src/base/types/traits/SingletonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public static function dropInstance() {
36 36
         $class = get_called_class();
37
-        if(isset(self::$instance[$class])) {
37
+        if (isset(self::$instance[$class])) {
38 38
             self::$instance[$class] = null;
39 39
         }
40 40
     }
Please login to merge, or discard this patch.
src/base/types/traits/OutputTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
 
203 203
     /**
204 204
      * Método que fuerza la descarga de un fichero
205
-     * @param $data
205
+     * @param string $data
206 206
      * @param string $content
207 207
      * @param string $filename
208 208
      * @return mixed
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 $this->setStatusCode(Template::STATUS_OK);
121 121
                 break;
122 122
             default:
123
-                $this->setStatusCode('HTTP/1.0 ' . $status ?: 200);
123
+                $this->setStatusCode('HTTP/1.0 '.$status ?: 200);
124 124
                 break;
125 125
         }
126 126
         return $this;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         ResponseHelper::setStatusHeader($this->getStatusCode());
139 139
         ResponseHelper::setAuthHeaders($this->isPublicZone());
140 140
         ResponseHelper::setCookieHeaders($cookies);
141
-        header('Content-type: ' . $contentType);
141
+        header('Content-type: '.$contentType);
142 142
 
143 143
     }
144 144
 
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
         Logger::log('Start output response');
155 155
         ob_start();
156 156
         $this->setReponseHeaders($contentType, $cookies);
157
-        header('Content-length: ' . strlen($output));
158
-        header('CRC: ' . crc32($output));
157
+        header('Content-length: '.strlen($output));
158
+        header('CRC: '.crc32($output));
159 159
 
160 160
         $needCache = Cache::needCache();
161 161
         $cache = Cache::getInstance();
162 162
         list($path, $cacheDataName) = $cache->getRequestCacheHash();
163 163
         if (false !== $needCache && $this->getStatusCode() === Template::STATUS_OK && null !== $cacheDataName) {
164 164
             Logger::log('Saving output response into cache');
165
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
166
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName . ".headers", headers_list(), Cache::JSON);
165
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName, $output);
166
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName.".headers", headers_list(), Cache::JSON);
167 167
         } elseif (Request::getInstance()->getMethod() !== 'GET') {
168 168
             $cache->flushCache();
169 169
         }
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
         Logger::log('Close template render');
184 184
         $uri = Request::requestUri();
185 185
         Security::getInstance()->setSessionKey("lastRequest", array(
186
-            "url" => Request::getInstance()->getRootUrl() . $uri,
186
+            "url" => Request::getInstance()->getRootUrl().$uri,
187 187
             "ts" => microtime(true),
188 188
         ));
189 189
         Security::getInstance()->updateSession();
190
-        Logger::log('End request: ' . $uri, LOG_INFO);
190
+        Logger::log('End request: '.$uri, LOG_INFO);
191 191
         exit;
192 192
     }
193 193
 
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
         /////////////////////////////////////////////////////////////
226 226
         // Date in the past sets the value to already have been expired.
227 227
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
228
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
228
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
229 229
         header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
230 230
         header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
231 231
         header("Pragma: no-cache");
232 232
         header("Expires: 0");
233 233
         header('Content-Transfer-Encoding: binary');
234
-        header("Content-type: " . $content);
235
-        header("Content-length: " . strlen($data));
236
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
234
+        header("Content-type: ".$content);
235
+        header("Content-length: ".strlen($data));
236
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
237 237
         header("Access-Control-Expose-Headers: Filename");
238
-        header("Filename: " . $filename);
238
+        header("Filename: ".$filename);
239 239
         echo $data;
240 240
         ob_flush();
241 241
         ob_end_clean();
Please login to merge, or discard this patch.
src/controller/DocumentorController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $download = $this->getRequest()->get('download') ?: false;
34 34
 
35 35
         $module = $this->srv->getModules($domain);
36
-        if(empty($module)) {
36
+        if (empty($module)) {
37 37
             return Router::getInstance()->httpNotFound(null, true);
38 38
         }
39 39
         switch (strtolower($type)) {
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         ini_restore('max_execution_time');
54 54
         ini_restore('memory_limit');
55 55
 
56
-        if($download && $type === ApiController::SWAGGER_DOC) {
56
+        if ($download && $type === ApiController::SWAGGER_DOC) {
57 57
             return $this->download(\GuzzleHttp\json_encode($doc), 'application/json', 'swagger.json');
58
-        } elseif($type === ApiController::HTML_DOC) {
58
+        } elseif ($type === ApiController::HTML_DOC) {
59 59
             return $this->render('documentation.html.twig', ["data" => json_encode($doc)]);
60
-        } else {
60
+        }else {
61 61
             return $this->json($doc, 200);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.
src/base/types/helpers/ApiHelper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@
 block discarded – undo
160 160
     }
161 161
 
162 162
     /**
163
-     * @param $field
163
+     * @param string $field
164 164
      * @param bool $required
165 165
      * @return Field
166 166
      */
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
         $behaviors = $tableMap->getBehaviors();
36 36
         foreach ($map::getFieldNames() as $field) {
37 37
             $fDto = self::parseFormField($domain, $tableMap, $field, $behaviors);
38
-            if(null !== $fDto) {
38
+            if (null !== $fDto) {
39 39
                 $form->addField($fDto);
40 40
             }
41 41
         }
42 42
 
43
-        if(array_key_exists('i18n', $behaviors)) {
44
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
45
-            if(null !== $relateI18n) {
43
+        if (array_key_exists('i18n', $behaviors)) {
44
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
45
+            if (null !== $relateI18n) {
46 46
                 $i18NTableMap = $relateI18n->getLocalTable();
47
-                foreach($i18NTableMap->getColumns() as $columnMap) {
48
-                    if(!$form->fieldExists($columnMap->getPhpName())) {
47
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
48
+                    if (!$form->fieldExists($columnMap->getPhpName())) {
49 49
                         $fDto = self::parseFormField($domain, $i18NTableMap, $columnMap->getPhpName(), $i18NTableMap->getBehaviors());
50
-                        if(null !== $fDto) {
50
+                        if (null !== $fDto) {
51 51
                             $fDto->pk = false;
52 52
                             $form->addField($fDto);
53 53
                         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $fDto->entity = $relatedModel;
77 77
         $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName());
78 78
         $fDto->relatedField = $relatedField->getPhpName();
79
-        $fDto->url = Router::getInstance()->getRoute(strtolower($domain) . '-api-' . $relatedModel);
79
+        $fDto->url = Router::getInstance()->getRoute(strtolower($domain).'-api-'.$relatedModel);
80 80
         return $fDto;
81 81
     }
82 82
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $column = null;
185 185
         try {
186 186
             $column = $tableMap->getColumnByPhpName($field);
187
-        } catch (\Exception $e) {
187
+        }catch (\Exception $e) {
188 188
             Logger::log($e->getMessage(), LOG_WARNING);
189 189
             //foreach($tableMap->getRelations() as $relation) {
190 190
             //    $column = self::checkFieldExists($relation->getLocalTable(), $field);
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
         } elseif (preg_match('/^(\'|\")(.*)(\'|\")$/', $value)) {
207 207
             $text = preg_replace('/(\'|\")/', '', $value);
208 208
             $text = preg_replace('/\ /', '%', $text);
209
-            $query->add($tableField, '%' . $text . '%', Criteria::LIKE);
210
-        } else {
211
-            if(null !== $column->getValueSet()) {
209
+            $query->add($tableField, '%'.$text.'%', Criteria::LIKE);
210
+        }else {
211
+            if (null !== $column->getValueSet()) {
212 212
                 $valueSet = $column->getValueSet();
213
-                if(in_array($value, $valueSet)) {
213
+                if (in_array($value, $valueSet)) {
214 214
                     $value = array_search($value, $valueSet);
215 215
                 }
216 216
             }
@@ -230,29 +230,29 @@  discard block
 block discarded – undo
230 230
         $sep = '';
231 231
         foreach ($tableMap->getColumns() as $column) {
232 232
             if ($column->isText()) {
233
-                $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
233
+                $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
234 234
                 $sep = ', " ", ';
235 235
             }
236 236
         }
237
-        foreach($tableMap->getRelations() as $relation) {
238
-            if(preg_match('/I18n$/i', $relation->getName())) {
237
+        foreach ($tableMap->getRelations() as $relation) {
238
+            if (preg_match('/I18n$/i', $relation->getName())) {
239 239
                 $localeTableMap = $relation->getLocalTable();
240 240
                 foreach ($localeTableMap->getColumns() as $column) {
241 241
                     if ($column->isText()) {
242
-                        $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
242
+                        $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
243 243
                         $sep = ', " ", ';
244 244
                     }
245 245
                 }
246 246
             }
247 247
         }
248 248
         foreach ($extraColumns as $extra => $name) {
249
-            $exp .= $sep . $extra;
249
+            $exp .= $sep.$extra;
250 250
             $sep = ', " ", ';
251 251
         }
252 252
         $exp .= ")";
253 253
         $text = preg_replace('/(\'|\")/', '', $value);
254 254
         $text = preg_replace('/\ /', '%', $text);
255
-        $query->where($exp . Criteria::LIKE . '"%' . $text . '%"');
255
+        $query->where($exp.Criteria::LIKE.'"%'.$text.'%"');
256 256
     }
257 257
 
258 258
     /**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null)
279 279
     {
280
-        $queryReflector = new \ReflectionClass($modelNameNamespace . "Query");
280
+        $queryReflector = new \ReflectionClass($modelNameNamespace."Query");
281 281
         /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */
282 282
         $query = $queryReflector->getMethod('create')->invoke($con);
283 283
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         } elseif ($mappedColumn->isText()) {
307 307
             if ($mappedColumn->getSize() > 100) {
308 308
                 $fDto = self::createField($field, Field::TEXTAREA_TYPE, $required);
309
-            } else {
309
+            }else {
310 310
                 $fDto = self::generateStringField($field, $required);
311 311
             }
312 312
         } elseif ($mappedColumn->getType() === PropelTypes::BOOLEAN) {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public static function extractPrimaryKeyColumnName(TableMap $tableMap) {
345 345
         $modelPk = null;
346
-        foreach($tableMap->getPrimaryKeys() as $pk) {
346
+        foreach ($tableMap->getPrimaryKeys() as $pk) {
347 347
             $modelPk = $pk;
348 348
             break;
349 349
         }
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
 
353 353
     private static function mapResult(ActiveRecordInterface $model, array $data = []) {
354 354
         $result = [];
355
-        foreach($data as $key => $value) {
355
+        foreach ($data as $key => $value) {
356 356
             try {
357 357
                 $realValue = $model->getByName($key);
358
-            } catch(\Exception $e) {
358
+            }catch (\Exception $e) {
359 359
                 $realValue = $value;
360 360
             }
361
-            if(Api::API_MODEL_KEY_FIELD === $key) {
361
+            if (Api::API_MODEL_KEY_FIELD === $key) {
362 362
                 $result[$key] = (integer)$realValue;
363
-            } else {
363
+            }else {
364 364
                 $result[$key] = $realValue;
365 365
             }
366 366
         }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         /** @var ActiveRecordInterface $obj */
377 377
         $obj = $formatter->getAllObjectsFromRow($data);
378 378
         $result = self::mapResult($obj, $data);
379
-        if(!preg_match('/' . $modelPk->getPhpName() . '/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
379
+        if (!preg_match('/'.$modelPk->getPhpName().'/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
380 380
             unset($result[$modelPk->getPhpName()]);
381 381
         }
382 382
         return $result;
Please login to merge, or discard this patch.
src/base/types/traits/Api/ApiTrait.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     /**
41 41
      * Method that extract the Api name
42
-     * @return mixed
42
+     * @return string
43 43
      */
44 44
     public function getApi()
45 45
     {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     /**
52 52
      * Method that extract the Domain name
53
-     * @return mixed
53
+     * @return string
54 54
      */
55 55
     public function getDomain()
56 56
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,9 @@
 block discarded – undo
114 114
                 try {
115 115
                     $query->filterBy($phpName, $pks[$i]);
116 116
                     $i++;
117
-                    if($i >= count($pks)) break;
117
+                    if($i >= count($pks)) {
118
+                        break;
119
+                    }
118 120
                 } catch(\Exception $e) {
119 121
                     Logger::log($e->getMessage(), LOG_DEBUG);
120 122
                 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
      */
96 96
     protected function hydrateBulkRequest() {
97 97
         $class = new \ReflectionClass($this->getModelNamespace());
98
-        foreach($this->data as $item) {
99
-            if(is_array($item)) {
100
-                if(count($this->list) < Config::getParam('api.block.limit', 1000)) {
98
+        foreach ($this->data as $item) {
99
+            if (is_array($item)) {
100
+                if (count($this->list) < Config::getParam('api.block.limit', 1000)) {
101 101
                     /** @var ActiveRecordInterface $model */
102 102
                     $model = $class->newInstance();
103 103
                     $this->hydrateModelFromRequest($model, $item);
104 104
                     $this->list[] = $model;
105
-                } else {
106
-                    Logger::log(_('Max items per bulk insert raised'), LOG_WARNING, count($this->data) . _('items'));
105
+                }else {
106
+                    Logger::log(_('Max items per bulk insert raised'), LOG_WARNING, count($this->data)._('items'));
107 107
                 }
108 108
             }
109 109
         }
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function saveBulk() {
116 116
         $tablemap = $this->getTableMap();
117
-        foreach($this->list as &$model) {
117
+        foreach ($this->list as &$model) {
118 118
             $con = Propel::getWriteConnection($tablemap::DATABASE_NAME);
119 119
             try {
120 120
                 $model->save($con);
121 121
                 $con->commit();
122
-            } catch(\Exception $e) {
122
+            }catch (\Exception $e) {
123 123
                 Logger::log($e->getMessage(), LOG_ERR, $model->toArray());
124 124
                 $con->rollBack();
125 125
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     protected function exportList() {
133 133
         $list = [];
134 134
         /** @var ActiveRecordInterface $item */
135
-        foreach($this->list as $item) {
135
+        foreach ($this->list as $item) {
136 136
             $list[] = $item->toArray();
137 137
         }
138 138
         return $list;
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function findPk(ModelCriteria $query, $pk) {
158 158
         $pks = explode(Api::API_PK_SEPARATOR, urldecode($pk));
159
-        if(count($pks) == 1 && !empty($pks[0])) {
159
+        if (count($pks) == 1 && !empty($pks[0])) {
160 160
             $model = $query->findPk($pks[0], $this->con);
161
-        } else {
161
+        }else {
162 162
             $i = 0;
163
-            foreach($this->getPkDbName() as $key => $phpName) {
163
+            foreach ($this->getPkDbName() as $key => $phpName) {
164 164
                 try {
165 165
                     $query->filterBy($phpName, $pks[$i]);
166 166
                     $i++;
167
-                    if($i >= count($pks)) break;
168
-                } catch(\Exception $e) {
167
+                    if ($i >= count($pks)) break;
168
+                }catch (\Exception $e) {
169 169
                     Logger::log($e->getMessage(), LOG_DEBUG);
170 170
                 }
171 171
             }
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
         try {
196 196
             $query = $this->prepareQuery();
197 197
             $this->model = $this->findPk($query, $pk);
198
-        } catch (\Exception $e) {
199
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
198
+        }catch (\Exception $e) {
199
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
200 200
         }
201 201
     }
202 202
 
Please login to merge, or discard this patch.
src/base/dto/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             return ($aOrder < $bOrder) ? -1 : 1;
49 49
         });
50 50
         $array['actions'] = [];
51
-        foreach($this->actions as $action) {
51
+        foreach ($this->actions as $action) {
52 52
             $array['actions'][] = $action->__toArray();
53 53
         }
54 54
         return $array;
Please login to merge, or discard this patch.
src/base/types/traits/Api/ManagerTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
             "domain" => $this->getDomain(),
40 40
             "listLabel" => Api::API_LIST_NAME_FIELD,
41 41
             'modelId' => Api::API_MODEL_KEY_FIELD,
42
-            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)),
43
-            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)),
42
+            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)),
43
+            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)),
44 44
         ), [], '');
45 45
     }
46 46
 
Please login to merge, or discard this patch.