@@ -65,7 +65,7 @@ |
||
| 65 | 65 | */ |
| 66 | 66 | public function register(): void |
| 67 | 67 | { |
| 68 | - $this->app->share(DbConfig::class, function (ContainerInterface $app) { |
|
| 68 | + $this->app->share(DbConfig::class, function(ContainerInterface $app) { |
|
| 69 | 69 | $env = $app->get(Config::class)->get('app.env', ''); |
| 70 | 70 | return new DbConfig($app->get(QueryBuilder::class), $env); |
| 71 | 71 | }); |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | * class DatabaseConfigServiceProvider |
| 58 | 58 | * @package Platine\Framework\Service\Provider |
| 59 | 59 | */ |
| 60 | -class DatabaseConfigServiceProvider extends ServiceProvider |
|
| 61 | -{ |
|
| 60 | +class DatabaseConfigServiceProvider extends ServiceProvider { |
|
| 62 | 61 | |
| 63 | 62 | /** |
| 64 | 63 | * {@inheritdoc} |
@@ -15,8 +15,7 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @author tony |
| 17 | 17 | */ |
| 18 | -class ListAction implements RequestHandlerInterface |
|
| 19 | -{ |
|
| 18 | +class ListAction implements RequestHandlerInterface { |
|
| 20 | 19 | protected UserRepository $userRepository; |
| 21 | 20 | protected Template $template; |
| 22 | 21 | protected DbConfig $dbConfig; |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @author tony |
| 23 | 23 | */ |
| 24 | -class RouteCommand extends Command |
|
| 25 | -{ |
|
| 24 | +class RouteCommand extends Command { |
|
| 26 | 25 | protected Config $config; |
| 27 | 26 | protected Router $router; |
| 28 | 27 | protected Application $application; |
@@ -30,8 +29,7 @@ discard block |
||
| 30 | 29 | /** |
| 31 | 30 | * |
| 32 | 31 | */ |
| 33 | - public function __construct(Application $application, Config $config, Router $router) |
|
| 34 | - { |
|
| 32 | + public function __construct(Application $application, Config $config, Router $router) { |
|
| 35 | 33 | parent::__construct('route', 'Command to manage route'); |
| 36 | 34 | |
| 37 | 35 | $this->addOption('-l|--list', 'Show route list', null, false); |
@@ -41,8 +39,7 @@ discard block |
||
| 41 | 39 | $this->application = $application; |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - public function execute() |
|
| 45 | - { |
|
| 42 | + public function execute() { |
|
| 46 | 43 | if ($this->getOptionValue('list')) { |
| 47 | 44 | $this->showRouteList(); |
| 48 | 45 | } |
@@ -15,15 +15,13 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @author tony |
| 17 | 17 | */ |
| 18 | -class RedirectResponse extends Response |
|
| 19 | -{ |
|
| 18 | +class RedirectResponse extends Response { |
|
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Create new instance |
| 23 | 22 | * @param string $url |
| 24 | 23 | */ |
| 25 | - public function __construct(string $url = '/') |
|
| 26 | - { |
|
| 24 | + public function __construct(string $url = '/') { |
|
| 27 | 25 | parent::__construct(302); |
| 28 | 26 | $this->headers['Location'] = [$url]; |
| 29 | 27 | } |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | * class UserServiceProvider |
| 62 | 62 | * @package Platine\Framework |
| 63 | 63 | */ |
| 64 | -class UserServiceProvider extends ServiceProvider |
|
| 65 | -{ |
|
| 64 | +class UserServiceProvider extends ServiceProvider { |
|
| 66 | 65 | |
| 67 | 66 | /** |
| 68 | 67 | * {@inheritdoc} |
@@ -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 |
@@ -91,8 +90,7 @@ discard block |
||
| 91 | 90 | /** |
| 92 | 91 | * {@inheritodc} |
| 93 | 92 | */ |
| 94 | - public function execute() |
|
| 95 | - { |
|
| 93 | + public function execute() { |
|
| 96 | 94 | $type = $this->getArgumentValue('type'); |
| 97 | 95 | |
| 98 | 96 | $io = $this->io(); |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * class DbConfig |
| 55 | 55 | * @package Platine\Framework\Config |
| 56 | 56 | */ |
| 57 | -class DbConfig extends Config |
|
| 58 | -{ |
|
| 57 | +class DbConfig extends Config { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * The Query Builder instance |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * @param QueryBuilder $queryBuilder |
| 69 | 68 | * @param string $env |
| 70 | 69 | */ |
| 71 | - public function __construct(QueryBuilder $queryBuilder, string $env = '') |
|
| 72 | - { |
|
| 70 | + public function __construct(QueryBuilder $queryBuilder, string $env = '') { |
|
| 73 | 71 | $this->queryBuilder = $queryBuilder; |
| 74 | 72 | parent::__construct(new DatabaseConfigLoader($queryBuilder, 'config'), $env); |
| 75 | 73 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | $environments = $this->parse($environment); |
| 93 | 93 | foreach ($environments as $env) { |
| 94 | 94 | $results = $this->queryBuilder |
| 95 | - ->from($this->table) |
|
| 96 | - ->where('env')->is($env) |
|
| 97 | - ->where('module')->is($group) |
|
| 98 | - ->where('status')->is(1) |
|
| 99 | - ->select() |
|
| 100 | - ->fetchObject() |
|
| 101 | - ->all(); |
|
| 95 | + ->from($this->table) |
|
| 96 | + ->where('env')->is($env) |
|
| 97 | + ->where('module')->is($group) |
|
| 98 | + ->where('status')->is(1) |
|
| 99 | + ->select() |
|
| 100 | + ->fetchObject() |
|
| 101 | + ->all(); |
|
| 102 | 102 | |
| 103 | 103 | if ($results) { |
| 104 | 104 | $config = []; |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | foreach ($results as $cfg) { |
| 154 | 154 | if ($cfg->parent) { |
| 155 | 155 | $results = $this->queryBuilder |
| 156 | - ->from($this->table) |
|
| 157 | - ->where('env')->is($cfg->env) |
|
| 158 | - ->where('module')->is($cfg->parent) |
|
| 159 | - ->where('status')->is(1) |
|
| 160 | - ->select() |
|
| 161 | - ->fetchObject() |
|
| 162 | - ->all(); |
|
| 156 | + ->from($this->table) |
|
| 157 | + ->where('env')->is($cfg->env) |
|
| 158 | + ->where('module')->is($cfg->parent) |
|
| 159 | + ->where('status')->is(1) |
|
| 160 | + ->select() |
|
| 161 | + ->fetchObject() |
|
| 162 | + ->all(); |
|
| 163 | 163 | |
| 164 | 164 | foreach ($results as $cfg) { |
| 165 | 165 | $config[$cfg->name] = $cfg->value ?? $cfg->default_value; |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | */ |
| 123 | 123 | protected function parse(string $env): array |
| 124 | 124 | { |
| 125 | - $environments = array_filter((array)preg_split('/(\/|\.)/', $env)); |
|
| 125 | + $environments = array_filter((array) preg_split('/(\/|\.)/', $env)); |
|
| 126 | 126 | array_unshift($environments, ''); |
| 127 | 127 | |
| 128 | 128 | return $environments; |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | * class DatabaseConfigLoader |
| 55 | 55 | * @package Platine\Framework\Config |
| 56 | 56 | */ |
| 57 | -class DatabaseConfigLoader implements LoaderInterface |
|
| 58 | -{ |
|
| 57 | +class DatabaseConfigLoader implements LoaderInterface { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * The QueryBuilder instance |
@@ -9,44 +9,44 @@ |
||
| 9 | 9 | |
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | - //Action when migrate up |
|
| 13 | - $this->create('config', function (CreateTable $table) { |
|
| 14 | - $table->integer('id') |
|
| 15 | - ->autoincrement() |
|
| 16 | - ->primary(); |
|
| 17 | - $table->string('env') |
|
| 18 | - ->description('The config environment') |
|
| 19 | - ->index(); |
|
| 20 | - $table->string('module') |
|
| 21 | - ->description('The module') |
|
| 22 | - ->index(); |
|
| 23 | - $table->string('code') |
|
| 24 | - ->description('The config code') |
|
| 25 | - ->notNull() |
|
| 26 | - ->index(); |
|
| 27 | - $table->string('value') |
|
| 28 | - ->description('The config value'); |
|
| 29 | - $table->string('type') |
|
| 30 | - ->description('The config data type'); |
|
| 31 | - $table->text('comment') |
|
| 32 | - ->description('The config description'); |
|
| 33 | - $table->integer('status') |
|
| 34 | - ->description('The config status') |
|
| 35 | - ->defaultValue(0) |
|
| 36 | - ->notNull(); |
|
| 37 | - $table->datetime('created_at') |
|
| 38 | - ->description('role created at') |
|
| 39 | - ->notNull(); |
|
| 40 | - $table->datetime('updated_at') |
|
| 41 | - ->description('role updated at'); |
|
| 12 | + //Action when migrate up |
|
| 13 | + $this->create('config', function (CreateTable $table) { |
|
| 14 | + $table->integer('id') |
|
| 15 | + ->autoincrement() |
|
| 16 | + ->primary(); |
|
| 17 | + $table->string('env') |
|
| 18 | + ->description('The config environment') |
|
| 19 | + ->index(); |
|
| 20 | + $table->string('module') |
|
| 21 | + ->description('The module') |
|
| 22 | + ->index(); |
|
| 23 | + $table->string('code') |
|
| 24 | + ->description('The config code') |
|
| 25 | + ->notNull() |
|
| 26 | + ->index(); |
|
| 27 | + $table->string('value') |
|
| 28 | + ->description('The config value'); |
|
| 29 | + $table->string('type') |
|
| 30 | + ->description('The config data type'); |
|
| 31 | + $table->text('comment') |
|
| 32 | + ->description('The config description'); |
|
| 33 | + $table->integer('status') |
|
| 34 | + ->description('The config status') |
|
| 35 | + ->defaultValue(0) |
|
| 36 | + ->notNull(); |
|
| 37 | + $table->datetime('created_at') |
|
| 38 | + ->description('role created at') |
|
| 39 | + ->notNull(); |
|
| 40 | + $table->datetime('updated_at') |
|
| 41 | + ->description('role updated at'); |
|
| 42 | 42 | |
| 43 | - $table->engine('INNODB'); |
|
| 44 | - }); |
|
| 43 | + $table->engine('INNODB'); |
|
| 44 | + }); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function down(): void |
| 48 | 48 | { |
| 49 | - //Action when migrate down |
|
| 50 | - $this->drop('config'); |
|
| 49 | + //Action when migrate down |
|
| 50 | + $this->drop('config'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | 12 | //Action when migrate up |
| 13 | - $this->create('config', function (CreateTable $table) { |
|
| 13 | + $this->create('config', function(CreateTable $table) { |
|
| 14 | 14 | $table->integer('id') |
| 15 | 15 | ->autoincrement() |
| 16 | 16 | ->primary(); |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | use Platine\Database\Schema\CreateTable; |
| 5 | 5 | use Platine\Framework\Migration\AbstractMigration; |
| 6 | 6 | |
| 7 | -class AddConfigTable20210708043103 extends AbstractMigration |
|
| 8 | -{ |
|
| 7 | +class AddConfigTable20210708043103 extends AbstractMigration { |
|
| 9 | 8 | |
| 10 | 9 | public function up(): void |
| 11 | 10 | { |