@@ -88,8 +88,8 @@ |
||
88 | 88 | $this->assertNotEquals($router->getRoute('admin'), $router->getRoute('admin', true), 'Absolute route is equal than normal'); |
89 | 89 | try { |
90 | 90 | $router->getRoute(uniqid('test', true)); |
91 | - } catch(\Exception $e) { |
|
92 | - $this->assertInstanceOf(RouterException::class, $e, 'Exception is not the expected: ' . get_class($e)); |
|
91 | + }catch (\Exception $e) { |
|
92 | + $this->assertInstanceOf(RouterException::class, $e, 'Exception is not the expected: '.get_class($e)); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use PSFS\base\types\helpers\FileHelper; |
9 | 9 | use PSFS\base\types\helpers\GeneratorHelper; |
10 | 10 | |
11 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
11 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class DispatcherTest |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | class ConfigTest extends TestCase |
18 | 18 | { |
19 | 19 | |
20 | - const CONFIG_BACKUP_PATH = CONFIG_DIR . DIRECTORY_SEPARATOR . 'config.json.bak'; |
|
20 | + const CONFIG_BACKUP_PATH = CONFIG_DIR.DIRECTORY_SEPARATOR.'config.json.bak'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Creates an instance of Config |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | |
64 | 64 | // Check if config can create the config dir |
65 | 65 | $dirtmp = uniqid('test', true); |
66 | - GeneratorHelper::createDir(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp); |
|
67 | - $this->assertFileExists(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp, 'Can\'t create test dir'); |
|
68 | - @rmdir(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp); |
|
66 | + GeneratorHelper::createDir(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp); |
|
67 | + $this->assertFileExists(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp, 'Can\'t create test dir'); |
|
68 | + @rmdir(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp); |
|
69 | 69 | |
70 | 70 | // Check if platform is configured |
71 | 71 | $this->assertTrue(is_bool($config->getDebugMode())); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ]); |
138 | 138 | |
139 | 139 | $this->assertEquals(Config::getParam('test'), $test_data, 'The value is not the same'); |
140 | - $this->assertEquals(Config::getParam('test' . uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
140 | + $this->assertEquals(Config::getParam('test'.uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
141 | 141 | $this->assertEquals(Config::getParam('test', null, 'test'), $test_data, 'The value is not the same without module value'); |
142 | 142 | |
143 | 143 | $test_data2 = microtime(true); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'value' => [$test_data2], |
148 | 148 | ]); |
149 | 149 | $this->assertEquals(Config::getParam('test'), $test_data, 'The value is not the same'); |
150 | - $this->assertEquals(Config::getParam('test' . uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
150 | + $this->assertEquals(Config::getParam('test'.uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
151 | 151 | $this->assertEquals(Config::getParam('test', null, 'test'), $test_data2, 'The value is not the same with module value'); |
152 | 152 | $this->assertEquals(Config::getParam('test', null, 'testa'), $test_data, 'The value is not the same with module value and default value'); |
153 | 153 | $this->assertEquals(Config::getParam('test', $test_data2, 'testa'), $test_data, 'The value is not the same with module value and default value'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $security = $this->getInstance(); |
72 | 72 | $security->saveUser($user); |
73 | 73 | |
74 | - $this->assertFileExists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', 'Error trying to save admins'); |
|
74 | + $this->assertFileExists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', 'Error trying to save admins'); |
|
75 | 75 | $this->assertNull($security->getUser()); |
76 | 76 | $this->assertNull($security->getAdmin()); |
77 | 77 | $this->assertTrue($security->canDo('something')); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->assertFalse($security->checkAdmin(uniqid('test', true), uniqid('error', true), true), 'Error checking admin user'); |
84 | 84 | $this->assertNull($security->getAdmin(), 'Wrong admin parser'); |
85 | 85 | |
86 | - $_COOKIE[substr(Security::MANAGER_ID_TOKEN, 0, 8)] = base64_encode($user['username'] . ':' . $user['password']); |
|
86 | + $_COOKIE[substr(Security::MANAGER_ID_TOKEN, 0, 8)] = base64_encode($user['username'].':'.$user['password']); |
|
87 | 87 | Request::getInstance()->init(); |
88 | 88 | $this->assertTrue($security->checkAdmin(null, null, true), 'An error occurred verifying the admin user'); |
89 | 89 | AdminServices::setTest(true); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param MockObject|Security|null $security |
30 | 30 | * @return Dispatcher |
31 | 31 | */ |
32 | - private function getInstance(MockObject|Config $config = null, MockObject|Router $router = null, MockObject|Security $security = null): Dispatcher |
|
32 | + private function getInstance(MockObject | Config $config = null, MockObject | Router $router = null, MockObject | Security $security = null): Dispatcher |
|
33 | 33 | { |
34 | 34 | $dispatcher = Dispatcher::getInstance(); |
35 | 35 | Security::setTest(false); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $test = $test[0] === true; |
121 | 121 | unset($test); |
122 | 122 | $this->fail('Exception has not been thrown'); |
123 | - } catch (\Exception $e) { |
|
123 | + }catch (\Exception $e) { |
|
124 | 124 | $this->assertTrue(true); |
125 | 125 | } |
126 | 126 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | $this->getInstance($this->mockConfiguredDebugConfig()); |
135 | 135 | try { |
136 | 136 | //This throws a warning because file 'test.txt' not exists |
137 | - file_get_contents(__DIR__ . 'test.txt'); |
|
137 | + file_get_contents(__DIR__.'test.txt'); |
|
138 | 138 | $this->fail('Exception has not been thrown'); |
139 | - } catch (\Exception $e) { |
|
139 | + }catch (\Exception $e) { |
|
140 | 140 | $this->assertTrue(true); |
141 | 141 | } |
142 | 142 | } |
@@ -22,23 +22,23 @@ discard block |
||
22 | 22 | { |
23 | 23 | // try to create html folders |
24 | 24 | GeneratorHelper::createDir(WEB_DIR); |
25 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'css'); |
|
26 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'js'); |
|
27 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'media'); |
|
28 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'font'); |
|
25 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'css'); |
|
26 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'js'); |
|
27 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'media'); |
|
28 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'font'); |
|
29 | 29 | |
30 | 30 | // Checks if exists all the folders |
31 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder not exists'); |
|
32 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder not exists'); |
|
33 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder not exists'); |
|
34 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder not exists'); |
|
31 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder not exists'); |
|
32 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder not exists'); |
|
33 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder not exists'); |
|
34 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder not exists'); |
|
35 | 35 | |
36 | 36 | GeneratorHelper::clearDocumentRoot(); |
37 | 37 | // Checks if not exists all the folders |
38 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder still exists'); |
|
39 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder still exists'); |
|
40 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder still exists'); |
|
41 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder still exists'); |
|
38 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder still exists'); |
|
39 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder still exists'); |
|
40 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder still exists'); |
|
41 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder still exists'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | { |
49 | 49 | GeneratorHelper::createRoot(WEB_DIR, null, true); |
50 | 50 | // Checks if exists all the folders |
51 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder not exists'); |
|
52 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder not exists'); |
|
53 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder not exists'); |
|
54 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder not exists'); |
|
55 | - $this->assertFileExists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale', 'locale folder not exists'); |
|
51 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder not exists'); |
|
52 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder not exists'); |
|
53 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder not exists'); |
|
54 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder not exists'); |
|
55 | + $this->assertFileExists(BASE_DIR.DIRECTORY_SEPARATOR.'locale', 'locale folder not exists'); |
|
56 | 56 | |
57 | 57 | // Check if base files in the document root exists |
58 | 58 | $files = [ |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'robots.txt', |
64 | 64 | ]; |
65 | 65 | foreach ($files as $file) { |
66 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . $file, $file . ' not exists in html path'); |
|
66 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.$file, $file.' not exists in html path'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
3 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
2 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
3 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'autoload.php'; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $headers = []; |
90 | 90 | foreach ($this->getHeaders() as $key => $value) { |
91 | - $headers[] = $key . ': ' . $value; |
|
91 | + $headers[] = $key.': '.$value; |
|
92 | 92 | } |
93 | 93 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
94 | 94 | if (count($headers)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | case Request::VERB_GET: |
119 | 119 | if (!empty($this->params)) { |
120 | 120 | $sep = !str_contains($this->getUrl(), '?') ? '?' : ''; |
121 | - $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false); |
|
121 | + $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false); |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case Request::VERB_POST: |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if ($this->isDebug() && is_resource($verbose)) { |
150 | 150 | $this->dumpVerboseLogs($verbose); |
151 | 151 | } |
152 | - Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
152 | + Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
153 | 153 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
154 | 154 | } |
155 | 155 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false)) |
35 | 35 | ) { |
36 | 36 | if (!self::isTest() && |
37 | - null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) { |
|
37 | + null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) { |
|
38 | 38 | throw new AdminCredentialsException(); |
39 | 39 | } |
40 | 40 | if (!Security::getInstance()->checkAdmin()) { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $token = ''; |
55 | 55 | $length = strlen($timestamp); |
56 | 56 | for ($i = 0; $i < $length; $i++) { |
57 | - $token = substr($hash, $i, 1) . |
|
58 | - substr($timestamp, $i, 1) . |
|
57 | + $token = substr($hash, $i, 1). |
|
58 | + substr($timestamp, $i, 1). |
|
59 | 59 | $token; |
60 | 60 | } |
61 | 61 | return $token; |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | $charsLength = strlen(self::RAND_SEP) - 1; |
75 | 75 | $tsLength = strlen($timestamp); |
76 | 76 | $i = 0; |
77 | - $partCount = ceil($hashRest / 4); |
|
78 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
77 | + $partCount = ceil($hashRest/4); |
|
78 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
79 | 79 | while (false !== $part && strlen($part) > 0) { |
80 | - $mixedToken .= $part . |
|
81 | - substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) . |
|
80 | + $mixedToken .= $part. |
|
81 | + substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1). |
|
82 | 82 | substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1); |
83 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
83 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
84 | 84 | $i++; |
85 | 85 | } |
86 | - return $mixedToken . $token; |
|
86 | + return $mixedToken.$token; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private static function getTs($isOdd = null) |
94 | 94 | { |
95 | 95 | $timestamp = time(); |
96 | - $tsIsOdd = (bool)((int)substr($timestamp, -1) % 2); |
|
96 | + $tsIsOdd = (bool)((int)substr($timestamp, -1)%2); |
|
97 | 97 | if (false === $isOdd && !$tsIsOdd) { |
98 | 98 | $timestamp--; |
99 | 99 | } elseif (true === $isOdd && !$tsIsOdd) { |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $timestamp = ''; |
130 | 130 | $part = strrev($part); |
131 | 131 | for ($i = 0, $ct = strlen($part); $i < $ct; $i++) { |
132 | - if ($i % 2 == 0) { |
|
132 | + if ($i%2 == 0) { |
|
133 | 133 | $timestamp .= substr($part, $i, 1); |
134 | - } else { |
|
134 | + }else { |
|
135 | 135 | $partToken .= substr($part, $i, 1); |
136 | 136 | } |
137 | 137 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | list($partToken, $timestamp) = self::extractTs(array_pop($parts)); |
149 | 149 | $token = null; |
150 | 150 | if ($timestamp > 0) { |
151 | - $token = $partToken . implode('', $parts); |
|
151 | + $token = $partToken.implode('', $parts); |
|
152 | 152 | } |
153 | 153 | return [$token, $timestamp]; |
154 | 154 | } |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $objects = scandir($dir); |
24 | 24 | foreach ($objects as $object) { |
25 | 25 | if ($object != "." && $object != "..") { |
26 | - if (filetype($dir . "/" . $object) == "dir") { |
|
27 | - self::deleteDir($dir . "/" . $object); |
|
28 | - } else { |
|
29 | - unlink($dir . "/" . $object); |
|
26 | + if (filetype($dir."/".$object) == "dir") { |
|
27 | + self::deleteDir($dir."/".$object); |
|
28 | + }else { |
|
29 | + unlink($dir."/".$object); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | { |
43 | 43 | $rootDirs = array("css", "js", "media", "font"); |
44 | 44 | foreach ($rootDirs as $dir) { |
45 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
45 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
46 | 46 | try { |
47 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
48 | - } catch (\Exception $e) { |
|
47 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
48 | + }catch (\Exception $e) { |
|
49 | 49 | syslog(LOG_INFO, $e->getMessage()); |
50 | 50 | } |
51 | 51 | } |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function createDir($dir) |
61 | 61 | { |
62 | - if(!empty($dir)) { |
|
62 | + if (!empty($dir)) { |
|
63 | 63 | try { |
64 | 64 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
65 | - throw new \Exception(t('Can\'t create directory ') . $dir); |
|
65 | + throw new \Exception(t('Can\'t create directory ').$dir); |
|
66 | 66 | } |
67 | - } catch (\Exception $e) { |
|
67 | + }catch (\Exception $e) { |
|
68 | 68 | syslog(LOG_WARNING, $e->getMessage()); |
69 | 69 | if (!file_exists(dirname($dir))) { |
70 | - throw new GeneratorException($e->getMessage() . $dir); |
|
70 | + throw new GeneratorException($e->getMessage().$dir); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function getTemplatePath() |
81 | 81 | { |
82 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
82 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
83 | 83 | return realpath($path); |
84 | 84 | } |
85 | 85 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | * @throws \ReflectionException |
99 | 99 | */ |
100 | 100 | public static function checkCustomNamespaceApi($namespace) { |
101 | - if(!empty($namespace)) { |
|
102 | - if(class_exists($namespace)) { |
|
101 | + if (!empty($namespace)) { |
|
102 | + if (class_exists($namespace)) { |
|
103 | 103 | $reflector = new \ReflectionClass($namespace); |
104 | - if(!$reflector->isSubclassOf(Api::class)) { |
|
104 | + if (!$reflector->isSubclassOf(Api::class)) { |
|
105 | 105 | throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501); |
106 | - } elseif(!$reflector->isAbstract()) { |
|
106 | + } elseif (!$reflector->isAbstract()) { |
|
107 | 107 | throw new GeneratorException(t('La clase definida debe ser abstracta'), 501); |
108 | 108 | } |
109 | - } else { |
|
109 | + }else { |
|
110 | 110 | throw new GeneratorException(t('La clase definida para extender la API no existe'), 501); |
111 | 111 | } |
112 | 112 | } |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public static function createRoot($path = WEB_DIR, OutputInterface $output = null, $quiet = false) { |
122 | 122 | |
123 | - if(null === $output) { |
|
123 | + if (null === $output) { |
|
124 | 124 | $output = new ConsoleOutput(); |
125 | 125 | } |
126 | 126 | |
127 | 127 | GeneratorHelper::createDir($path); |
128 | 128 | $paths = array("js", "css", "img", "media", "font"); |
129 | 129 | foreach ($paths as $htmlPath) { |
130 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
130 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // Generates the root needed files |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | 'crossdomain' => 'crossdomain.xml', |
138 | 138 | 'humans' => 'humans.txt', |
139 | 139 | 'robots' => 'robots.txt', |
140 | - 'docker' => '..' . DIRECTORY_SEPARATOR . 'docker-compose.yml', |
|
140 | + 'docker' => '..'.DIRECTORY_SEPARATOR.'docker-compose.yml', |
|
141 | 141 | ]; |
142 | 142 | $output->writeln('Start creating html files'); |
143 | 143 | foreach ($files as $templates => $filename) { |
144 | - $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig'); |
|
145 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
146 | - if(!$quiet) { |
|
147 | - $output->writeln('Can\t create the file ' . $filename); |
|
144 | + $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
145 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
146 | + if (!$quiet) { |
|
147 | + $output->writeln('Can\t create the file '.$filename); |
|
148 | 148 | } |
149 | - } else { |
|
150 | - if(!$quiet) { |
|
151 | - $output->writeln($filename . ' created successfully'); |
|
149 | + }else { |
|
150 | + if (!$quiet) { |
|
151 | + $output->writeln($filename.' created successfully'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | //Export base locale translations |
157 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
158 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
159 | - self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
157 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
158 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
159 | + self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | { |
173 | 173 | if (file_exists($filenamePath)) { |
174 | 174 | $destfolder = basename($filenamePath); |
175 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
175 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
176 | 176 | if (is_dir($filenamePath)) { |
177 | - self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
178 | - } else { |
|
179 | - if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
180 | - throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
177 | + self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
178 | + }else { |
|
179 | + if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
180 | + throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | self::createDir($dst); |
196 | 196 | while (false !== ($file = readdir($dir))) { |
197 | 197 | if (($file != '.') && ($file != '..')) { |
198 | - if (is_dir($src . '/' . $file)) { |
|
199 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
200 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
201 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
198 | + if (is_dir($src.'/'.$file)) { |
|
199 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
200 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
201 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |