@@ -58,8 +58,7 @@ |
||
| 58 | 58 | * class MigrationServiceProvider |
| 59 | 59 | * @package Platine\Framework\Service\Provider |
| 60 | 60 | */ |
| 61 | -class MigrationServiceProvider extends ServiceProvider |
|
| 62 | -{ |
|
| 61 | +class MigrationServiceProvider extends ServiceProvider { |
|
| 63 | 62 | |
| 64 | 63 | /** |
| 65 | 64 | * {@inheritdoc} |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @author tony |
| 17 | 17 | */ |
| 18 | -class LangTag extends AbstractTag |
|
| 19 | -{ |
|
| 18 | +class LangTag extends AbstractTag { |
|
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Value to debug |
@@ -27,8 +26,7 @@ discard block |
||
| 27 | 26 | /** |
| 28 | 27 | * {@inheritdoc} |
| 29 | 28 | */ |
| 30 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 31 | - { |
|
| 29 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 32 | 30 | $lexer = new Lexer('/' . Token::QUOTED_FRAGMENT . '/'); |
| 33 | 31 | if ($lexer->match($markup)) { |
| 34 | 32 | $this->value = $lexer->getStringMatch(0); |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | * class ActionServiceProvider |
| 61 | 61 | * @package Platine\Framework |
| 62 | 62 | */ |
| 63 | -class UserActionServiceProvider extends ServiceProvider |
|
| 64 | -{ |
|
| 63 | +class UserActionServiceProvider extends ServiceProvider { |
|
| 65 | 64 | |
| 66 | 65 | /** |
| 67 | 66 | * {@inheritdoc} |
@@ -11,15 +11,13 @@ |
||
| 11 | 11 | * |
| 12 | 12 | * @author tony |
| 13 | 13 | */ |
| 14 | -class UserRepository extends Repository |
|
| 15 | -{ |
|
| 14 | +class UserRepository extends Repository { |
|
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * Create new instance |
| 19 | 18 | * @param EntityManager $manager |
| 20 | 19 | */ |
| 21 | - public function __construct(EntityManager $manager) |
|
| 22 | - { |
|
| 20 | + public function __construct(EntityManager $manager) { |
|
| 23 | 21 | parent::__construct($manager, User::class); |
| 24 | 22 | } |
| 25 | 23 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | $tableName = $this->config->get('migration.table', 'migrations'); |
| 177 | 177 | $this->schema->create($tableName, function (CreateTable $table) { |
| 178 | 178 | $table->string('version', 20) |
| 179 | - ->description('The migration version') |
|
| 180 | - ->primary(); |
|
| 179 | + ->description('The migration version') |
|
| 180 | + ->primary(); |
|
| 181 | 181 | $table->string('description') |
| 182 | - ->description('The migration description'); |
|
| 182 | + ->description('The migration description'); |
|
| 183 | 183 | $table->datetime('created_at') |
| 184 | 184 | ->description('Migration run time'); |
| 185 | 185 | |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | $this->checkMigrationTable(); |
| 265 | 265 | |
| 266 | 266 | $migrations = $this->repository |
| 267 | - ->query() |
|
| 268 | - ->orderBy('version') |
|
| 269 | - ->all(); |
|
| 267 | + ->query() |
|
| 268 | + ->orderBy('version') |
|
| 269 | + ->all(); |
|
| 270 | 270 | $result = []; |
| 271 | 271 | |
| 272 | 272 | foreach ($migrations as $entity) { |
@@ -174,7 +174,7 @@ |
||
| 174 | 174 | protected function createMigrationTable(): void |
| 175 | 175 | { |
| 176 | 176 | $tableName = $this->config->get('migration.table', 'migrations'); |
| 177 | - $this->schema->create($tableName, function (CreateTable $table) { |
|
| 177 | + $this->schema->create($tableName, function(CreateTable $table) { |
|
| 178 | 178 | $table->string('version', 20) |
| 179 | 179 | ->description('The migration version') |
| 180 | 180 | ->primary(); |
@@ -67,8 +67,7 @@ |
||
| 67 | 67 | * class AbstractCommand |
| 68 | 68 | * @package Platine\Framework\Migration\Command |
| 69 | 69 | */ |
| 70 | -abstract class AbstractCommand extends Command |
|
| 71 | -{ |
|
| 70 | +abstract class AbstractCommand extends Command { |
|
| 72 | 71 | |
| 73 | 72 | /** |
| 74 | 73 | * The migration repository |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ) { |
| 83 | 83 | parent::__construct($app, $repository, $schema, $config, $filesystem); |
| 84 | 84 | $this->setName('migration:create') |
| 85 | - ->setDescription('Create a new migration'); |
|
| 85 | + ->setDescription('Create a new migration'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -159,26 +159,3 @@ discard block |
||
| 159 | 159 | private function getTemplateClass(): string |
| 160 | 160 | { |
| 161 | 161 | return <<<EOF |
| 162 | - <?php |
|
| 163 | - namespace Platine\Framework\Migration; |
|
| 164 | - |
|
| 165 | - use Platine\Framework\Migration\AbstractMigration; |
|
| 166 | - |
|
| 167 | - class %classname% extends AbstractMigration |
|
| 168 | - { |
|
| 169 | - |
|
| 170 | - public function up(): void |
|
| 171 | - { |
|
| 172 | - //Action when migrate up |
|
| 173 | - |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function down(): void |
|
| 177 | - { |
|
| 178 | - //Action when migrate down |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - EOF; |
|
| 183 | - } |
|
| 184 | -} |
|
@@ -159,26 +159,3 @@ |
||
| 159 | 159 | private function getTemplateClass(): string |
| 160 | 160 | { |
| 161 | 161 | return <<<EOF |
| 162 | - <?php |
|
| 163 | - namespace Platine\Framework\Migration; |
|
| 164 | - |
|
| 165 | - use Platine\Framework\Migration\AbstractMigration; |
|
| 166 | - |
|
| 167 | - class %classname% extends AbstractMigration |
|
| 168 | - { |
|
| 169 | - |
|
| 170 | - public function up(): void |
|
| 171 | - { |
|
| 172 | - //Action when migrate up |
|
| 173 | - |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function down(): void |
|
| 177 | - { |
|
| 178 | - //Action when migrate down |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - EOF; |
|
| 183 | - } |
|
| 184 | -} |
|
@@ -159,26 +159,3 @@ |
||
| 159 | 159 | private function getTemplateClass(): string |
| 160 | 160 | { |
| 161 | 161 | return <<<EOF |
| 162 | - <?php |
|
| 163 | - namespace Platine\Framework\Migration; |
|
| 164 | - |
|
| 165 | - use Platine\Framework\Migration\AbstractMigration; |
|
| 166 | - |
|
| 167 | - class %classname% extends AbstractMigration |
|
| 168 | - { |
|
| 169 | - |
|
| 170 | - public function up(): void |
|
| 171 | - { |
|
| 172 | - //Action when migrate up |
|
| 173 | - |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function down(): void |
|
| 177 | - { |
|
| 178 | - //Action when migrate down |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - EOF; |
|
| 183 | - } |
|
| 184 | -} |
|
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * class MigrationCreateCommand |
| 61 | 61 | * @package Platine\Framework\Migration\Command |
| 62 | 62 | */ |
| 63 | -class MigrationCreateCommand extends AbstractCommand |
|
| 64 | -{ |
|
| 63 | +class MigrationCreateCommand extends AbstractCommand { |
|
| 65 | 64 | |
| 66 | 65 | /** |
| 67 | 66 | * The migration name |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | /** |
| 89 | 88 | * {@inheritodc} |
| 90 | 89 | */ |
| 91 | - public function execute() |
|
| 92 | - { |
|
| 90 | + public function execute() { |
|
| 93 | 91 | $writer = $this->io()->writer(); |
| 94 | 92 | |
| 95 | 93 | $version = date('YmdHis'); |
@@ -159,26 +157,3 @@ discard block |
||
| 159 | 157 | private function getTemplateClass(): string |
| 160 | 158 | { |
| 161 | 159 | return <<<EOF |
| 162 | - <?php |
|
| 163 | - namespace Platine\Framework\Migration; |
|
| 164 | - |
|
| 165 | - use Platine\Framework\Migration\AbstractMigration; |
|
| 166 | - |
|
| 167 | - class %classname% extends AbstractMigration |
|
| 168 | - { |
|
| 169 | - |
|
| 170 | - public function up(): void |
|
| 171 | - { |
|
| 172 | - //Action when migrate up |
|
| 173 | - |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function down(): void |
|
| 177 | - { |
|
| 178 | - //Action when migrate down |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - EOF; |
|
| 183 | - } |
|
| 184 | -} |
|
@@ -159,26 +159,3 @@ |
||
| 159 | 159 | private function getTemplateClass(): string |
| 160 | 160 | { |
| 161 | 161 | return <<<EOF |
| 162 | - <?php |
|
| 163 | - namespace Platine\Framework\Migration; |
|
| 164 | - |
|
| 165 | - use Platine\Framework\Migration\AbstractMigration; |
|
| 166 | - |
|
| 167 | - class %classname% extends AbstractMigration |
|
| 168 | - { |
|
| 169 | - |
|
| 170 | - public function up(): void |
|
| 171 | - { |
|
| 172 | - //Action when migrate up |
|
| 173 | - |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function down(): void |
|
| 177 | - { |
|
| 178 | - //Action when migrate down |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - EOF; |
|
| 183 | - } |
|
| 184 | -} |
|
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | ) { |
| 74 | 74 | parent::__construct($app, $repository, $schema, $config, $filesystem); |
| 75 | 75 | $this->setName('migration:migrate') |
| 76 | - ->setDescription('Upgrade to latest migration'); |
|
| 76 | + ->setDescription('Upgrade to latest migration'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * class MigrationMigrateCommand |
| 58 | 58 | * @package Platine\Framework\Migration\Command |
| 59 | 59 | */ |
| 60 | -class MigrationMigrateCommand extends AbstractCommand |
|
| 61 | -{ |
|
| 60 | +class MigrationMigrateCommand extends AbstractCommand { |
|
| 62 | 61 | |
| 63 | 62 | /** |
| 64 | 63 | * Create new instance |
@@ -79,8 +78,7 @@ discard block |
||
| 79 | 78 | /** |
| 80 | 79 | * {@inheritodc} |
| 81 | 80 | */ |
| 82 | - public function execute() |
|
| 83 | - { |
|
| 81 | + public function execute() { |
|
| 84 | 82 | $io = $this->io(); |
| 85 | 83 | $writer = $io->writer(); |
| 86 | 84 | $writer->boldYellow('MIGRATION UPGRADE TO LATEST', true)->eol(); |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | ) { |
| 75 | 75 | parent::__construct($app, $repository, $schema, $config, $filesystem); |
| 76 | 76 | $this->setName('migration:status') |
| 77 | - ->setDescription('Show current status of your migrations'); |
|
| 77 | + ->setDescription('Show current status of your migrations'); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * class MigrationStatusCommand |
| 59 | 59 | * @package Platine\Framework\Migration\Command |
| 60 | 60 | */ |
| 61 | -class MigrationStatusCommand extends AbstractCommand |
|
| 62 | -{ |
|
| 61 | +class MigrationStatusCommand extends AbstractCommand { |
|
| 63 | 62 | |
| 64 | 63 | /** |
| 65 | 64 | * Create new instance |
@@ -80,8 +79,7 @@ discard block |
||
| 80 | 79 | /** |
| 81 | 80 | * {@inheritodc} |
| 82 | 81 | */ |
| 83 | - public function execute() |
|
| 84 | - { |
|
| 82 | + public function execute() { |
|
| 85 | 83 | $writer = $this->io()->writer(); |
| 86 | 84 | $writer->boldYellow('MIGRATION STATUS', true)->eol(); |
| 87 | 85 | $writer->bold('Migration path: '); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ) { |
| 75 | 75 | parent::__construct($app, $repository, $schema, $config, $filesystem); |
| 76 | 76 | $this->setName('migration:exec') |
| 77 | - ->setDescription('Upgrade the migration up/down for the given version'); |
|
| 77 | + ->setDescription('Upgrade the migration up/down for the given version'); |
|
| 78 | 78 | |
| 79 | 79 | $this->addArgument('migration version', 'Version to execute', '', true); |
| 80 | 80 | $this->addArgument('type', 'type of migration [up|down]', 'up', true, true, false, function ($val) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | )); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return $val; |
|
| 88 | + return $val; |
|
| 89 | 89 | }); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | ->setDescription('Upgrade the migration up/down for the given version'); |
| 78 | 78 | |
| 79 | 79 | $this->addArgument('migration version', 'Version to execute', '', true); |
| 80 | - $this->addArgument('type', 'type of migration [up|down]', 'up', true, true, false, function ($val) { |
|
| 80 | + $this->addArgument('type', 'type of migration [up|down]', 'up', true, true, false, function($val) { |
|
| 81 | 81 | if (!in_array($val, ['up', 'down'])) { |
| 82 | 82 | throw new RuntimeException(sprintf( |
| 83 | 83 | 'Invalid argument type [%s], must be one of [up, down]', |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * class MigrationExecuteCommand |
| 59 | 59 | * @package Platine\Framework\Migration\Command |
| 60 | 60 | */ |
| 61 | -class MigrationExecuteCommand extends AbstractCommand |
|
| 62 | -{ |
|
| 61 | +class MigrationExecuteCommand extends AbstractCommand { |
|
| 63 | 62 | |
| 64 | 63 | /** |
| 65 | 64 | * Create new instance |
@@ -92,8 +91,7 @@ discard block |
||
| 92 | 91 | /** |
| 93 | 92 | * {@inheritodc} |
| 94 | 93 | */ |
| 95 | - public function execute() |
|
| 96 | - { |
|
| 94 | + public function execute() { |
|
| 97 | 95 | $version = $this->getArgumentValue('migrationVersion'); |
| 98 | 96 | $type = $this->getArgumentValue('type'); |
| 99 | 97 | |