Passed
Push — master ( 8ea9d3...4c87c8 )
by Fran
02:50
created
src/base/types/traits/Form/FormSecurityTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         }
30 30
         if ('' !== $hashOrig) {
31 31
             $this->crfs = sha1($hashOrig);
32
-            $this->add($this->getName() . '_token', array(
32
+            $this->add($this->getName().'_token', array(
33 33
                 'type' => 'hidden',
34 34
                 'value' => $this->crfs,
35 35
             ));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function isValid()
44 44
     {
45 45
         $valid = true;
46
-        $tokenField = $this->getName() . '_token';
46
+        $tokenField = $this->getName().'_token';
47 47
         // Check crfs token
48 48
         if (!$this->existsFormToken($tokenField)) {
49 49
             $this->errors[$tokenField] = t('Formulario no válido');
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldMapperHelperTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
      */
23 23
     private static function mapResult(ActiveRecordInterface $model, array $data = []) {
24 24
         $result = [];
25
-        foreach($data as $key => $value) {
25
+        foreach ($data as $key => $value) {
26 26
             try {
27 27
                 $realValue = $model->getByName($key);
28
-            } catch(\Exception $e) {
28
+            }catch (\Exception $e) {
29 29
                 $realValue = $value;
30 30
             }
31
-            if(Api::API_MODEL_KEY_FIELD === $key) {
31
+            if (Api::API_MODEL_KEY_FIELD === $key) {
32 32
                 $result[$key] = (integer)$realValue;
33
-            } else {
33
+            }else {
34 34
                 $result[$key] = $realValue;
35 35
             }
36 36
         }
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
         $objTableMap = get_class($formatter->getTableMap());
56 56
         /** @var TableMapTrait $objTableMap */
57 57
         $objData = $data;
58
-        foreach($objTableMap::getFieldNames() as $field) {
59
-            if(!array_key_exists($field, $objData)) {
58
+        foreach ($objTableMap::getFieldNames() as $field) {
59
+            if (!array_key_exists($field, $objData)) {
60 60
                 $objData[$field] = null;
61 61
             }
62 62
         }
63 63
         $obj = @$formatter->getAllObjectsFromRow($objData);
64 64
         $result = self::mapResult($obj, $data);
65
-        if(!preg_match('/' . $modelPk->getPhpName() . '/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
65
+        if (!preg_match('/'.$modelPk->getPhpName().'/i', $query[Api::API_FIELDS_RESULT_FIELD])) {
66 66
             unset($result[$modelPk->getPhpName()]);
67 67
         }
68 68
         return $result;
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
      * @return string
74 74
      */
75 75
     public static function getColumnMapName(ColumnMap $field) {
76
-        switch(self::getFieldTypes()) {
76
+        switch (self::getFieldTypes()) {
77 77
             default:
78 78
             case 'UpperCamelCase':
79 79
             case TableMap::TYPE_PHPNAME:
80
-                $columnName =$field->getPhpName();
80
+                $columnName = $field->getPhpName();
81 81
                 break;
82 82
             case 'camelCase':
83 83
             case 'lowerCamelCase':
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldModelHelperTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $fDto->entity = $relatedModel;
32 32
         $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName());
33 33
         $fDto->relatedField = $relatedField->getPhpName();
34
-        $fDto->url = Router::getInstance()->getRoute(strtolower($domain) . '-api-' . $relatedModel);
34
+        $fDto->url = Router::getInstance()->getRoute(strtolower($domain).'-api-'.$relatedModel);
35 35
         return $fDto;
36 36
     }
37 37
 
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
     private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null)
44 44
     {
45 45
         $tableField = $column->getFullyQualifiedName();
46
-        if(is_array($value)) {
46
+        if (is_array($value)) {
47 47
             $query->add($tableField, $value, Criteria::IN);
48 48
         } elseif (preg_match('/^\[/', $value) && preg_match('/\]$/', $value)) {
49 49
             $query->add($tableField, explode(',', preg_replace('/(\[|\])/', '', $value)), Criteria::IN);
50 50
         } elseif (preg_match('/^(\'|\")(.*)(\'|\")$/', $value)) {
51 51
             $text = preg_replace('/(\'|\")/', '', $value);
52 52
             $text = preg_replace('/\ /', '%', $text);
53
-            $query->add($tableField, '%' . $text . '%', Criteria::LIKE);
54
-        } else {
55
-            if(null !== $column->getValueSet()) {
53
+            $query->add($tableField, '%'.$text.'%', Criteria::LIKE);
54
+        }else {
55
+            if (null !== $column->getValueSet()) {
56 56
                 $valueSet = $column->getValueSet();
57
-                if(in_array($value, $valueSet)) {
57
+                if (in_array($value, $valueSet)) {
58 58
                     $value = array_search($value, $valueSet);
59 59
                 }
60 60
             }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null)
86 86
     {
87
-        $queryReflector = new \ReflectionClass($modelNameNamespace . "Query");
87
+        $queryReflector = new \ReflectionClass($modelNameNamespace."Query");
88 88
         /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */
89 89
         $query = $queryReflector->getMethod('create')->invoke($con);
90 90
 
@@ -103,31 +103,31 @@  discard block
 block discarded – undo
103 103
         $sep = '';
104 104
         foreach ($tableMap->getColumns() as $column) {
105 105
             if ($column->isText()) {
106
-                $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
106
+                $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
107 107
                 $sep = ', " ", ';
108 108
             }
109 109
         }
110
-        foreach($tableMap->getRelations() as $relation) {
111
-            if(preg_match('/I18n$/i', $relation->getName())) {
110
+        foreach ($tableMap->getRelations() as $relation) {
111
+            if (preg_match('/I18n$/i', $relation->getName())) {
112 112
                 $localeTableMap = $relation->getLocalTable();
113 113
                 foreach ($localeTableMap->getColumns() as $column) {
114 114
                     if ($column->isText()) {
115
-                        $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")';
115
+                        $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")';
116 116
                         $sep = ', " ", ';
117 117
                     }
118 118
                 }
119 119
             }
120 120
         }
121 121
         foreach (array_keys($extraColumns) as $extra) {
122
-            if(!preg_match("/(COUNT|DISTINCT|SUM|MAX|MIN|GROUP)/i", $extra)) {
123
-                $exp .= $sep . $extra;
122
+            if (!preg_match("/(COUNT|DISTINCT|SUM|MAX|MIN|GROUP)/i", $extra)) {
123
+                $exp .= $sep.$extra;
124 124
                 $sep = ', " ", ';
125 125
             }
126 126
         }
127 127
         $exp .= ")";
128 128
         $text = preg_replace('/(\'|\")/', '', $value);
129 129
         $text = preg_replace('/\ /', '%', $text);
130
-        $query->where($exp . Criteria::LIKE . '"%' . $text . '%"');
130
+        $query->where($exp.Criteria::LIKE.'"%'.$text.'%"');
131 131
     }
132 132
 
133 133
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public static function extractPrimaryKeyColumnName(TableMap $tableMap) {
138 138
         $modelPk = null;
139
-        foreach($tableMap->getPrimaryKeys() as $pk) {
139
+        foreach ($tableMap->getPrimaryKeys() as $pk) {
140 140
             $modelPk = $pk;
141 141
             break;
142 142
         }
Please login to merge, or discard this patch.
src/base/dto/Form.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
             $array['fields'][] = $field->__toArray();
43 43
         }
44 44
         usort($array['fields'], function($fieldA, $fieldB) {
45
-            if((bool)$fieldA['required'] !== (bool)$fieldB['required']) {
46
-                if((bool)$fieldA['required']) {
45
+            if ((bool)$fieldA['required'] !== (bool)$fieldB['required']) {
46
+                if ((bool)$fieldA['required']) {
47 47
                     return -1;
48
-                } else {
48
+                }else {
49 49
                     return 1;
50 50
                 }
51 51
             }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             }
57 57
             return ($aOrder < $bOrder) ? -1 : 1;
58 58
         });
59
-        foreach($this->actions as $action) {
59
+        foreach ($this->actions as $action) {
60 60
             $array['actions'][] = $action->__toArray();
61 61
         }
62 62
         return $array;
Please login to merge, or discard this patch.
src/base/extension/AssetsTokenParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
         $tmp = [];
142 142
         if (null === $node) {
143 143
             $node = $value;
144
-        } else {
144
+        }else {
145 145
             $tmp = $this->getTmpAttribute($node);
146 146
         }
147 147
         if (null !== $node) {
Please login to merge, or discard this patch.
src/base/types/helpers/DeployHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public static function updateCacheVar() {
18 18
         $now = new \DateTime(null, new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid')));
19 19
         $config = Config::getInstance()->dumpConfig();
20
-        $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His');
20
+        $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His');
21 21
         Config::save($config);
22 22
         return $config[self::CACHE_VAR_TAG];
23 23
     }
Please login to merge, or discard this patch.
src/base/types/traits/SystemTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                 $use /= 1024;
38 38
                 break;
39 39
             case "MBytes":
40
-                $use /= (1024 * 1024);
40
+                $use /= (1024*1024);
41 41
                 break;
42 42
             case "Bytes":
43 43
             default:
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
     protected function bindWarningAsExceptions()
62 62
     {
63 63
         Inspector::stats('[SystemTrait] Added handlers for errors', Inspector::SCOPE_DEBUG);
64
-        if(Config::getParam('debug')) {
64
+        if (Config::getParam('debug')) {
65 65
             Logger::log('Setting error_reporting as E_ALL');
66 66
             ini_set('error_reporting', E_ALL);
67 67
             ini_set('display_errors', 1);
68 68
         }
69 69
         //Warning & Notice handler
70
-        set_error_handler(function ($errno, $errstr, $errfile, $errline) {
70
+        set_error_handler(function($errno, $errstr, $errfile, $errline) {
71 71
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
72 72
             return true;
73 73
         }, E_ALL | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
74 74
 
75
-        register_shutdown_function(function () {
75
+        register_shutdown_function(function() {
76 76
             $error = error_get_last() or json_last_error() or preg_last_error() or \DateTime::getLastErrors();
77
-            if( $error !== NULL) {
77
+            if ($error !== NULL) {
78 78
                 $errno   = $error["type"];
79 79
                 $errfile = $error["file"];
80 80
                 $errline = $error["line"];
81 81
                 $errstr  = $error["message"];
82 82
                 Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
83
-                if(null !== Config::getParam('log.slack.hook')) {
83
+                if (null !== Config::getParam('log.slack.hook')) {
84 84
                     SlackHelper::getInstance()->trace($errstr, $errfile, $errline, $error);
85 85
                 }
86 86
             }
87 87
 
88
-            if(self::getTs() > 10 && null !== Config::getParam('log.slack.hook')) {
88
+            if (self::getTs() > 10 && null !== Config::getParam('log.slack.hook')) {
89 89
                 SlackHelper::getInstance()->trace('Slow service endpoint', '', '', [
90
-                    'time' => round(self::getTs(), 3) . ' secs',
91
-                    'memory' => round(self::getMem('MBytes'), 3) . ' Mb',
90
+                    'time' => round(self::getTs(), 3).' secs',
91
+                    'memory' => round(self::getMem('MBytes'), 3).' Mb',
92 92
                 ]);
93 93
             }
94 94
             return false;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         Inspector::stats('[SystemTrait] Initializing stats (mem + ts)');
104 104
         if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
105 105
             $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT'];
106
-        } else {
106
+        }else {
107 107
             $this->ts = PSFS_START_TS;
108 108
         }
109 109
         $this->mem = PSFS_START_MEM;
Please login to merge, or discard this patch.
src/base/types/traits/JsonTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function json($response, $statusCode = 200)
27 27
     {
28
-        if(Config::getParam('profiling.enable')) {
29
-            if(is_array($response)) {
28
+        if (Config::getParam('profiling.enable')) {
29
+            if (is_array($response)) {
30 30
                 $response['profiling'] = Inspector::getStats();
31
-            } elseif($response instanceof JsonResponse) {
31
+            } elseif ($response instanceof JsonResponse) {
32 32
                 $response = ProfilingJsonResponse::createFromPrevious($response, Inspector::getStats(Config::getParam('log.level')));
33 33
             }
34 34
         }
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
         $this->decodeJsonResponse($response);
37 37
 
38 38
         $mask = JSON_UNESCAPED_LINE_TERMINATORS | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING;
39
-        if(Config::getParam('output.json.strict_numbers')) {
39
+        if (Config::getParam('output.json.strict_numbers')) {
40 40
             $mask = JSON_UNESCAPED_LINE_TERMINATORS | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK;
41 41
         }
42 42
 
43 43
         $data = json_encode($response, $mask);
44
-        if(json_last_error() !== JSON_ERROR_NONE) {
44
+        if (json_last_error() !== JSON_ERROR_NONE) {
45 45
             Logger::log(json_last_error_msg(), LOG_CRIT);
46 46
         }
47 47
 
48
-        if(Config::getParam('angular.protection', false)) {
49
-            $data = ")]}',\n" . $data;
48
+        if (Config::getParam('angular.protection', false)) {
49
+            $data = ")]}',\n".$data;
50 50
         }
51 51
         $this->setStatus($statusCode);
52 52
         ResponseHelper::setDebugHeaders([]);
Please login to merge, or discard this patch.
src/base/types/helpers/Inspector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function stats($name = null, $scope = self::SCOPE_PROFILE) {
34 34
         self::$debug[] = self::collect($name);
35
-        if($scope === self::SCOPE_PROFILE) {
35
+        if ($scope === self::SCOPE_PROFILE) {
36 36
             self::$profiling[] = self::collect($name);
37 37
         }
38 38
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     protected static function calculateStats(array $stats, $timestamp, $mem = 0, $files = 0) {
48 48
         return [
49 49
             'ts' => round($stats['ts'] - $timestamp, 4),
50
-            'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4),
50
+            'mem' => round(($stats['mem'] - $mem)/1024/1024, 4),
51 51
             'files' => $stats['files'] - $files,
52 52
             'name' => $stats['name'],
53 53
         ];
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $mem = defined('PSFS_START_MEM') ? PSFS_START_MEM : 0;
64 64
         $files = 0;
65 65
         $scopeSelected = $scope === self::SCOPE_DEBUG ? self::$debug : self::$profiling;
66
-        foreach($scopeSelected as &$value) {
66
+        foreach ($scopeSelected as &$value) {
67 67
             $value = self::calculateStats($value, $timestamp, $mem, $files);
68 68
         }
69 69
         $scopeSelected[] = self::calculateStats(self::collect('Profiling collect ends'), $timestamp, $mem, $files);
Please login to merge, or discard this patch.