Passed
Push — master ( 849dc0...25ac3b )
by Fran
03:04
created
src/base/types/traits/CurlTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     {
99 99
         $this->params = [];
100 100
         $this->headers = [];
101
-        Logger::log('Context service for ' . static::class . ' cleared!');
101
+        Logger::log('Context service for '.static::class.' cleared!');
102 102
         $this->closeConnection();
103 103
     }
104 104
 
Please login to merge, or discard this patch.
src/base/types/traits/OutputTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 $this->setStatusCode(Template::STATUS_OK);
126 126
                 break;
127 127
             default:
128
-                $this->setStatusCode('HTTP/1.0 ' . ($status ?: 200));
128
+                $this->setStatusCode('HTTP/1.0 '.($status ?: 200));
129 129
                 break;
130 130
         }
131 131
         return $this;
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
     private function setReponseHeaders($contentType = 'text/html', array $cookies = array())
140 140
     {
141 141
         $powered = Config::getParam('poweredBy', 'PSFS');
142
-        header('X-Powered-By: ' . $powered);
142
+        header('X-Powered-By: '.$powered);
143 143
         ResponseHelper::setStatusHeader($this->getStatusCode());
144 144
         ResponseHelper::setAuthHeaders($this->isPublicZone());
145 145
         ResponseHelper::setCookieHeaders($cookies);
146
-        header('Content-type: ' . $contentType);
146
+        header('Content-type: '.$contentType);
147 147
 
148 148
     }
149 149
 
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
             Logger::log('Start output response');
162 162
             ob_start();
163 163
             $this->setReponseHeaders($contentType, $cookies);
164
-            header('Content-length: ' . strlen($output));
165
-            header('CRC: ' . crc32($output));
164
+            header('Content-length: '.strlen($output));
165
+            header('CRC: '.crc32($output));
166 166
 
167 167
             $needCache = Cache::needCache();
168 168
             $cache = Cache::getInstance();
169 169
             list($path, $cacheDataName) = $cache->getRequestCacheHash();
170 170
             if (null !== $cacheDataName && false !== $needCache && $this->getStatusCode() === Template::STATUS_OK) {
171 171
                 Logger::log('Saving output response into cache');
172
-                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
173
-                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', headers_list(), Cache::JSON);
172
+                $cache->storeData('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName, $output);
173
+                $cache->storeData('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers', headers_list(), Cache::JSON);
174 174
             } elseif (Request::getInstance()->getMethod() !== 'GET') {
175 175
                 $cache->flushCache();
176 176
             }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             ob_end_clean();
181 181
             Logger::log('End output response');
182 182
             $this->closeRender();
183
-        } else {
183
+        }else {
184 184
             return $output;
185 185
         }
186 186
     }
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
         Logger::log('Close template render');
194 194
         $uri = Request::requestUri();
195 195
         Security::getInstance()->setSessionKey('lastRequest', array(
196
-            'url' => Request::getInstance()->getRootUrl() . $uri,
196
+            'url' => Request::getInstance()->getRootUrl().$uri,
197 197
             'ts' => microtime(true),
198 198
         ));
199 199
         Security::getInstance()->updateSession();
200
-        Logger::log('End request: ' . $uri, LOG_INFO);
200
+        Logger::log('End request: '.$uri, LOG_INFO);
201 201
         exit;
202 202
     }
203 203
 
@@ -236,17 +236,17 @@  discard block
 block discarded – undo
236 236
         /////////////////////////////////////////////////////////////
237 237
         // Date in the past sets the value to already have been expired.
238 238
         header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
239
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
239
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
240 240
         header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
241 241
         header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
242 242
         header('Pragma: no-cache');
243 243
         header('Expires: 0');
244 244
         header('Content-Transfer-Encoding: binary');
245
-        header('Content-type: ' . $content);
246
-        header('Content-length: ' . strlen($data));
247
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
245
+        header('Content-type: '.$content);
246
+        header('Content-length: '.strlen($data));
247
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
248 248
         header('Access-Control-Expose-Headers: Filename');
249
-        header('Filename: ' . $filename);
249
+        header('Filename: '.$filename);
250 250
         echo $data;
251 251
         ob_flush();
252 252
         ob_end_clean();
Please login to merge, or discard this patch.
src/base/types/traits/JsonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         }
50 50
 
51 51
         if (Config::getParam('angular.protection', false)) {
52
-            $data = ")]}',\n" . $data;
52
+            $data = ")]}',\n".$data;
53 53
         }
54 54
         $this->setStatus($statusCode);
55 55
         ResponseHelper::setDebugHeaders([]);
Please login to merge, or discard this patch.
src/base/types/traits/Router/ModulesTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         if ($files->hasResults()) {
59 59
             foreach ($files->getIterator() as $file) {
60 60
                 if ($namespace !== Router::PSFS_BASE_NAMESPACE && method_exists($file, 'getRelativePathname')) {
61
-                    $filename = '\\' . str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
62
-                } else {
61
+                    $filename = '\\'.str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
62
+                }else {
63 63
                     $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname()));
64 64
                 }
65
-                $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace);
65
+                $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace);
66 66
             }
67 67
         }
68 68
         $this->initializeFinder();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             if (!is_array($this->domains)) {
116 116
                 $this->domains = [];
117 117
             }
118
-            $domain = '@' . $class->getConstant('DOMAIN') . '/';
118
+            $domain = '@'.$class->getConstant('DOMAIN').'/';
119 119
             if (!array_key_exists($domain, $this->domains)) {
120 120
                 $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
121 121
             }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
     private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath, &$routing = [])
143 143
     {
144 144
         $extModule = $modulePath->getBasename();
145
-        $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php');
145
+        $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php');
146 146
         if (file_exists($moduleAutoloader)) {
147 147
             include_once $moduleAutoloader;
148 148
             if ($hydrateRoute) {
149
-                $routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $routing);
149
+                $routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $routing);
150 150
             }
151 151
         }
152 152
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $modulesToIgnore = explode(',', Config::getParam('hide.modules', ''));
163 163
         try {
164 164
             $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module);
165
-            $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src';
165
+            $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src';
166 166
             if (file_exists($externalModulePath)) {
167 167
                 $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0);
168 168
                 if ($externalModule->hasResults()) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                     }
174 174
                 }
175 175
             }
176
-        } catch (Exception $e) {
176
+        }catch (Exception $e) {
177 177
             Logger::log($e->getMessage(), LOG_WARNING);
178 178
         }
179 179
     }
Please login to merge, or discard this patch.
src/base/types/traits/Form/FormDataTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
     public function add($name, array $value = [])
31 31
     {
32 32
         $this->fields[$name] = $value;
33
-        $this->fields[$name]['name'] = $this->getName() . '[' . $name . ']';
34
-        $this->fields[$name]['id'] = $this->getName() . '_' . $name;
33
+        $this->fields[$name]['name'] = $this->getName().'['.$name.']';
34
+        $this->fields[$name]['id'] = $this->getName().'_'.$name;
35 35
         $this->fields[$name]['placeholder'] = array_key_exists('placeholder', $value) ? $value['placeholder'] : $name;
36 36
         $this->fields[$name]['hasLabel'] = array_key_exists('hasLabel', $value) ? $value['hasLabel'] : true;
37 37
         return $this;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $data = array();
71 71
         if (count($this->fields) > 0) {
72 72
             foreach ($this->fields as $key => $field) {
73
-                if (self::SEPARATOR !== $key && $key !== ($this->getName() . '_token')) {
73
+                if (self::SEPARATOR !== $key && $key !== ($this->getName().'_token')) {
74 74
                     $data[$key] = array_key_exists('value', $field) ? $field['value'] : null;
75 75
                 }
76 76
             }
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
         if (array_key_exists($key, $data[$formName])) {
118 118
             if (preg_match('/id/i', $key) && ($data[$formName][$key] === 0 || $data[$formName][$key] === '%' || $data[$formName][$key] === '')) {
119 119
                 $field['value'] = null;
120
-            } else {
120
+            }else {
121 121
                 $field['value'] = $data[$formName][$key];
122 122
             }
123
-        } else {
123
+        }else {
124 124
             unset($field['value']);
125 125
         }
126 126
         return array($data, $field);
Please login to merge, or discard this patch.
src/base/types/traits/SystemTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
                 $use /= 1024;
40 40
                 break;
41 41
             case "MBytes":
42
-                $use /= (1024 * 1024);
42
+                $use /= (1024*1024);
43 43
                 break;
44 44
             case "Bytes":
45 45
             default:
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
             ini_set('display_errors', 1);
70 70
         }
71 71
         //Warning & Notice handler
72
-        set_error_handler(function ($errno, $errstr, $errfile, $errline) {
72
+        set_error_handler(function($errno, $errstr, $errfile, $errline) {
73 73
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
74 74
             return true;
75 75
         }, E_ALL | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
76 76
 
77
-        register_shutdown_function(function () {
77
+        register_shutdown_function(function() {
78 78
             $error = error_get_last() or json_last_error() or preg_last_error() or \DateTime::getLastErrors();
79 79
             if ($error !== NULL) {
80 80
                 $errno = $error["type"];
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
             if (self::getTs() > 10 && null !== Config::getParam('log.slack.hook')) {
91 91
                 SlackHelper::getInstance()->trace('Slow service endpoint', '', '', [
92
-                    'time' => round(self::getTs(), 3) . ' secs',
93
-                    'memory' => round(self::getMem('MBytes'), 3) . ' Mb',
92
+                    'time' => round(self::getTs(), 3).' secs',
93
+                    'memory' => round(self::getMem('MBytes'), 3).' Mb',
94 94
                 ]);
95 95
             }
96 96
             return false;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         Inspector::stats('[SystemTrait] Initializing stats (mem + ts)');
106 106
         if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
107 107
             $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT'];
108
-        } else {
108
+        }else {
109 109
             $this->ts = PSFS_START_TS;
110 110
         }
111 111
         $this->mem = PSFS_START_MEM;
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldHelperTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         if (array_key_exists('i18n', $behaviors)) {
133
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
133
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
134 134
             if (null !== $relateI18n) {
135 135
                 $i18NTableMap = $relateI18n->getLocalTable();
136 136
                 foreach ($i18NTableMap->getColumns() as $columnMap) {
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
         try {
174 174
             foreach ($tableMap->getColumns() as $tableMapColumn) {
175 175
                 $columnName = $tableMapColumn->getPhpName();
176
-                if (preg_match('/^' . $field . '$/i', $columnName)) {
176
+                if (preg_match('/^'.$field.'$/i', $columnName)) {
177 177
                     $column = $tableMapColumn;
178 178
                     break;
179 179
                 }
180 180
             }
181
-        } catch (\Exception $e) {
181
+        }catch (\Exception $e) {
182 182
             Logger::log($e->getMessage(), LOG_DEBUG);
183 183
         }
184 184
         return $column;
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldModelHelperTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $fDto->entity = $relatedModel;
34 34
         $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName());
35 35
         $fDto->relatedField = $relatedField->getPhpName();
36
-        $fDto->url = Router::getInstance()->getRoute(strtolower($domain) . '-api-' . $relatedModel);
36
+        $fDto->url = Router::getInstance()->getRoute(strtolower($domain).'-api-'.$relatedModel);
37 37
         return $fDto;
38 38
     }
39 39
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param ModelCriteria $query
43 43
      * @param mixed $value
44 44
      */
45
-    private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null)
45
+    private static function addQueryFilter(ColumnMap $column, ModelCriteria & $query, $value = null)
46 46
     {
47 47
         $tableField = $column->getFullyQualifiedName();
48 48
         if (is_array($value)) {
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
         } elseif (preg_match('/^(\'|\")(.*)(\'|\")$/', $value)) {
53 53
             $text = preg_replace('/(\'|\")/', '', $value);
54 54
             $text = preg_replace('/\ /', '%', $text);
55
-            $query->add($tableField, '%' . $text . '%', Criteria::LIKE);
56
-        } else {
55
+            $query->add($tableField, '%'.$text.'%', Criteria::LIKE);
56
+        }else {
57 57
             if (null !== $column->getValueSet()) {
58 58
                 $valueSet = $column->getValueSet();
59 59
                 if (in_array($value, $valueSet)) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param string $field
72 72
      * @param mixed $value
73 73
      */
74
-    public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null)
74
+    public static function addModelField(TableMap $tableMap, ModelCriteria & $query, $field, $value = null)
75 75
     {
76 76
         if ($column = self::checkFieldExists($tableMap, $field)) {
77 77
             self::addQueryFilter($column, $query, $value);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null)
88 88
     {
89
-        $queryReflector = new \ReflectionClass($modelNameNamespace . "Query");
89
+        $queryReflector = new \ReflectionClass($modelNameNamespace."Query");
90 90
         /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */
91 91
         $query = $queryReflector->getMethod('create')->invoke($con);
92 92
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
      * @param array $extraColumns
100 100
      * @param mixed $value
101 101
      */
102
-    public static function composerComboField(TableMap $tableMap, ModelCriteria &$query, array $extraColumns = [], $value = null)
102
+    public static function composerComboField(TableMap $tableMap, ModelCriteria & $query, array $extraColumns = [], $value = null)
103 103
     {
104 104
         $exp = 'CONCAT(';
105 105
         $sep = '';
106 106
         foreach ($tableMap->getColumns() as $column) {
107 107
             if ($column->isText()) {
108
-                $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
108
+                $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
109 109
                 $sep = ', " ", ';
110 110
             }
111 111
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 $localeTableMap = $relation->getLocalTable();
115 115
                 foreach ($localeTableMap->getColumns() as $column) {
116 116
                     if ($column->isText()) {
117
-                        $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
117
+                        $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
118 118
                         $sep = ', " ", ';
119 119
                     }
120 120
                 }
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
         }
123 123
         foreach (array_keys($extraColumns) as $extra) {
124 124
             if (!preg_match("/(COUNT|DISTINCT|SUM|MAX|MIN|GROUP)/i", $extra)) {
125
-                $exp .= $sep . $extra;
125
+                $exp .= $sep.$extra;
126 126
                 $sep = ', " ", ';
127 127
             }
128 128
         }
129 129
         $exp .= ")";
130 130
         $text = preg_replace('/(\'|\")/', '', $value);
131 131
         $text = preg_replace('/\ /', '%', $text);
132
-        $query->where($exp . Criteria::LIKE . '"%' . $text . '%"');
132
+        $query->where($exp.Criteria::LIKE.'"%'.$text.'%"');
133 133
     }
134 134
 
135 135
     /**
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldMapperHelperTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
         foreach ($data as $key => $value) {
29 29
             try {
30 30
                 $realValue = $model->getByName($key);
31
-            } catch (\Exception $e) {
31
+            }catch (\Exception $e) {
32 32
                 $realValue = $value;
33 33
             }
34 34
             if (Api::API_MODEL_KEY_FIELD === $key) {
35 35
                 $result[$key] = (integer)$realValue;
36
-            } else {
36
+            }else {
37 37
                 $result[$key] = $realValue;
38 38
             }
39 39
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         }
67 67
         $obj = @$formatter->getAllObjectsFromRow($objData);
68 68
         $result = self::mapResult($obj, $data);
69
-        if (!preg_match('/' . $modelPk->getPhpName() . '/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
69
+        if (!preg_match('/'.$modelPk->getPhpName().'/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
70 70
             unset($result[$modelPk->getPhpName()]);
71 71
         }
72 72
         return $result;
Please login to merge, or discard this patch.