@@ -3,9 +3,7 @@ |
||
3 | 3 | namespace App\Console\Commands; |
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Command\Command; |
6 | -use Symfony\Component\Console\Input\InputArgument; |
|
7 | 6 | use Symfony\Component\Console\Input\InputInterface; |
8 | -use Symfony\Component\Console\Input\InputOption; |
|
9 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
10 | 8 | |
11 | 9 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $settings = $app->container->get('settings'); |
41 | 41 | |
42 | 42 | |
43 | - $apidocPath = CONFIG_PATH . '/apidoc.php'; |
|
43 | + $apidocPath = CONFIG_PATH.'/apidoc.php'; |
|
44 | 44 | if (false === file_exists($apidocPath)) { |
45 | 45 | throw new \RunTimeException(sprintf('The apidoc file `%s` not found', $apidocPath)); |
46 | 46 | }; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | throw new \RunTimeException(sprintf('The directory `%s` is not writeable', $path)); |
51 | 51 | } |
52 | 52 | |
53 | - $baseName = $path . '/apidoc.json'; |
|
53 | + $baseName = $path.'/apidoc.json'; |
|
54 | 54 | $content = require($apidocPath); |
55 | 55 | |
56 | 56 | $content['url'] = $settings['params']['api']; |
@@ -3,9 +3,7 @@ |
||
3 | 3 | namespace App\Console\Commands; |
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Command\Command; |
6 | -use Symfony\Component\Console\Input\InputArgument; |
|
7 | 6 | use Symfony\Component\Console\Input\InputInterface; |
8 | -use Symfony\Component\Console\Input\InputOption; |
|
9 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
10 | 8 | |
11 | 9 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $helper = $this->getHelper('question'); |
40 | 40 | $question = new Question('<info>Please enter the name of the seed: </info>'); |
41 | - $question->setValidator(function ($answer) { |
|
41 | + $question->setValidator(function($answer) { |
|
42 | 42 | if (strlen(trim($answer)) === 0) { |
43 | 43 | throw new \RunTimeException('The name of the seed should be not empty'); |
44 | 44 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function generateCode($placeHolders, $replacements, $templateName, $resultPath) |
75 | 75 | { |
76 | - $templatePath = CODE_TEMPLATE_PATH . '/' . $templateName; |
|
76 | + $templatePath = CODE_TEMPLATE_PATH.'/'.$templateName; |
|
77 | 77 | if (false === file_exists($templatePath)) { |
78 | 78 | throw new \RunTimeException(sprintf('Not found template %s', $templatePath)); |
79 | 79 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | throw new \Exception(sprintf('Seed directory "%s" does not exist.', $dir)); |
98 | 98 | } |
99 | 99 | |
100 | - $baseName = date('YmdHis') . '_' . $seedName . '.php'; |
|
100 | + $baseName = date('YmdHis').'_'.$seedName.'.php'; |
|
101 | 101 | |
102 | - return $dir . '/' . $baseName; |
|
102 | + return $dir.'/'.$baseName; |
|
103 | 103 | } |
104 | 104 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $helper = $this->getHelper('question'); |
41 | 41 | $question = new Question('<info>Please enter the name of the migration: </info>'); |
42 | - $question->setValidator(function ($answer) { |
|
42 | + $question->setValidator(function($answer) { |
|
43 | 43 | if (strlen(trim($answer)) === 0) { |
44 | 44 | throw new \RunTimeException('The name of the migration should be not empty'); |
45 | 45 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | '<class>', |
54 | 54 | '<tableName>', |
55 | 55 | ]; |
56 | - $replacements = [ |
|
56 | + $replacements = [ |
|
57 | 57 | Helper::underscoreToCamelCase($migrationName, true), |
58 | 58 | strtolower($migrationName), |
59 | 59 | ]; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function generateCode($placeHolders, $replacements, $templateName, $resultPath) |
78 | 78 | { |
79 | - $templatePath = CODE_TEMPLATE_PATH . '/' . $templateName; |
|
79 | + $templatePath = CODE_TEMPLATE_PATH.'/'.$templateName; |
|
80 | 80 | if (false === file_exists($templatePath)) { |
81 | 81 | throw new \RunTimeException(sprintf('Not found template %s', $templatePath)); |
82 | 82 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | throw new \Exception(sprintf('Migration directory "%s" does not exist.', $dir)); |
101 | 101 | } |
102 | 102 | |
103 | - $baseName = date('YmdHis') . '_' . $migrationName . '.php'; |
|
103 | + $baseName = date('YmdHis').'_'.$migrationName.'.php'; |
|
104 | 104 | |
105 | - return $dir . '/' . $baseName; |
|
105 | + return $dir.'/'.$baseName; |
|
106 | 106 | } |
107 | 107 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $helper = $this->getHelper('question'); |
41 | 41 | $question = new Question('<info>Please enter the name of the command class: </info>', 'DefaultCommand'); |
42 | - $question->setValidator(function ($answer) { |
|
42 | + $question->setValidator(function($answer) { |
|
43 | 43 | if ('Command' !== substr($answer, -7)) { |
44 | 44 | throw new \RunTimeException('The name of the command should be suffixed with \'Command\''); |
45 | 45 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function generateCode($placeHolders, $replacements, $templateName, $resultPath) |
83 | 83 | { |
84 | - $templatePath = CODE_TEMPLATE_PATH . '/' . $templateName; |
|
84 | + $templatePath = CODE_TEMPLATE_PATH.'/'.$templateName; |
|
85 | 85 | if (false === file_exists($templatePath)) { |
86 | 86 | throw new \RunTimeException(sprintf('Not found template %s', $templatePath)); |
87 | 87 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | throw new \Exception(sprintf('Commands directory "%s" does not exist.', $dir)); |
106 | 106 | } |
107 | 107 | |
108 | - return $dir . '/'.$commandClass.'.php'; |
|
108 | + return $dir.'/'.$commandClass.'.php'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | { |
119 | 119 | $word = str_replace('Command', '', $word); |
120 | 120 | |
121 | - return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/',':', |
|
122 | - preg_replace('/([a-zd])([A-Z])/','\1:\2', |
|
123 | - preg_replace('/([A-Z]+)([A-Z][a-z])/','\1:\2',$word)))); |
|
121 | + return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', ':', |
|
122 | + preg_replace('/([a-zd])([A-Z])/', '\1:\2', |
|
123 | + preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1:\2', $word)))); |
|
124 | 124 | } |
125 | 125 | } |
@@ -117,8 +117,7 @@ |
||
117 | 117 | |
118 | 118 | try { |
119 | 119 | if (!Capsule::schema()->hasTable($tableName)) { |
120 | - Capsule::schema()->create($tableName, function($table) |
|
121 | - { |
|
120 | + Capsule::schema()->create($tableName, function($table) { |
|
122 | 121 | $table->string('version'); |
123 | 122 | $table->timestamp('apply_time')->useCurrent(); |
124 | 123 |
@@ -80,6 +80,6 @@ |
||
80 | 80 | return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion()); |
81 | 81 | } |
82 | 82 | |
83 | - return '<info>' . $this->logo . '</info>'; |
|
83 | + return '<info>'.$this->logo.'</info>'; |
|
84 | 84 | } |
85 | 85 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // PATH aliases |
4 | -define('ROOT_PATH', __DIR__ ); |
|
5 | -define('MIGRATIONS_PATH', __DIR__ . '/app/database/migrations'); |
|
6 | -define('SEEDS_PATH', __DIR__ . '/app/database/seeds'); |
|
7 | -define('MODELS_PATH', __DIR__ . '/app/src/Model'); |
|
8 | -define('SCHEMAS_PATH', __DIR__ . '/app/src/Schema'); |
|
9 | -define('COMMANDS_PATH', __DIR__ . '/app/src/Console/Commands'); |
|
10 | -define('CODE_TEMPLATE_PATH', __DIR__ . '/app/src/Console/CodeTemplates'); |
|
11 | -define('CONFIG_PATH', __DIR__ . '/config'); |
|
12 | -define('APP_PATH', __DIR__ . '/app'); |
|
4 | +define('ROOT_PATH', __DIR__); |
|
5 | +define('MIGRATIONS_PATH', __DIR__.'/app/database/migrations'); |
|
6 | +define('SEEDS_PATH', __DIR__.'/app/database/seeds'); |
|
7 | +define('MODELS_PATH', __DIR__.'/app/src/Model'); |
|
8 | +define('SCHEMAS_PATH', __DIR__.'/app/src/Schema'); |
|
9 | +define('COMMANDS_PATH', __DIR__.'/app/src/Console/Commands'); |
|
10 | +define('CODE_TEMPLATE_PATH', __DIR__.'/app/src/Console/CodeTemplates'); |
|
11 | +define('CONFIG_PATH', __DIR__.'/config'); |
|
12 | +define('APP_PATH', __DIR__.'/app'); |
|
13 | 13 |