@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Epesi extends Facade |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Get the registered name of the component. |
|
| 12 | - * |
|
| 13 | - * @return string |
|
| 14 | - */ |
|
| 15 | - protected static function getFacadeAccessor() |
|
| 16 | - { |
|
| 17 | - return App::class; |
|
| 18 | - } |
|
| 10 | + /** |
|
| 11 | + * Get the registered name of the component. |
|
| 12 | + * |
|
| 13 | + * @return string |
|
| 14 | + */ |
|
| 15 | + protected static function getFacadeAccessor() |
|
| 16 | + { |
|
| 17 | + return App::class; |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -2,35 +2,35 @@ |
||
| 2 | 2 | |
| 3 | 3 | if (! function_exists('epesi')) { |
| 4 | 4 | function epesi() : Epesi\Core\App |
| 5 | - { |
|
| 6 | - return resolve(Epesi\Core\App::class); |
|
| 7 | - } |
|
| 5 | + { |
|
| 6 | + return resolve(Epesi\Core\App::class); |
|
| 7 | + } |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | if (! function_exists('eval_css')) { |
| 11 | 11 | function eval_css($css) |
| 12 | - { |
|
| 13 | - epesi()->addStyle($css); |
|
| 14 | - } |
|
| 12 | + { |
|
| 13 | + epesi()->addStyle($css); |
|
| 14 | + } |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (! function_exists('eval_js')) { |
| 18 | 18 | function eval_js($js, $args = []) |
| 19 | - { |
|
| 20 | - epesi()->addJS($js, $args); |
|
| 21 | - } |
|
| 19 | + { |
|
| 20 | + epesi()->addJS($js, $args); |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (! function_exists('load_css')) { |
| 25 | 25 | function load_css($url) |
| 26 | - { |
|
| 27 | - return epesi()->requireCSS($url); |
|
| 28 | - } |
|
| 26 | + { |
|
| 27 | + return epesi()->requireCSS($url); |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (! function_exists('load_js')) { |
| 32 | 32 | function load_js($url) |
| 33 | - { |
|
| 34 | - return epesi()->requireJS($url); |
|
| 35 | - } |
|
| 33 | + { |
|
| 34 | + return epesi()->requireJS($url); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -1,34 +1,34 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('epesi')) { |
|
| 3 | +if (!function_exists('epesi')) { |
|
| 4 | 4 | function epesi() : Epesi\Core\App |
| 5 | 5 | { |
| 6 | 6 | return resolve(Epesi\Core\App::class); |
| 7 | 7 | } |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if (! function_exists('eval_css')) { |
|
| 10 | +if (!function_exists('eval_css')) { |
|
| 11 | 11 | function eval_css($css) |
| 12 | 12 | { |
| 13 | 13 | epesi()->addStyle($css); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if (! function_exists('eval_js')) { |
|
| 17 | +if (!function_exists('eval_js')) { |
|
| 18 | 18 | function eval_js($js, $args = []) |
| 19 | 19 | { |
| 20 | 20 | epesi()->addJS($js, $args); |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if (! function_exists('load_css')) { |
|
| 24 | +if (!function_exists('load_css')) { |
|
| 25 | 25 | function load_css($url) |
| 26 | 26 | { |
| 27 | 27 | return epesi()->requireCSS($url); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -if (! function_exists('load_js')) { |
|
| 31 | +if (!function_exists('load_js')) { |
|
| 32 | 32 | function load_js($url) |
| 33 | 33 | { |
| 34 | 34 | return epesi()->requireJS($url); |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class DatabaseConnectionCommand extends Command |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * The name and signature of the console command. |
|
| 11 | - * |
|
| 12 | - * @var string |
|
| 13 | - */ |
|
| 14 | - protected $signature = 'epesi:database-connection {--connection= : DB connection settings}'; |
|
| 9 | + /** |
|
| 10 | + * The name and signature of the console command. |
|
| 11 | + * |
|
| 12 | + * @var string |
|
| 13 | + */ |
|
| 14 | + protected $signature = 'epesi:database-connection {--connection= : DB connection settings}'; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * The console command description. |
|
| 18 | - * |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 21 | - protected $description = 'Update database connection for epesi application'; |
|
| 16 | + /** |
|
| 17 | + * The console command description. |
|
| 18 | + * |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | + protected $description = 'Update database connection for epesi application'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Execute the console command. |
|
| 25 | - */ |
|
| 26 | - public function handle() |
|
| 27 | - { |
|
| 28 | - $connection = $this->option('connection'); |
|
| 23 | + /** |
|
| 24 | + * Execute the console command. |
|
| 25 | + */ |
|
| 26 | + public function handle() |
|
| 27 | + { |
|
| 28 | + $connection = $this->option('connection'); |
|
| 29 | 29 | |
| 30 | 30 | $map = [ |
| 31 | 31 | 'driver' => 'DB_CONNECTION', |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $this->call('epesi:env', [ |
|
| 52 | - 'name' => $env |
|
| 53 | - ]); |
|
| 51 | + $this->call('epesi:env', [ |
|
| 52 | + 'name' => $env |
|
| 53 | + ]); |
|
| 54 | 54 | |
| 55 | - $this->comment('DB connection settings updated!'); |
|
| 56 | - } |
|
| 55 | + $this->comment('DB connection settings updated!'); |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -38,7 +38,9 @@ |
||
| 38 | 38 | |
| 39 | 39 | $env = []; |
| 40 | 40 | foreach ($map as $key => $name) { |
| 41 | - if (!isset($connection[$key])) continue; |
|
| 41 | + if (!isset($connection[$key])) { |
|
| 42 | + continue; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | $env[$name] = $connection[$key]; |
| 44 | 46 | } |
@@ -7,33 +7,33 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ModuleInstallCommand extends Command |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * The name and signature of the console command. |
|
| 12 | - * |
|
| 13 | - * @var string |
|
| 14 | - */ |
|
| 15 | - protected $signature = 'epesi:module-install {module : The class name or alias of the module.}'; |
|
| 10 | + /** |
|
| 11 | + * The name and signature of the console command. |
|
| 12 | + * |
|
| 13 | + * @var string |
|
| 14 | + */ |
|
| 15 | + protected $signature = 'epesi:module-install {module : The class name or alias of the module.}'; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The console command description. |
|
| 19 | - * |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - protected $description = 'Install the epesi module'; |
|
| 17 | + /** |
|
| 18 | + * The console command description. |
|
| 19 | + * |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + protected $description = 'Install the epesi module'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Execute the console command. |
|
| 26 | - */ |
|
| 27 | - public function handle() |
|
| 28 | - { |
|
| 29 | - try { |
|
| 30 | - ob_start(); |
|
| 31 | - ModuleManager::install($this->argument('module')); |
|
| 24 | + /** |
|
| 25 | + * Execute the console command. |
|
| 26 | + */ |
|
| 27 | + public function handle() |
|
| 28 | + { |
|
| 29 | + try { |
|
| 30 | + ob_start(); |
|
| 31 | + ModuleManager::install($this->argument('module')); |
|
| 32 | 32 | |
| 33 | - $this->alert(ob_get_clean()); |
|
| 34 | - } catch (\Exception $e) { |
|
| 35 | - $this->error($e->getMessage()); |
|
| 36 | - } |
|
| 37 | - } |
|
| 33 | + $this->alert(ob_get_clean()); |
|
| 34 | + } catch (\Exception $e) { |
|
| 35 | + $this->error($e->getMessage()); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | } |
@@ -8,58 +8,58 @@ |
||
| 8 | 8 | |
| 9 | 9 | class DatabaseCreateCommand extends Command |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * The name and signature of the console command. |
|
| 13 | - * |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - protected $signature = 'epesi:database-create {name : The name of the database.} |
|
| 11 | + /** |
|
| 12 | + * The name and signature of the console command. |
|
| 13 | + * |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + protected $signature = 'epesi:database-create {name : The name of the database.} |
|
| 17 | 17 | {--connection=mysql DB connection settings}'; |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The console command description. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - protected $description = 'Create database for the epesi application'; |
|
| 19 | + /** |
|
| 20 | + * The console command description. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + protected $description = 'Create database for the epesi application'; |
|
| 25 | 25 | |
| 26 | - protected $connection; |
|
| 26 | + protected $connection; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Execute the console command. |
|
| 30 | - */ |
|
| 31 | - public function handle() |
|
| 32 | - { |
|
| 33 | - DB::connection($this->connection())->statement('CREATE DATABASE `' . $this->argument('name') . '`'); |
|
| 34 | - } |
|
| 28 | + /** |
|
| 29 | + * Execute the console command. |
|
| 30 | + */ |
|
| 31 | + public function handle() |
|
| 32 | + { |
|
| 33 | + DB::connection($this->connection())->statement('CREATE DATABASE `' . $this->argument('name') . '`'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Creates the configuration for the connection and returns the key |
|
| 38 | - * |
|
| 39 | - * @return void |
|
| 40 | - */ |
|
| 41 | - protected function connection() |
|
| 42 | - { |
|
| 43 | - $connection = $this->option('connection'); |
|
| 36 | + /** |
|
| 37 | + * Creates the configuration for the connection and returns the key |
|
| 38 | + * |
|
| 39 | + * @return void |
|
| 40 | + */ |
|
| 41 | + protected function connection() |
|
| 42 | + { |
|
| 43 | + $connection = $this->option('connection'); |
|
| 44 | 44 | |
| 45 | - // Just get access to the config. |
|
| 46 | - $config = App::make('config'); |
|
| 45 | + // Just get access to the config. |
|
| 46 | + $config = App::make('config'); |
|
| 47 | 47 | |
| 48 | - // Will contain the array of connections that appear in our database config file. |
|
| 49 | - $connections = $config->get('database.connections'); |
|
| 48 | + // Will contain the array of connections that appear in our database config file. |
|
| 49 | + $connections = $config->get('database.connections'); |
|
| 50 | 50 | |
| 51 | - $driver = is_string($connection)? $connection: $connection['driver']; |
|
| 51 | + $driver = is_string($connection)? $connection: $connection['driver']; |
|
| 52 | 52 | |
| 53 | - $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
|
| 53 | + $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
|
| 54 | 54 | |
| 55 | - $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
| 55 | + $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
| 56 | 56 | |
| 57 | - // Do not select database |
|
| 58 | - $newConnection['database'] = ''; |
|
| 57 | + // Do not select database |
|
| 58 | + $newConnection['database'] = ''; |
|
| 59 | 59 | |
| 60 | - // This will add our new connection to the run-time configuration for the duration of the request. |
|
| 61 | - $config->set('database.connections.create-db', $newConnection); |
|
| 60 | + // This will add our new connection to the run-time configuration for the duration of the request. |
|
| 61 | + $config->set('database.connections.create-db', $newConnection); |
|
| 62 | 62 | |
| 63 | - return 'create-db'; |
|
| 64 | - } |
|
| 63 | + return 'create-db'; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -48,11 +48,11 @@ |
||
| 48 | 48 | // Will contain the array of connections that appear in our database config file. |
| 49 | 49 | $connections = $config->get('database.connections'); |
| 50 | 50 | |
| 51 | - $driver = is_string($connection)? $connection: $connection['driver']; |
|
| 51 | + $driver = is_string($connection) ? $connection : $connection['driver']; |
|
| 52 | 52 | |
| 53 | 53 | $defaultConnection = $connections[$driver]?? $connections[$config->get('database.default')]; |
| 54 | 54 | |
| 55 | - $newConnection = array_merge($defaultConnection, is_string($connection)? []: $connection); |
|
| 55 | + $newConnection = array_merge($defaultConnection, is_string($connection) ? [] : $connection); |
|
| 56 | 56 | |
| 57 | 57 | // Do not select database |
| 58 | 58 | $newConnection['database'] = ''; |
@@ -8,24 +8,24 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class EpesiCommand extends Command |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * The name and signature of the console command. |
|
| 13 | - * |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - protected $signature = 'epesi'; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * The console command description. |
|
| 20 | - * |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - protected $description = 'List all epesi commands'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var string |
|
| 27 | - */ |
|
| 28 | - public static $logo = <<<LOGO |
|
| 11 | + /** |
|
| 12 | + * The name and signature of the console command. |
|
| 13 | + * |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + protected $signature = 'epesi'; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * The console command description. |
|
| 20 | + * |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + protected $description = 'List all epesi commands'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var string |
|
| 27 | + */ |
|
| 28 | + public static $logo = <<<LOGO |
|
| 29 | 29 | ____ ____ ____ ____ __ |
| 30 | 30 | ( __)( _ \( __)/ ___)( ) |
| 31 | 31 | ) _) ) __/ ) _) \___ \ )( |
@@ -33,74 +33,74 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | LOGO; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Execute the console command. |
|
| 38 | - */ |
|
| 39 | - public function handle() |
|
| 40 | - { |
|
| 41 | - $this->line(static::$logo); |
|
| 42 | - |
|
| 43 | - $this->comment(''); |
|
| 44 | - $this->comment('Available commands:'); |
|
| 45 | - |
|
| 46 | - $this->listEpesiCommands(); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * List all epesi commands. |
|
| 51 | - * |
|
| 52 | - * @return void |
|
| 53 | - */ |
|
| 54 | - protected function listEpesiCommands() |
|
| 55 | - { |
|
| 56 | - $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
| 57 | - if (Str::startsWith($key, 'epesi:')) { |
|
| 58 | - return [$key => $command]; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return []; |
|
| 62 | - })->toArray(); |
|
| 63 | - |
|
| 64 | - $width = $this->getColumnWidth($commands); |
|
| 65 | - |
|
| 66 | - /** @var Command $command */ |
|
| 67 | - foreach ($commands as $command) { |
|
| 68 | - $this->line(sprintf(" %-{$width}s %s", $command->getName(), $command->getDescription())); |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @param (Command|string)[] $commands |
|
| 74 | - * |
|
| 75 | - * @return int |
|
| 76 | - */ |
|
| 77 | - private function getColumnWidth(array $commands) |
|
| 78 | - { |
|
| 79 | - $widths = []; |
|
| 80 | - |
|
| 81 | - foreach ($commands as $command) { |
|
| 82 | - $widths[] = static::strlen($command->getName()); |
|
| 83 | - foreach ($command->getAliases() as $alias) { |
|
| 84 | - $widths[] = static::strlen($alias); |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - return $widths ? max($widths) + 2 : 0; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns the length of a string, using mb_strwidth if it is available. |
|
| 93 | - * |
|
| 94 | - * @param string $string The string to check its length |
|
| 95 | - * |
|
| 96 | - * @return int The length of the string |
|
| 97 | - */ |
|
| 98 | - public static function strlen($string) |
|
| 99 | - { |
|
| 100 | - if (false === $encoding = mb_detect_encoding($string, null, true)) { |
|
| 101 | - return strlen($string); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - return mb_strwidth($string, $encoding); |
|
| 105 | - } |
|
| 36 | + /** |
|
| 37 | + * Execute the console command. |
|
| 38 | + */ |
|
| 39 | + public function handle() |
|
| 40 | + { |
|
| 41 | + $this->line(static::$logo); |
|
| 42 | + |
|
| 43 | + $this->comment(''); |
|
| 44 | + $this->comment('Available commands:'); |
|
| 45 | + |
|
| 46 | + $this->listEpesiCommands(); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * List all epesi commands. |
|
| 51 | + * |
|
| 52 | + * @return void |
|
| 53 | + */ |
|
| 54 | + protected function listEpesiCommands() |
|
| 55 | + { |
|
| 56 | + $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
| 57 | + if (Str::startsWith($key, 'epesi:')) { |
|
| 58 | + return [$key => $command]; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return []; |
|
| 62 | + })->toArray(); |
|
| 63 | + |
|
| 64 | + $width = $this->getColumnWidth($commands); |
|
| 65 | + |
|
| 66 | + /** @var Command $command */ |
|
| 67 | + foreach ($commands as $command) { |
|
| 68 | + $this->line(sprintf(" %-{$width}s %s", $command->getName(), $command->getDescription())); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @param (Command|string)[] $commands |
|
| 74 | + * |
|
| 75 | + * @return int |
|
| 76 | + */ |
|
| 77 | + private function getColumnWidth(array $commands) |
|
| 78 | + { |
|
| 79 | + $widths = []; |
|
| 80 | + |
|
| 81 | + foreach ($commands as $command) { |
|
| 82 | + $widths[] = static::strlen($command->getName()); |
|
| 83 | + foreach ($command->getAliases() as $alias) { |
|
| 84 | + $widths[] = static::strlen($alias); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + return $widths ? max($widths) + 2 : 0; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns the length of a string, using mb_strwidth if it is available. |
|
| 93 | + * |
|
| 94 | + * @param string $string The string to check its length |
|
| 95 | + * |
|
| 96 | + * @return int The length of the string |
|
| 97 | + */ |
|
| 98 | + public static function strlen($string) |
|
| 99 | + { |
|
| 100 | + if (false === $encoding = mb_detect_encoding($string, null, true)) { |
|
| 101 | + return strlen($string); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + return mb_strwidth($string, $encoding); |
|
| 105 | + } |
|
| 106 | 106 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | protected function listEpesiCommands() |
| 55 | 55 | { |
| 56 | - $commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) { |
|
| 56 | + $commands = collect(Artisan::all())->mapWithKeys(function($command, $key) { |
|
| 57 | 57 | if (Str::startsWith($key, 'epesi:')) { |
| 58 | 58 | return [$key => $command]; |
| 59 | 59 | } |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function addGroupResults($group, $testResults = [], $container = null) |
| 69 | 69 | { |
| 70 | - if (! $testResults) return; |
|
| 70 | + if (!$testResults) return; |
|
| 71 | 71 | |
| 72 | - $container = $container?: $this; |
|
| 72 | + $container = $container ?: $this; |
|
| 73 | 73 | |
| 74 | 74 | $container->add(['Header', $group]); |
| 75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $row = $container->add(['View', 'class' => ['row']]); |
| 82 | 82 | $row->add(['View', $test['name'], 'class' => ['nine wide column']]); |
| 83 | - $row->add(['View', 'class' => ['six wide right aligned column']])->add(['Label', $test['result'], 'class' => ["$color horizontal"]]);; |
|
| 83 | + $row->add(['View', 'class' => ['six wide right aligned column']])->add(['Label', $test['result'], 'class' => ["$color horizontal"]]); ; |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | @Schema::dropIfExists('test'); |
| 92 | 92 | |
| 93 | - @Schema::create('test', function (Blueprint $table) { |
|
| 93 | + @Schema::create('test', function(Blueprint $table) { |
|
| 94 | 94 | $table->increments('id'); |
| 95 | 95 | }); |
| 96 | 96 | |
| 97 | 97 | $create = Schema::hasTable('test'); |
| 98 | 98 | |
| 99 | - @Schema::table('test', function (Blueprint $table) { |
|
| 99 | + @Schema::table('test', function(Blueprint $table) { |
|
| 100 | 100 | $table->addColumn('TEXT', 'field_name'); |
| 101 | 101 | }); |
| 102 | 102 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $delete = @DB::delete('DELETE FROM test'); |
| 108 | 108 | @Schema::dropIfExists('test'); |
| 109 | 109 | |
| 110 | - $drop = ! Schema::hasTable('test'); |
|
| 110 | + $drop = !Schema::hasTable('test'); |
|
| 111 | 111 | |
| 112 | 112 | ob_end_clean(); |
| 113 | 113 | |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | array_walk($result, function(& $testResult, $testName) { |
| 117 | 117 | $testResult = [ |
| 118 | 118 | 'name' => __(':permission permission', ['permission' => strtoupper($testName)]), |
| 119 | - 'result' => $testResult? __('OK'): __('Failed'), |
|
| 120 | - 'severity' => $testResult? 0: 2 |
|
| 119 | + 'result' => $testResult ? __('OK') : __('Failed'), |
|
| 120 | + 'severity' => $testResult ? 0 : 2 |
|
| 121 | 121 | ]; |
| 122 | 122 | }); |
| 123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | protected function unitToInt($string) |
| 128 | 128 | { |
| 129 | - return (int) preg_replace_callback('/(\-?\d+)(.?)/', function ($m) { |
|
| 129 | + return (int) preg_replace_callback('/(\-?\d+)(.?)/', function($m) { |
|
| 130 | 130 | return $m[1] * pow(1024, strpos('BKMG', $m[2])); |
| 131 | 131 | }, strtoupper($string)); |
| 132 | 132 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $ret[] = [ |
| 142 | 142 | 'name' => __('PHP version required :version', ['version' => $requiredPhpVersion]), |
| 143 | 143 | 'result' => PHP_VERSION, |
| 144 | - 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=')? 0: 2 |
|
| 144 | + 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=') ? 0 : 2 |
|
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | $result = $callback($extension); |
| 178 | 178 | |
| 179 | 179 | $ret[] = array_merge($test, [ |
| 180 | - 'result' => $result? __('OK'): __('Missing'), |
|
| 181 | - 'severity' => $result? 0: $test['severity'] |
|
| 180 | + 'result' => $result ? __('OK') : __('Missing'), |
|
| 181 | + 'severity' => $result ? 0 : $test['severity'] |
|
| 182 | 182 | ]); |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -67,7 +67,9 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function addGroupResults($group, $testResults = [], $container = null) |
| 69 | 69 | { |
| 70 | - if (! $testResults) return; |
|
| 70 | + if (! $testResults) { |
|
| 71 | + return; |
|
| 72 | + } |
|
| 71 | 73 | |
| 72 | 74 | $container = $container?: $this; |
| 73 | 75 | |
@@ -153,8 +155,7 @@ discard block |
||
| 153 | 155 | $severity = 0; |
| 154 | 156 | if ($actualSizeBytes < $requiredSizeBytes) { |
| 155 | 157 | $severity = 2; |
| 156 | - } |
|
| 157 | - elseif ($actualSizeBytes == $requiredSizeBytes) { |
|
| 158 | + } elseif ($actualSizeBytes == $requiredSizeBytes) { |
|
| 158 | 159 | $severity = 1; |
| 159 | 160 | } |
| 160 | 161 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | $joint = new $class(); |
| 26 | 26 | |
| 27 | - if (! $joint->access()) continue; |
|
| 27 | + if (!$joint->access()) continue; |
|
| 28 | 28 | |
| 29 | 29 | $ret->add($joint); |
| 30 | 30 | } |
@@ -29,7 +29,9 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | $joint = new $class(); |
| 31 | 31 | |
| 32 | - if (! $joint->access()) continue; |
|
| 32 | + if (! $joint->access()) { |
|
| 33 | + continue; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | $ret->add($joint); |
| 35 | 37 | } |
@@ -7,166 +7,166 @@ |
||
| 7 | 7 | |
| 8 | 8 | class PackageManifest |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * The filesystem instance. |
|
| 12 | - * |
|
| 13 | - * @var \Illuminate\Filesystem\Filesystem |
|
| 14 | - */ |
|
| 15 | - public $files; |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * The base path. |
|
| 19 | - * |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - public $basePath; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * The vendor path. |
|
| 26 | - * |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - public $vendorPath; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * The manifest path. |
|
| 33 | - * |
|
| 34 | - * @var string|null |
|
| 35 | - */ |
|
| 36 | - public $manifestPath; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * The loaded manifest array. |
|
| 40 | - * |
|
| 41 | - * @var array |
|
| 42 | - */ |
|
| 43 | - public $manifest; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Create a new package manifest instance. |
|
| 47 | - * |
|
| 48 | - * @param \Illuminate\Filesystem\Filesystem $files |
|
| 49 | - * @param string $basePath |
|
| 50 | - * @param string $manifestPath |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
| 54 | - { |
|
| 55 | - $this->files = $files; |
|
| 56 | - $this->basePath = $basePath; |
|
| 57 | - $this->manifestPath = $manifestPath; |
|
| 58 | - $this->vendorPath = $basePath.'/vendor'; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get all of the integrator class names for all packages. |
|
| 63 | - * |
|
| 64 | - * @return array |
|
| 65 | - */ |
|
| 66 | - public function joints() |
|
| 67 | - { |
|
| 68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 69 | - return (array) ($configuration['joints'] ?? []); |
|
| 70 | - })->filter()->all(); |
|
| 71 | - } |
|
| 10 | + /** |
|
| 11 | + * The filesystem instance. |
|
| 12 | + * |
|
| 13 | + * @var \Illuminate\Filesystem\Filesystem |
|
| 14 | + */ |
|
| 15 | + public $files; |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * The base path. |
|
| 19 | + * |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + public $basePath; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * The vendor path. |
|
| 26 | + * |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + public $vendorPath; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * The manifest path. |
|
| 33 | + * |
|
| 34 | + * @var string|null |
|
| 35 | + */ |
|
| 36 | + public $manifestPath; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * The loaded manifest array. |
|
| 40 | + * |
|
| 41 | + * @var array |
|
| 42 | + */ |
|
| 43 | + public $manifest; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Create a new package manifest instance. |
|
| 47 | + * |
|
| 48 | + * @param \Illuminate\Filesystem\Filesystem $files |
|
| 49 | + * @param string $basePath |
|
| 50 | + * @param string $manifestPath |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
| 54 | + { |
|
| 55 | + $this->files = $files; |
|
| 56 | + $this->basePath = $basePath; |
|
| 57 | + $this->manifestPath = $manifestPath; |
|
| 58 | + $this->vendorPath = $basePath.'/vendor'; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get all of the integrator class names for all packages. |
|
| 63 | + * |
|
| 64 | + * @return array |
|
| 65 | + */ |
|
| 66 | + public function joints() |
|
| 67 | + { |
|
| 68 | + return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 69 | + return (array) ($configuration['joints'] ?? []); |
|
| 70 | + })->filter()->all(); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Get all of the module declared for all packages. |
|
| 75 | - * |
|
| 76 | - * @return array |
|
| 77 | - */ |
|
| 78 | - public function modules() |
|
| 79 | - { |
|
| 80 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 81 | - return (array) ($configuration['modules'] ?? []); |
|
| 82 | - })->filter()->all(); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Get the current package manifest. |
|
| 87 | - * |
|
| 88 | - * @return array |
|
| 89 | - */ |
|
| 90 | - protected function getManifest() |
|
| 91 | - { |
|
| 92 | - if (isset($this->manifest)) { |
|
| 93 | - return $this->manifest; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (! file_exists($this->manifestPath)) { |
|
| 97 | - $this->build(); |
|
| 98 | - } |
|
| 73 | + /** |
|
| 74 | + * Get all of the module declared for all packages. |
|
| 75 | + * |
|
| 76 | + * @return array |
|
| 77 | + */ |
|
| 78 | + public function modules() |
|
| 79 | + { |
|
| 80 | + return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 81 | + return (array) ($configuration['modules'] ?? []); |
|
| 82 | + })->filter()->all(); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Get the current package manifest. |
|
| 87 | + * |
|
| 88 | + * @return array |
|
| 89 | + */ |
|
| 90 | + protected function getManifest() |
|
| 91 | + { |
|
| 92 | + if (isset($this->manifest)) { |
|
| 93 | + return $this->manifest; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if (! file_exists($this->manifestPath)) { |
|
| 97 | + $this->build(); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - return $this->manifest = file_exists($this->manifestPath) ? |
|
| 101 | - $this->files->getRequire($this->manifestPath) : []; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Build the manifest and write it to disk. |
|
| 106 | - * |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function build() |
|
| 110 | - { |
|
| 111 | - $packages = []; |
|
| 112 | - |
|
| 113 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
| 114 | - $packages = json_decode($this->files->get($path), true); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
| 118 | - |
|
| 119 | - $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
| 120 | - return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
| 121 | - })->each(function ($configuration) use (&$ignore) { |
|
| 122 | - $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
| 123 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
| 124 | - return $ignoreAll || in_array($package, $ignore); |
|
| 125 | - })->filter()->all()); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Format the given package name. |
|
| 130 | - * |
|
| 131 | - * @param string $package |
|
| 132 | - * @return string |
|
| 133 | - */ |
|
| 134 | - protected function format($package) |
|
| 135 | - { |
|
| 136 | - return str_replace($this->vendorPath.'/', '', $package); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Get all of the package names that should be ignored. |
|
| 141 | - * |
|
| 142 | - * @return array |
|
| 143 | - */ |
|
| 144 | - protected function packagesToIgnore() |
|
| 145 | - { |
|
| 146 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
| 147 | - return []; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - return json_decode(file_get_contents( |
|
| 151 | - $this->basePath.'/composer.json' |
|
| 152 | - ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Write the given manifest array to disk. |
|
| 157 | - * |
|
| 158 | - * @param array $manifest |
|
| 159 | - * @return void |
|
| 160 | - * @throws \Exception |
|
| 161 | - */ |
|
| 162 | - protected function write(array $manifest) |
|
| 163 | - { |
|
| 164 | - if (! is_writable(dirname($this->manifestPath))) { |
|
| 165 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - $this->files->put( |
|
| 169 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
| 170 | - ); |
|
| 171 | - } |
|
| 100 | + return $this->manifest = file_exists($this->manifestPath) ? |
|
| 101 | + $this->files->getRequire($this->manifestPath) : []; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Build the manifest and write it to disk. |
|
| 106 | + * |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function build() |
|
| 110 | + { |
|
| 111 | + $packages = []; |
|
| 112 | + |
|
| 113 | + if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
| 114 | + $packages = json_decode($this->files->get($path), true); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
| 118 | + |
|
| 119 | + $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
| 120 | + return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
| 121 | + })->each(function ($configuration) use (&$ignore) { |
|
| 122 | + $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
| 123 | + })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
| 124 | + return $ignoreAll || in_array($package, $ignore); |
|
| 125 | + })->filter()->all()); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Format the given package name. |
|
| 130 | + * |
|
| 131 | + * @param string $package |
|
| 132 | + * @return string |
|
| 133 | + */ |
|
| 134 | + protected function format($package) |
|
| 135 | + { |
|
| 136 | + return str_replace($this->vendorPath.'/', '', $package); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Get all of the package names that should be ignored. |
|
| 141 | + * |
|
| 142 | + * @return array |
|
| 143 | + */ |
|
| 144 | + protected function packagesToIgnore() |
|
| 145 | + { |
|
| 146 | + if (! file_exists($this->basePath.'/composer.json')) { |
|
| 147 | + return []; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + return json_decode(file_get_contents( |
|
| 151 | + $this->basePath.'/composer.json' |
|
| 152 | + ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Write the given manifest array to disk. |
|
| 157 | + * |
|
| 158 | + * @param array $manifest |
|
| 159 | + * @return void |
|
| 160 | + * @throws \Exception |
|
| 161 | + */ |
|
| 162 | + protected function write(array $manifest) |
|
| 163 | + { |
|
| 164 | + if (! is_writable(dirname($this->manifestPath))) { |
|
| 165 | + throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + $this->files->put( |
|
| 169 | + $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->files = $files; |
| 56 | 56 | $this->basePath = $basePath; |
| 57 | 57 | $this->manifestPath = $manifestPath; |
| 58 | - $this->vendorPath = $basePath.'/vendor'; |
|
| 58 | + $this->vendorPath = $basePath . '/vendor'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function joints() |
| 67 | 67 | { |
| 68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 68 | + return collect($this->getManifest())->flatMap(function($configuration) { |
|
| 69 | 69 | return (array) ($configuration['joints'] ?? []); |
| 70 | 70 | })->filter()->all(); |
| 71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function modules() |
| 79 | 79 | { |
| 80 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
| 80 | + return collect($this->getManifest())->flatMap(function($configuration) { |
|
| 81 | 81 | return (array) ($configuration['modules'] ?? []); |
| 82 | 82 | })->filter()->all(); |
| 83 | 83 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $this->manifest; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (! file_exists($this->manifestPath)) { |
|
| 96 | + if (!file_exists($this->manifestPath)) { |
|
| 97 | 97 | $this->build(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -110,17 +110,17 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $packages = []; |
| 112 | 112 | |
| 113 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
| 113 | + if ($this->files->exists($path = $this->vendorPath . '/composer/installed.json')) { |
|
| 114 | 114 | $packages = json_decode($this->files->get($path), true); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
| 118 | 118 | |
| 119 | - $this->write(collect($packages)->mapWithKeys(function ($package) { |
|
| 119 | + $this->write(collect($packages)->mapWithKeys(function($package) { |
|
| 120 | 120 | return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
| 121 | - })->each(function ($configuration) use (&$ignore) { |
|
| 121 | + })->each(function($configuration) use (&$ignore) { |
|
| 122 | 122 | $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
| 123 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
| 123 | + })->reject(function($configuration, $package) use ($ignore, $ignoreAll) { |
|
| 124 | 124 | return $ignoreAll || in_array($package, $ignore); |
| 125 | 125 | })->filter()->all()); |
| 126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected function format($package) |
| 135 | 135 | { |
| 136 | - return str_replace($this->vendorPath.'/', '', $package); |
|
| 136 | + return str_replace($this->vendorPath . '/', '', $package); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function packagesToIgnore() |
| 145 | 145 | { |
| 146 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
| 146 | + if (!file_exists($this->basePath . '/composer.json')) { |
|
| 147 | 147 | return []; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return json_decode(file_get_contents( |
| 151 | - $this->basePath.'/composer.json' |
|
| 151 | + $this->basePath . '/composer.json' |
|
| 152 | 152 | ), true)['extra']['epesi']['dont-discover'] ?? []; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function write(array $manifest) |
| 163 | 163 | { |
| 164 | - if (! is_writable(dirname($this->manifestPath))) { |
|
| 165 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
| 164 | + if (!is_writable(dirname($this->manifestPath))) { |
|
| 165 | + throw new Exception('The ' . dirname($this->manifestPath) . ' directory must be present and writable.'); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $this->files->put( |
| 169 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
| 169 | + $this->manifestPath, '<?php return ' . var_export($manifest, true) . ';' |
|
| 170 | 170 | ); |
| 171 | 171 | } |
| 172 | 172 | } |