@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $download = false; |
| 80 | 80 | if (false !== ($key = array_search('download', $segments))) { |
| 81 | 81 | $download = true; |
| 82 | - unset($segments[ $key ]); |
|
| 82 | + unset($segments[$key]); |
|
| 83 | 83 | $segments = array_values($segments); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if (count($segments)) { |
| 87 | - $filePath = $this->directoryPath . implode(DIRECTORY_SEPARATOR, $segments); |
|
| 87 | + $filePath = $this->directoryPath.implode(DIRECTORY_SEPARATOR, $segments); |
|
| 88 | 88 | if (is_file($filePath)) { |
| 89 | 89 | if ($download) { |
| 90 | 90 | $downloader = new Downloader($filePath); |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | ->download(); |
| 95 | 95 | } else { |
| 96 | 96 | $fileInfo = new SplFileInfo($filePath); |
| 97 | - header('Content-Disposition: filename=' . $fileInfo->getFilename()); |
|
| 97 | + header('Content-Disposition: filename='.$fileInfo->getFilename()); |
|
| 98 | 98 | header('Content-Transfer-Encoding: binary'); |
| 99 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); |
|
| 100 | - header('Content-Type: ' . $fileInfo->getMime()); |
|
| 99 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); |
|
| 100 | + header('Content-Type: '.$fileInfo->getMime()); |
|
| 101 | 101 | echo @readfile($filePath); |
| 102 | 102 | exit(EXIT_SUCCESS); |
| 103 | 103 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | if (services()->has('csrfProtection')) { |
| 40 | 40 | if (hash_equals(input()->server('REQUEST_METHOD'), 'POST')) { |
| 41 | - if ( ! services()->get('csrfProtection')->verify()) { |
|
| 41 | + if (!services()->get('csrfProtection')->verify()) { |
|
| 42 | 42 | output()->sendError(403, [ |
| 43 | 43 | 'message' => language()->getLine('403_INVALID_CSRF'), |
| 44 | 44 | ]); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | public function handle(ServerRequestInterface $request) |
| 40 | 40 | { |
| 41 | 41 | // Try to get from cache |
| 42 | - $cacheKey = 'o2output_' . underscore(server_request()->getUri()->segments->__toString()); |
|
| 42 | + $cacheKey = 'o2output_'.underscore(server_request()->getUri()->segments->__toString()); |
|
| 43 | 43 | |
| 44 | 44 | $cacheHandle = cache()->getItemPool('default'); |
| 45 | 45 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | protected function filter($type, $offset = null, $filter = FILTER_DEFAULT) |
| 36 | 36 | { |
| 37 | 37 | if (services()->has('xssProtection')) { |
| 38 | - if ( ! services()->get('xssProtection')->verify()) { |
|
| 38 | + if (!services()->get('xssProtection')->verify()) { |
|
| 39 | 39 | $string = parent::filter($type, $offset, $filter); |
| 40 | 40 | |
| 41 | 41 | if (is_string($string)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | |
| 35 | - if(services()->has('csrfProtection')) { |
|
| 35 | + if (services()->has('csrfProtection')) { |
|
| 36 | 36 | $this->addHeader('X-CSRF-TOKEN', services()->get('csrfProtection')->getToken()); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | foreach ($filePaths as $filePath) { |
| 79 | - if (is_file($filePath . $filename . '.phtml')) { |
|
| 80 | - return $filePath . $filename . '.phtml'; |
|
| 79 | + if (is_file($filePath.$filename.'.phtml')) { |
|
| 80 | + return $filePath.$filename.'.phtml'; |
|
| 81 | 81 | break; |
| 82 | - } elseif (is_file($filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml')) { |
|
| 83 | - return $filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml'; |
|
| 82 | + } elseif (is_file($filePath.'errors'.DIRECTORY_SEPARATOR.$filename.'.phtml')) { |
|
| 83 | + return $filePath.'errors'.DIRECTORY_SEPARATOR.$filename.'.phtml'; |
|
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | $error = new ErrorException($errorMessage, $errorSeverity, $errorFile, $errorLine, $errorContext); |
| 149 | 149 | |
| 150 | 150 | // Logged the error |
| 151 | - if(services()->has('logger')) { |
|
| 151 | + if (services()->has('logger')) { |
|
| 152 | 152 | logger()->error( |
| 153 | 153 | implode( |
| 154 | 154 | ' ', |
| 155 | 155 | [ |
| 156 | - '[ ' . $error->getStringSeverity() . ' ] ', |
|
| 156 | + '[ '.$error->getStringSeverity().' ] ', |
|
| 157 | 157 | $error->getMessage(), |
| 158 | - $error->getFile() . ':' . $error->getLine(), |
|
| 158 | + $error->getFile().':'.$error->getLine(), |
|
| 159 | 159 | ] |
| 160 | 160 | ) |
| 161 | 161 | ); |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | $this->send(implode( |
| 172 | 172 | ' ', |
| 173 | 173 | [ |
| 174 | - '[ ' . $error->getStringSeverity() . ' ] ', |
|
| 174 | + '[ '.$error->getStringSeverity().' ] ', |
|
| 175 | 175 | $error->getMessage(), |
| 176 | - $error->getFile() . ':' . $error->getLine(), |
|
| 176 | + $error->getFile().':'.$error->getLine(), |
|
| 177 | 177 | ] |
| 178 | 178 | )); |
| 179 | 179 | exit(EXIT_ERROR); |
@@ -215,30 +215,30 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function sendError($code = 204, $vars = null, $headers = []) |
| 217 | 217 | { |
| 218 | - $languageKey = $code . '_' . error_code_string($code); |
|
| 218 | + $languageKey = $code.'_'.error_code_string($code); |
|
| 219 | 219 | |
| 220 | 220 | $error = [ |
| 221 | 221 | 'code' => $code, |
| 222 | - 'title' => language()->getLine($languageKey . '_TITLE'), |
|
| 223 | - 'message' => language()->getLine($languageKey . '_MESSAGE'), |
|
| 222 | + 'title' => language()->getLine($languageKey.'_TITLE'), |
|
| 223 | + 'message' => language()->getLine($languageKey.'_MESSAGE'), |
|
| 224 | 224 | ]; |
| 225 | 225 | |
| 226 | 226 | $this->statusCode = $code; |
| 227 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 227 | + $this->reasonPhrase = $error['title']; |
|
| 228 | 228 | |
| 229 | 229 | if (is_string($vars)) { |
| 230 | 230 | $vars = ['message' => $vars]; |
| 231 | - } elseif (is_array($vars) and empty($vars[ 'message' ])) { |
|
| 232 | - $vars[ 'message' ] = $error[ 'message' ]; |
|
| 231 | + } elseif (is_array($vars) and empty($vars['message'])) { |
|
| 232 | + $vars['message'] = $error['message']; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if (isset($vars[ 'message' ])) { |
|
| 236 | - $error[ 'message' ] = $vars[ 'message' ]; |
|
| 235 | + if (isset($vars['message'])) { |
|
| 236 | + $error['message'] = $vars['message']; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (is_ajax() or $this->mimeType !== 'text/html') { |
| 240 | 240 | $this->statusCode = $code; |
| 241 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 241 | + $this->reasonPhrase = $error['title']; |
|
| 242 | 242 | $this->send($vars); |
| 243 | 243 | |
| 244 | 244 | exit(EXIT_ERROR); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | if (method_exists($db, 'hasTable')) { |
| 227 | 227 | // SQL Migrate Setup |
| 228 | - if ( ! $db->hasTable('sys_migrations')) { |
|
| 228 | + if (!$db->hasTable('sys_migrations')) { |
|
| 229 | 229 | $forge = $db->getForge(); |
| 230 | 230 | $forge->createTable('sys_migrations', [ |
| 231 | 231 | 'id' => [ |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | public function register() |
| 321 | 321 | { |
| 322 | 322 | $batch = $this->getLatestBatch(); |
| 323 | - $files = glob(PATH_DATABASE . "migrations/*.php"); |
|
| 323 | + $files = glob(PATH_DATABASE."migrations/*.php"); |
|
| 324 | 324 | |
| 325 | 325 | foreach ($files as $filename) { |
| 326 | 326 | $sets = [ |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | 'batch' => $batch, |
| 331 | 331 | ]; |
| 332 | 332 | |
| 333 | - $this->insertOrUpdate($sets, ['filename' => $sets[ 'filename' ]]); |
|
| 333 | + $this->insertOrUpdate($sets, ['filename' => $sets['filename']]); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | protected function getFilename($filename) |
| 349 | 349 | { |
| 350 | - return str_replace(PATH_DATABASE . 'migrations' . DIRECTORY_SEPARATOR, '', $filename); |
|
| 350 | + return str_replace(PATH_DATABASE.'migrations'.DIRECTORY_SEPARATOR, '', $filename); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | // ------------------------------------------------------------------------ |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $timestamp = filemtime($filename); |
| 367 | 367 | preg_match('/\d{4}[-]?\d{2}[-]?\d{2}[-]?\d{2}[-]?\d{2}[-]?\d{2}/', $filename, $matches); |
| 368 | 368 | |
| 369 | - $timestamp = count($matches) ? strtotime($matches[ 0 ]) : $timestamp; |
|
| 369 | + $timestamp = count($matches) ? strtotime($matches[0]) : $timestamp; |
|
| 370 | 370 | |
| 371 | 371 | return date('Y-m-d H:i:s', $timestamp); |
| 372 | 372 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $version = 'v0.0.0'; |
| 388 | 388 | preg_match('/v\d*[.]?\d*[.]\d*/', $filename, $matches); |
| 389 | 389 | |
| 390 | - return count($matches) ? $matches[ 0 ] : $version; |
|
| 390 | + return count($matches) ? $matches[0] : $version; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // ------------------------------------------------------------------------ |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $batch = 1; |
| 401 | 401 | if ($result = $this->qb->table('sys_migrations')->max('batch', 'lastBatch')->get()) { |
| 402 | 402 | if ($result->count()) { |
| 403 | - $batch = (int)$result->first()->lastBatch; |
|
| 403 | + $batch = (int) $result->first()->lastBatch; |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $this->model->register(); |
| 412 | 412 | } elseif (method_exists($db, 'hasCollection')) { |
| 413 | 413 | // NoSQL Migrate Setup |
| 414 | - if ( ! $db->hasCollection('sys_migrations')) { |
|
| 414 | + if (!$db->hasCollection('sys_migrations')) { |
|
| 415 | 415 | // Coming Soon |
| 416 | 416 | } |
| 417 | 417 | } |
@@ -424,13 +424,13 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function import() |
| 426 | 426 | { |
| 427 | - if( ! empty($this->optionSql)) { |
|
| 428 | - $filePath = PATH_DATABASE . str_replace(['/','\\'], DIRECTORY_SEPARATOR, $this->optionSql); |
|
| 427 | + if (!empty($this->optionSql)) { |
|
| 428 | + $filePath = PATH_DATABASE.str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $this->optionSql); |
|
| 429 | 429 | |
| 430 | - if(is_file($filePath)) { |
|
| 430 | + if (is_file($filePath)) { |
|
| 431 | 431 | $sqlStatement = file_get_contents($filePath); |
| 432 | 432 | |
| 433 | - if($this->model->db->query($sqlStatement)) { |
|
| 433 | + if ($this->model->db->query($sqlStatement)) { |
|
| 434 | 434 | |
| 435 | 435 | } else { |
| 436 | 436 | |
@@ -446,9 +446,9 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | public function latest() |
| 448 | 448 | { |
| 449 | - if($result = $this->model->findWhere(['batch' => $this->model->getLatestBatch()])) { |
|
| 450 | - if($result->count()) { |
|
| 451 | - foreach($result as $row) { |
|
| 449 | + if ($result = $this->model->findWhere(['batch' => $this->model->getLatestBatch()])) { |
|
| 450 | + if ($result->count()) { |
|
| 451 | + foreach ($result as $row) { |
|
| 452 | 452 | $this->run($row->filename, 'up'); |
| 453 | 453 | } |
| 454 | 454 | } |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | $requestBatch = ($latestBatch - 1); |
| 467 | 467 | $requestBatch = $requestBatch < 1 ? 1 : $requestBatch; |
| 468 | 468 | |
| 469 | - if( ! empty($this->optionBatch) ) { |
|
| 469 | + if (!empty($this->optionBatch)) { |
|
| 470 | 470 | $requestBatch = $this->optionBatch; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | $batches = range($requestBatch, $latestBatch, 1); |
| 474 | 474 | $batches = array_reverse($batches); |
| 475 | 475 | |
| 476 | - foreach($batches as $batch) { |
|
| 477 | - if($result = $this->model->findWhere(['batch' => $batch])) { |
|
| 478 | - if($result->count()) { |
|
| 479 | - foreach($result as $row) { |
|
| 476 | + foreach ($batches as $batch) { |
|
| 477 | + if ($result = $this->model->findWhere(['batch' => $batch])) { |
|
| 478 | + if ($result->count()) { |
|
| 479 | + foreach ($result as $row) { |
|
| 480 | 480 | $this->run($row->filename, 'down'); |
| 481 | 481 | $this->run($row->filename, 'up'); |
| 482 | 482 | } |
@@ -496,10 +496,10 @@ discard block |
||
| 496 | 496 | $batches = range(1, $batch, 1); |
| 497 | 497 | $batches = array_reverse($batches); |
| 498 | 498 | |
| 499 | - foreach($batches as $batch) { |
|
| 500 | - if($result = $this->model->findWhere(['batch' => $batch])) { |
|
| 501 | - if($result->count()) { |
|
| 502 | - foreach($result as $row) { |
|
| 499 | + foreach ($batches as $batch) { |
|
| 500 | + if ($result = $this->model->findWhere(['batch' => $batch])) { |
|
| 501 | + if ($result->count()) { |
|
| 502 | + foreach ($result as $row) { |
|
| 503 | 503 | $this->run($row->filename, 'down'); |
| 504 | 504 | $this->run($row->filename, 'up'); |
| 505 | 505 | } |
@@ -515,9 +515,9 @@ discard block |
||
| 515 | 515 | */ |
| 516 | 516 | public function fresh() |
| 517 | 517 | { |
| 518 | - if($result = $this->model->findWhere(['batch' => 1])) { |
|
| 519 | - if($result->count()) { |
|
| 520 | - foreach($result as $row) { |
|
| 518 | + if ($result = $this->model->findWhere(['batch' => 1])) { |
|
| 519 | + if ($result->count()) { |
|
| 520 | + foreach ($result as $row) { |
|
| 521 | 521 | $this->run($row->filename, 'up'); |
| 522 | 522 | } |
| 523 | 523 | } |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | protected function run($filename, $method = 'up') |
| 539 | 539 | { |
| 540 | 540 | $filePaths = [ |
| 541 | - PATH_DATABASE . 'migrations' . DIRECTORY_SEPARATOR . str_replace(['/','\\'], DIRECTORY_SEPARATOR, $filename), |
|
| 542 | - PATH_DATABASE . str_replace(['/','\\'], DIRECTORY_SEPARATOR, $filename) |
|
| 541 | + PATH_DATABASE.'migrations'.DIRECTORY_SEPARATOR.str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $filename), |
|
| 542 | + PATH_DATABASE.str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $filename) |
|
| 543 | 543 | ]; |
| 544 | 544 | |
| 545 | - foreach($filePaths as $filePath) { |
|
| 546 | - if(is_file($filePath)) { |
|
| 547 | - if(pathinfo($filePath, PATHINFO_EXTENSION) == 'php') { |
|
| 545 | + foreach ($filePaths as $filePath) { |
|
| 546 | + if (is_file($filePath)) { |
|
| 547 | + if (pathinfo($filePath, PATHINFO_EXTENSION) == 'php') { |
|
| 548 | 548 | require_once($filePath); |
| 549 | 549 | $filename = pathinfo($filePath, PATHINFO_FILENAME); |
| 550 | 550 | $filename = explode('_', $filename); |
@@ -560,10 +560,10 @@ discard block |
||
| 560 | 560 | ->setNewLinesAfter(1) |
| 561 | 561 | ); |
| 562 | 562 | |
| 563 | - if(class_exists($className)) { |
|
| 563 | + if (class_exists($className)) { |
|
| 564 | 564 | $migration = new $className(); |
| 565 | 565 | |
| 566 | - if(method_exists($migration, $method)) { |
|
| 566 | + if (method_exists($migration, $method)) { |
|
| 567 | 567 | call_user_func([$migration, $method]); |
| 568 | 568 | |
| 569 | 569 | output()->write( |
@@ -573,9 +573,9 @@ discard block |
||
| 573 | 573 | ->setNewLinesAfter(1) |
| 574 | 574 | ); |
| 575 | 575 | |
| 576 | - if($method === 'up') { |
|
| 577 | - if(method_exists($migration, 'seed')) { |
|
| 578 | - if($this->optionSeed) { |
|
| 576 | + if ($method === 'up') { |
|
| 577 | + if (method_exists($migration, 'seed')) { |
|
| 578 | + if ($this->optionSeed) { |
|
| 579 | 579 | call_user_func([$migration, 'seed']); |
| 580 | 580 | |
| 581 | 581 | output()->write( |
@@ -589,10 +589,10 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | - } elseif(pathinfo($filePath, PATHINFO_EXTENSION) == 'sql') { |
|
| 592 | + } elseif (pathinfo($filePath, PATHINFO_EXTENSION) == 'sql') { |
|
| 593 | 593 | $sqlStatement = file_get_contents($filePath); |
| 594 | 594 | |
| 595 | - if($this->model->db->query($sqlStatement)) { |
|
| 595 | + if ($this->model->db->query($sqlStatement)) { |
|
| 596 | 596 | output()->write( |
| 597 | 597 | (new Format()) |
| 598 | 598 | ->setContextualClass(Format::SUCCESS) |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | */ |
| 622 | 622 | public function execute() |
| 623 | 623 | { |
| 624 | - if($this->optionFilename) { |
|
| 624 | + if ($this->optionFilename) { |
|
| 625 | 625 | $this->run($this->optionFilename); |
| 626 | 626 | } |
| 627 | 627 | } |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if (strpos($this->optionPath, 'Commanders') === false) { |
| 58 | - $filePath = $this->optionPath . 'Commanders' . DIRECTORY_SEPARATOR . $this->optionFilename; |
|
| 58 | + $filePath = $this->optionPath.'Commanders'.DIRECTORY_SEPARATOR.$this->optionFilename; |
|
| 59 | 59 | } else { |
| 60 | - $filePath = $this->optionPath . $this->optionFilename; |
|
| 60 | + $filePath = $this->optionPath.$this->optionFilename; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR; |
|
| 63 | + $fileDirectory = dirname($filePath).DIRECTORY_SEPARATOR; |
|
| 64 | 64 | |
| 65 | - if ( ! is_dir($fileDirectory)) { |
|
| 65 | + if (!is_dir($fileDirectory)) { |
|
| 66 | 66 | mkdir($fileDirectory, 0777, true); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $classNamespace = loader()->getDirNamespace( |
| 84 | 84 | $namespaceDirectory |
| 85 | - ) . 'Commanders' . (empty($subNamespace) |
|
| 85 | + ).'Commanders'.(empty($subNamespace) |
|
| 86 | 86 | ? null |
| 87 | 87 | : str_replace( |
| 88 | 88 | '/', |
| 89 | 89 | '\\', |
| 90 | 90 | $subNamespace |
| 91 | - )) . '\\'; |
|
| 91 | + )).'\\'; |
|
| 92 | 92 | |
| 93 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
| 94 | - $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\'); |
|
| 95 | - $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\'); |
|
| 96 | - $vars[ 'CLASS' ] = $className; |
|
| 97 | - $vars[ 'FILEPATH' ] = $filePath; |
|
| 93 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
| 94 | + $vars['NAMESPACE'] = trim($classNamespace, '\\'); |
|
| 95 | + $vars['PACKAGE'] = '\\'.trim($classNamespace, '\\'); |
|
| 96 | + $vars['CLASS'] = $className; |
|
| 97 | + $vars['FILEPATH'] = $filePath; |
|
| 98 | 98 | |
| 99 | 99 | $phpTemplate = <<<PHPTEMPLATE |
| 100 | 100 | <?php |
@@ -102,23 +102,23 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $className = studlycase($this->optionFilename); |
| 104 | 104 | |
| 105 | - if(empty($this->optionFileVersion)) { |
|
| 106 | - $filename = date('YmdHis') . '_' . underscore($this->optionFilename); |
|
| 105 | + if (empty($this->optionFileVersion)) { |
|
| 106 | + $filename = date('YmdHis').'_'.underscore($this->optionFilename); |
|
| 107 | 107 | } else { |
| 108 | - $filename = $this->optionFileVersion . '_' . underscore($this->optionFilename); |
|
| 108 | + $filename = $this->optionFileVersion.'_'.underscore($this->optionFilename); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $filePath = PATH_DATABASE . 'migrations' . DIRECTORY_SEPARATOR; |
|
| 111 | + $filePath = PATH_DATABASE.'migrations'.DIRECTORY_SEPARATOR; |
|
| 112 | 112 | |
| 113 | - if( ! empty($this->optionPath) ) { |
|
| 114 | - $filePath = $filePath . $this->optionPath; |
|
| 113 | + if (!empty($this->optionPath)) { |
|
| 114 | + $filePath = $filePath.$this->optionPath; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $filePath = $filePath . $filename; |
|
| 117 | + $filePath = $filePath.$filename; |
|
| 118 | 118 | |
| 119 | - $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR; |
|
| 119 | + $fileDirectory = dirname($filePath).DIRECTORY_SEPARATOR; |
|
| 120 | 120 | |
| 121 | - if ( ! is_dir($fileDirectory)) { |
|
| 121 | + if (!is_dir($fileDirectory)) { |
|
| 122 | 122 | mkdir($fileDirectory, 0777, true); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -133,15 +133,15 @@ discard block |
||
| 133 | 133 | exit(EXIT_ERROR); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
| 137 | - $vars[ 'BASE_MIGRATION' ] = 'O2System\Reactor\Models\Sql\Migration'; |
|
| 136 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
| 137 | + $vars['BASE_MIGRATION'] = 'O2System\Reactor\Models\Sql\Migration'; |
|
| 138 | 138 | |
| 139 | - if($this->optionNoSql) { |
|
| 140 | - $vars[ 'BASE_MIGRATION' ] = 'O2System\Reactor\Models\NoSql\Migration'; |
|
| 139 | + if ($this->optionNoSql) { |
|
| 140 | + $vars['BASE_MIGRATION'] = 'O2System\Reactor\Models\NoSql\Migration'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $vars[ 'CLASS' ] = $className; |
|
| 144 | - $vars[ 'FILEPATH' ] = $filePath; |
|
| 143 | + $vars['CLASS'] = $className; |
|
| 144 | + $vars['FILEPATH'] = $filePath; |
|
| 145 | 145 | |
| 146 | 146 | $phpTemplate = <<<PHPTEMPLATE |
| 147 | 147 | <?php |
@@ -220,16 +220,16 @@ discard block |
||
| 220 | 220 | $familyRelationships = []; |
| 221 | 221 | |
| 222 | 222 | foreach ([ |
| 223 | - 'PARENT', |
|
| 224 | - 'CHILD', |
|
| 225 | - 'SPOUSE', |
|
| 226 | - 'SIBLING', |
|
| 227 | - 'GRANDPARENTS', |
|
| 228 | - 'GRANDCHILD', |
|
| 229 | - 'PARENTS_SIBLING', |
|
| 230 | - 'SIBLINGS_CHILD', |
|
| 231 | - 'AUNTS_UNCLES_CHILD', |
|
| 232 | - ] as $relationship |
|
| 223 | + 'PARENT', |
|
| 224 | + 'CHILD', |
|
| 225 | + 'SPOUSE', |
|
| 226 | + 'SIBLING', |
|
| 227 | + 'GRANDPARENTS', |
|
| 228 | + 'GRANDCHILD', |
|
| 229 | + 'PARENTS_SIBLING', |
|
| 230 | + 'SIBLINGS_CHILD', |
|
| 231 | + 'AUNTS_UNCLES_CHILD', |
|
| 232 | + ] as $relationship |
|
| 233 | 233 | ) { |
| 234 | 234 | $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
| 235 | 235 | } |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | $statuses = []; |
| 246 | 246 | |
| 247 | 247 | foreach ([ |
| 248 | - 'PUBLISH', |
|
| 249 | - 'UNPUBLISH', |
|
| 250 | - 'DRAFT', |
|
| 251 | - 'ARCHIVED', |
|
| 252 | - 'TRASH', |
|
| 253 | - ] as $status |
|
| 248 | + 'PUBLISH', |
|
| 249 | + 'UNPUBLISH', |
|
| 250 | + 'DRAFT', |
|
| 251 | + 'ARCHIVED', |
|
| 252 | + 'TRASH', |
|
| 253 | + ] as $status |
|
| 254 | 254 | ) { |
| 255 | 255 | $statuses[ $status ] = $this->language->getLine($status); |
| 256 | 256 | } |
@@ -269,10 +269,10 @@ discard block |
||
| 269 | 269 | $visibilities = []; |
| 270 | 270 | |
| 271 | 271 | foreach ([ |
| 272 | - 'PUBLIC', |
|
| 273 | - 'PRIVATE', |
|
| 274 | - 'MEMBER', |
|
| 275 | - ] as $visibility |
|
| 272 | + 'PUBLIC', |
|
| 273 | + 'PRIVATE', |
|
| 274 | + 'MEMBER', |
|
| 275 | + ] as $visibility |
|
| 276 | 276 | ) { |
| 277 | 277 | $visibilities[ $visibility ] = $this->language->getLine($visibility); |
| 278 | 278 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $religions = []; |
| 41 | 41 | |
| 42 | 42 | foreach (['ATHEIST', 'HINDU', 'BUDDHA', 'MOSLEM', 'CHRISTIAN', 'CATHOLIC', 'UNDEFINED'] as $religion) { |
| 43 | - $religions[ $religion ] = $this->language->getLine($religion); |
|
| 43 | + $religions[$religion] = $this->language->getLine($religion); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return $religions; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $genders = []; |
| 55 | 55 | |
| 56 | 56 | foreach (['MALE', 'FEMALE', 'UNDEFINED'] as $gender) { |
| 57 | - $genders[ $gender ] = $this->language->getLine($gender); |
|
| 57 | + $genders[$gender] = $this->language->getLine($gender); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $genders; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $maritals = []; |
| 69 | 69 | |
| 70 | 70 | foreach (['SINGLE', 'MARRIED', 'DIVORCED', 'UNDEFINED'] as $marital) { |
| 71 | - $maritals[ $marital ] = $this->language->getLine($marital); |
|
| 71 | + $maritals[$marital] = $this->language->getLine($marital); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $maritals; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $bloodTypes = []; |
| 83 | 83 | |
| 84 | 84 | foreach (['A', 'B', 'AB', 'O', 'UNDEFINED'] as $bloodType) { |
| 85 | - $bloodTypes[ $bloodType ] = $this->language->getLine($bloodType); |
|
| 85 | + $bloodTypes[$bloodType] = $this->language->getLine($bloodType); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $bloodTypes; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | $days = []; |
| 105 | 105 | |
| 106 | 106 | for ($i = $start; $i <= $end; $i++) { |
| 107 | - $time = strtotime($year . 'W' . $week . $i); |
|
| 108 | - $days[ strtoupper(date('D', $time)) ] = $this->language->getLine( |
|
| 109 | - 'CAL_' . strtoupper(date($labelFormat, $time))); |
|
| 107 | + $time = strtotime($year.'W'.$week.$i); |
|
| 108 | + $days[strtoupper(date('D', $time))] = $this->language->getLine( |
|
| 109 | + 'CAL_'.strtoupper(date($labelFormat, $time))); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return $days; |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | foreach (range($start, $end) as $date) { |
| 126 | 126 | if ($leading) { |
| 127 | - $date = strlen($date) == 1 ? '0' . $date : $date; |
|
| 127 | + $date = strlen($date) == 1 ? '0'.$date : $date; |
|
| 128 | 128 | } |
| 129 | - $dates[ $date ] = $date; |
|
| 129 | + $dates[$date] = $date; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | return $dates; |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | foreach (range($start, $end) as $month) { |
| 148 | 148 | if ($leading) { |
| 149 | - $month = strlen($month) == 1 ? '0' . $month : $month; |
|
| 149 | + $month = strlen($month) == 1 ? '0'.$month : $month; |
|
| 150 | 150 | } |
| 151 | - $months[ $month ] = $this->language->getLine(strtoupper('CAL_' . date('F', |
|
| 152 | - strtotime('1-' . $month . '-2000')))); |
|
| 151 | + $months[$month] = $this->language->getLine(strtoupper('CAL_'.date('F', |
|
| 152 | + strtotime('1-'.$month.'-2000')))); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $months; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $years = []; |
| 167 | 167 | |
| 168 | 168 | foreach (range($start, $end) as $year) { |
| 169 | - $years[ $year ] = $year; |
|
| 169 | + $years[$year] = $year; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return $years; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $identities = []; |
| 181 | 181 | |
| 182 | 182 | foreach (['UNDEFINED', 'IDENTITY_CARD', 'STUDENT_CARD', 'DRIVER_LICENSE', 'PASSPORT'] as $identity) { |
| 183 | - $identities[ $identity ] = $this->language->getLine($identity); |
|
| 183 | + $identities[$identity] = $this->language->getLine($identity); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return $identities; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | $sizes = []; |
| 195 | 195 | foreach (['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'] as $size) { |
| 196 | - $sizes[ $size ] = $size; |
|
| 196 | + $sizes[$size] = $size; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | return $sizes; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | { |
| 207 | 207 | $boolean = []; |
| 208 | 208 | foreach (['YES', 'NO'] as $bool) { |
| 209 | - $boolean[ $bool ] = $this->language->getLine('BOOL_' . $bool); |
|
| 209 | + $boolean[$bool] = $this->language->getLine('BOOL_'.$bool); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | return $boolean; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | 'AUNTS_UNCLES_CHILD', |
| 232 | 232 | ] as $relationship |
| 233 | 233 | ) { |
| 234 | - $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
|
| 234 | + $familyRelationships[$relationship] = $this->language->getLine($relationship); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return $familyRelationships; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'TRASH', |
| 253 | 253 | ] as $status |
| 254 | 254 | ) { |
| 255 | - $statuses[ $status ] = $this->language->getLine($status); |
|
| 255 | + $statuses[$status] = $this->language->getLine($status); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return $statuses; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | 'MEMBER', |
| 275 | 275 | ] as $visibility |
| 276 | 276 | ) { |
| 277 | - $visibilities[ $visibility ] = $this->language->getLine($visibility); |
|
| 277 | + $visibilities[$visibility] = $this->language->getLine($visibility); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $visibilities; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $languages = []; |
| 293 | 293 | |
| 294 | 294 | foreach ($this->language->getRegistry() as $language) { |
| 295 | - $languages[ $language->getParameter() ] = $language->getProperties()->name; |
|
| 295 | + $languages[$language->getParameter()] = $language->getProperties()->name; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | return $languages; |