Passed
Push — master ( ab5b91...849dc0 )
by Fran
03:17
created
src/base/types/traits/Helper/OptionTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @return OptionTrait
49 49
      */
50 50
     public function dropOption($key) {
51
-        if(array_key_exists($key, $this->options)) {
51
+        if (array_key_exists($key, $this->options)) {
52 52
             unset($this->options[$key]);
53 53
         }
54 54
         return $this;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @return mixed|null
60 60
      */
61 61
     public function getOption($key) {
62
-        if(array_key_exists($key, $this->options)) {
62
+        if (array_key_exists($key, $this->options)) {
63 63
             return $this->options[$key];
64 64
         }
65 65
         return null;
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PSFS\base\types\traits;
3 3
 
4
-if(!defined('PSFS_BOOSTRAP_TRAT_LOADED')) {
4
+if (!defined('PSFS_BOOSTRAP_TRAT_LOADED')) {
5 5
     /**
6 6
      * Class BoostrapTrait
7 7
      * @package PSFS\base\types
@@ -10,5 +10,5 @@  discard block
 block discarded – undo
10 10
     {
11 11
     }
12 12
     define('PSFS_BOOSTRAP_TRAT_LOADED', true);
13
-    require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
13
+    require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
14 14
 }
Please login to merge, or discard this patch.
src/base/dto/Order.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         if (preg_match('/^asc$/i', $direction)) {
64 64
             return self::ASC;
65
-        } else {
65
+        }else {
66 66
             return self::DESC;
67 67
         }
68 68
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function fromArray(array $object = [])
83 83
     {
84
-        foreach($object as $field => $order) {
84
+        foreach ($object as $field => $order) {
85 85
             $this->addOrder($field, $order);
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/controller/RouteController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
             $router->simpatize();
58 58
             Security::getInstance()->setFlash("callback_message", t("Rutas generadas correctamente"));
59 59
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
60
-        } catch (Exception $e) {
60
+        }catch (Exception $e) {
61 61
             Logger::log($e->getMessage(), LOG_ERR);
62 62
             Security::getInstance()->setFlash("callback_message", t("Algo no ha salido bien, revisa los logs"));
63 63
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
Please login to merge, or discard this patch.
src/base/Singleton.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function __construct()
28 28
     {
29
-        Logger::log(static::class . ' constructor invoked');
29
+        Logger::log(static::class.' constructor invoked');
30 30
         $this->init();
31 31
     }
32 32
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
         $calledClass = static::class;
86 86
         try {
87 87
             $instance = InjectorHelper::constructInjectableInstance($variable, $singleton, $classNameSpace, $calledClass);
88
-            $setter = 'set' . ucfirst($variable);
88
+            $setter = 'set'.ucfirst($variable);
89 89
             if (method_exists($calledClass, $setter)) {
90 90
                 $this->$setter($instance);
91
-            } else {
91
+            }else {
92 92
                 $this->$variable = $instance;
93 93
             }
94
-        } catch (Exception $e) {
95
-            Logger::log($e->getMessage() . ': ' . $e->getFile() . ' [' . $e->getLine() . ']', LOG_ERR);
94
+        }catch (Exception $e) {
95
+            Logger::log($e->getMessage().': '.$e->getFile().' ['.$e->getLine().']', LOG_ERR);
96 96
             throw $e;
97 97
         }
98 98
         return $this;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     {
108 108
         if (!$this->isLoaded()) {
109 109
             $filename = sha1(get_class($this));
110
-            $cacheFilename = 'reflections' . DIRECTORY_SEPARATOR . substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2) . DIRECTORY_SEPARATOR . $filename . '.json';
110
+            $cacheFilename = 'reflections'.DIRECTORY_SEPARATOR.substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2).DIRECTORY_SEPARATOR.$filename.'.json';
111 111
             /** @var Cache $cacheService */
112 112
             $cacheService = Cache::getInstance();
113 113
             /** @var Config $configService */
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                 }
126 126
             }
127 127
             $this->setLoaded();
128
-        } else {
129
-            Logger::log(get_class($this) . ' already loaded', LOG_INFO);
128
+        }else {
129
+            Logger::log(get_class($this).' already loaded', LOG_INFO);
130 130
         }
131 131
     }
132 132
 }
Please login to merge, or discard this patch.
src/base/types/traits/Helper/FieldHelperTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -122,27 +122,27 @@  discard block
 block discarded – undo
122 122
         $behaviors = $tableMap->getBehaviors();
123 123
         foreach ($map::getFieldNames() as $field) {
124 124
             $fDto = self::parseFormField($domain, $tableMap, $field, $behaviors);
125
-            if(null !== $fDto) {
125
+            if (null !== $fDto) {
126 126
                 $form->addField($fDto);
127 127
             }
128 128
         }
129 129
 
130
-        if(array_key_exists('i18n', $behaviors)) {
131
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
132
-            if(null !== $relateI18n) {
130
+        if (array_key_exists('i18n', $behaviors)) {
131
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
132
+            if (null !== $relateI18n) {
133 133
                 $i18NTableMap = $relateI18n->getLocalTable();
134
-                foreach($i18NTableMap->getColumns() as $columnMap) {
134
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
135 135
                     $columnName = self::getColumnMapName($columnMap);
136
-                    if(!$form->fieldExists($columnName)) {
136
+                    if (!$form->fieldExists($columnName)) {
137 137
                         /** @var Field $fDto */
138 138
                         $fDto = self::parseFormField($domain, $i18NTableMap, $columnMap->getPhpName(), $i18NTableMap->getBehaviors());
139
-                        if(null !== $fDto) {
139
+                        if (null !== $fDto) {
140 140
                             $fDto->pk = false;
141 141
                             $fDto->required = true;
142
-                            if(strtolower($fDto->name) === 'locale') {
142
+                            if (strtolower($fDto->name) === 'locale') {
143 143
                                 $fDto->type = Field::COMBO_TYPE;
144 144
                                 $languages = explode(',', Config::getParam('i18n.locales', Config::getParam('default.language', 'es_ES')));
145
-                                foreach($languages as $language) {
145
+                                foreach ($languages as $language) {
146 146
                                     $fDto->data[] = [
147 147
                                         $fDto->name => $language,
148 148
                                         'Label' => t($language),
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $column = null;
171 171
         try {
172
-            foreach($tableMap->getColumns() as $tableMapColumn) {
172
+            foreach ($tableMap->getColumns() as $tableMapColumn) {
173 173
                 $columnName = $tableMapColumn->getPhpName();
174
-                if(preg_match('/^'.$field.'$/i', $columnName)) {
174
+                if (preg_match('/^'.$field.'$/i', $columnName)) {
175 175
                     $column = $tableMapColumn;
176 176
                     break;
177 177
                 }
178 178
             }
179
-        } catch (\Exception $e) {
179
+        }catch (\Exception $e) {
180 180
             Logger::log($e->getMessage(), LOG_DEBUG);
181 181
         }
182 182
         return $column;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public static function getFieldTypes() {
189 189
         $configType = Config::getParam('api.field.case', TableMap::TYPE_PHPNAME);
190
-        switch($configType) {
190
+        switch ($configType) {
191 191
             default:
192 192
             case 'UpperCamelCase':
193 193
             case TableMap::TYPE_PHPNAME:
Please login to merge, or discard this patch.
src/controller/I18nController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         //Generating the templates translations
45 45
         $translations = $this->tpl->regenerateTemplates();
46 46
 
47
-        $localePath = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
48
-        $localePath .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
47
+        $localePath = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
48
+        $localePath .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
49 49
 
50 50
         //xgettext localizations
51 51
         $translations = array_merge($translations, I18nHelper::findTranslations(SOURCE_DIR, $locale));
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $translations = array_merge($translations, I18nHelper::findTranslations(CACHE_DIR, $locale));
54 54
 
55 55
         $translations[] = "msgfmt {$localePath}translations.po -o {$localePath}translations.mo";
56
-        $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt '. $localePath . 'translations.po -o ' . $localePath . 'translations.mo');
56
+        $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt '.$localePath.'translations.po -o '.$localePath.'translations.mo');
57 57
         return $this->render('translations.html.twig', array(
58 58
             'translations' => $translations,
59 59
         ));
Please login to merge, or discard this patch.
src/base/types/traits/Generator/StructureTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // Creates the src folder
25 25
         GeneratorHelper::createDir($modPath);
26 26
         // Create module path
27
-        GeneratorHelper::createDir($modPath . $module);
27
+        GeneratorHelper::createDir($modPath.$module);
28 28
     }
29 29
 
30 30
     /**
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
         Logger::log("Generamos la estructura");
41 41
         $paths = [
42 42
             "Api", "Config", "Controller", "Models", "Public", "Templates", "Services", "Test", "Doc",
43
-            "Locale", "Locale/" . Config::getParam('default.locale', 'es_ES'), "Locale/" . Config::getParam('default.locale', 'es_ES') . "/LC_MESSAGES"
43
+            "Locale", "Locale/".Config::getParam('default.locale', 'es_ES'), "Locale/".Config::getParam('default.locale', 'es_ES')."/LC_MESSAGES"
44 44
         ];
45
-        $modulePath = $modPath . $module;
45
+        $modulePath = $modPath.$module;
46 46
         foreach ($paths as $path) {
47
-            GeneratorHelper::createDir($modulePath . DIRECTORY_SEPARATOR . $path);
47
+            GeneratorHelper::createDir($modulePath.DIRECTORY_SEPARATOR.$path);
48 48
         }
49 49
         //Creamos las carpetas de los assets
50 50
         $htmlPaths = array("css", "js", "img", "media", "font");
51 51
         foreach ($htmlPaths as $path) {
52
-            GeneratorHelper::createDir($modulePath . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path);
52
+            GeneratorHelper::createDir($modulePath.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path);
53 53
         }
54 54
     }
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
         //Generamos el fichero de configuración
65 65
         Logger::log("Generamos ficheros para assets base");
66 66
         $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n",
67
-            $modPath . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css",
67
+            $modPath.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css",
68 68
             $force);
69 69
         $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();",
70
-            $modPath . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js",
70
+            $modPath.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js",
71 71
             $force);
72 72
         return ($css && $js);
73 73
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             "class" => $class,
90 90
         ));
91 91
         return $this->writeTemplateToFile($controller,
92
-            $modPath . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php",
92
+            $modPath.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php",
93 93
             $force);
94 94
     }
95 95
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
             "autoloader" => preg_replace('/(\\\|\/)/', '_', $module),
109 109
             "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module),
110 110
         ));
111
-        $autoload = $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force);
111
+        $autoload = $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force);
112 112
 
113 113
         Logger::log("Generamos el phpunit");
114 114
         $phpUnitTemplate = $this->tpl->dump("generator/phpunit.template.twig", array(
115 115
             "module" => $module,
116 116
         ));
117
-        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path . DIRECTORY_SEPARATOR . "phpunit.xml.dist", $force);
117
+        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path.DIRECTORY_SEPARATOR."phpunit.xml.dist", $force);
118 118
         return $autoload && $phpunit;
119 119
     }
120 120
 }
Please login to merge, or discard this patch.
src/base/types/traits/TemplateTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
             try {
29 29
                 Cache::getInstance()->storeData($filename, $fileContent, Cache::TEXT, true);
30 30
                 $created = true;
31
-            } catch (\Exception $e) {
31
+            }catch (\Exception $e) {
32 32
                 Logger::log($e->getMessage(), LOG_ERR);
33 33
             }
34
-        } else {
35
-            Logger::log($filename . t(' not exists or cant write'), LOG_ERR);
34
+        }else {
35
+            Logger::log($filename.t(' not exists or cant write'), LOG_ERR);
36 36
         }
37 37
         return $created;
38 38
     }
Please login to merge, or discard this patch.