Passed
Push — master ( 8a1343...8e40c5 )
by Fran
02:37
created
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
             $objects = scandir($dir);
20 20
             foreach ($objects as $object) {
21 21
                 if ($object != "." && $object != "..") {
22
-                    if (filetype($dir . "/" . $object) == "dir") {
23
-                        self::deleteDir($dir . "/" . $object);
24
-                    } else {
25
-                        unlink($dir . "/" . $object);
22
+                    if (filetype($dir."/".$object) == "dir") {
23
+                        self::deleteDir($dir."/".$object);
24
+                    }else {
25
+                        unlink($dir."/".$object);
26 26
                     }
27 27
                 }
28 28
             }
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $rootDirs = array("css", "js", "media", "font");
40 40
         foreach ($rootDirs as $dir) {
41
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
41
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
42 42
                 try {
43
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
44
-                } catch (\Exception $e) {
43
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
44
+                }catch (\Exception $e) {
45 45
                     Logger::log($e->getMessage());
46 46
                 }
47 47
             }
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
     {
58 58
         try {
59 59
             if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
60
-                throw new \Exception(t('Can\'t create directory ') . $dir);
60
+                throw new \Exception(t('Can\'t create directory ').$dir);
61 61
             }
62
-        } catch (\Exception $e) {
62
+        }catch (\Exception $e) {
63 63
             Logger::log($e->getMessage(), LOG_WARNING);
64 64
             if (!file_exists(dirname($dir))) {
65
-                throw new GeneratorException($e->getMessage() . $dir);
65
+                throw new GeneratorException($e->getMessage().$dir);
66 66
             }
67 67
         }
68 68
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function getTemplatePath()
75 75
     {
76
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
76
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
77 77
         return realpath($path);
78 78
     }
79 79
 
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
      * @throws \ReflectionException
93 93
      */
94 94
     public static function checkCustomNamespaceApi($namespace) {
95
-        if(!empty($namespace)) {
96
-            if(class_exists($namespace)) {
95
+        if (!empty($namespace)) {
96
+            if (class_exists($namespace)) {
97 97
                 $reflector = new \ReflectionClass($namespace);
98
-                if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
98
+                if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
99 99
                     throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501);
100
-                } elseif(!$reflector->isAbstract()) {
100
+                } elseif (!$reflector->isAbstract()) {
101 101
                     throw new GeneratorException(t('La clase definida debe ser abstracta'), 501);
102 102
                 }
103
-            } else {
103
+            }else {
104 104
                 throw new GeneratorException(t('La clase definida para extender la API no existe'), 501);
105 105
             }
106 106
         }
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
      * @return array
112 112
      */
113 113
     public static function getDomainPaths($domain) {
114
-        $domains = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json'), true);
114
+        $domains = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json'), true);
115 115
         $paths = [];
116
-        if(null !== $domains) {
116
+        if (null !== $domains) {
117 117
             $keyDomains = array_keys($domains);
118
-            foreach($keyDomains as $keyDomain) {
118
+            foreach ($keyDomains as $keyDomain) {
119 119
                 $key = strtoupper(str_replace(['@', '/'], '', $keyDomain));
120
-                if(strtoupper($domain) === $key) {
120
+                if (strtoupper($domain) === $key) {
121 121
                     $paths = $domains[$keyDomain];
122 122
                     break;
123 123
                 }
Please login to merge, or discard this patch.