@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static function isInstalled($classOrAlias) |
| 21 | 21 | { |
| 22 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
| 22 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function isAvalable($classOrAlias) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return string; |
| 35 | 35 | */ |
| 36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
| 37 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
| 37 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
| 38 | 38 | |
| 39 | 39 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
| 40 | 40 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public static function getAll() |
| 81 | 81 | { |
| 82 | - return self::getCached('epesi-modules-available', function () { |
|
| 82 | + return self::getCached('epesi-modules-available', function() { |
|
| 83 | 83 | $modules = collect(); |
| 84 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $moduleClass) { |
|
| 84 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $moduleClass) { |
|
| 85 | 85 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | protected static function getCached($key, \Closure $default) |
| 100 | 100 | { |
| 101 | - if (! Cache::has($key)) { |
|
| 101 | + if (!Cache::has($key)) { |
|
| 102 | 102 | Cache::forever($key, $default()); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public static function collect($method, $args = []) |
| 125 | 125 | { |
| 126 | - $args = is_array($args)? $args: [$args]; |
|
| 126 | + $args = is_array($args) ? $args : [$args]; |
|
| 127 | 127 | |
| 128 | 128 | $ret = []; |
| 129 | 129 | foreach (self::getInstalled() as $module) { |
| 130 | - if (! $list = $module::$method(...$args)) continue; |
|
| 130 | + if (!$list = $module::$method(...$args)) continue; |
|
| 131 | 131 | |
| 132 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
| 132 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return $ret; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return true; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
| 151 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
| 152 | 152 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | $parentModule = array_shift($unsatisfiedDependencies); |
| 200 | 200 | |
| 201 | 201 | if (self::$processing[$parentModule]?? false) { |
| 202 | - throw new Exception('Cross dependency: '. $parentModule); |
|
| 202 | + throw new Exception('Cross dependency: ' . $parentModule); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if (! self::isAvalable($parentModule)) { |
|
| 205 | + if (!self::isAvalable($parentModule)) { |
|
| 206 | 206 | throw new Exception('Module not found: "' . $parentModule . '"'); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
| 37 | 37 | $modules = $installedOnly? self::getInstalled(): self::getAll(); |
| 38 | 38 | |
| 39 | - if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
|
| 39 | + if (collect($modules)->contains($classOrAlias)) { |
|
| 40 | + return $classOrAlias; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | return $modules[$classOrAlias]?? null; |
| 42 | 44 | } |
@@ -127,7 +129,9 @@ discard block |
||
| 127 | 129 | |
| 128 | 130 | $ret = []; |
| 129 | 131 | foreach (self::getInstalled() as $module) { |
| 130 | - if (! $list = $module::$method(...$args)) continue; |
|
| 132 | + if (! $list = $module::$method(...$args)) { |
|
| 133 | + continue; |
|
| 134 | + } |
|
| 131 | 135 | |
| 132 | 136 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
| 133 | 137 | } |
@@ -6,37 +6,37 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateCoreTables extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - $this->down(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + $this->down(); |
|
| 17 | 17 | |
| 18 | - Schema::create('variables', function (Blueprint $table) { |
|
| 19 | - $table->string('name', 128)->primary(); |
|
| 20 | - $table->text('value'); |
|
| 21 | - }); |
|
| 18 | + Schema::create('variables', function (Blueprint $table) { |
|
| 19 | + $table->string('name', 128)->primary(); |
|
| 20 | + $table->text('value'); |
|
| 21 | + }); |
|
| 22 | 22 | |
| 23 | - Schema::create('modules', function (Blueprint $table) { |
|
| 24 | - $table->string('class', 512); |
|
| 25 | - $table->string('alias', 128)->unique(); |
|
| 26 | - $table->smallInteger('priority')->default(0); |
|
| 27 | - $table->smallInteger('state')->default(1); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 23 | + Schema::create('modules', function (Blueprint $table) { |
|
| 24 | + $table->string('class', 512); |
|
| 25 | + $table->string('alias', 128)->unique(); |
|
| 26 | + $table->smallInteger('priority')->default(0); |
|
| 27 | + $table->smallInteger('state')->default(1); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::dropIfExists('variables'); |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::dropIfExists('variables'); |
|
| 39 | 39 | |
| 40 | - Schema::dropIfExists('modules'); |
|
| 41 | - } |
|
| 40 | + Schema::dropIfExists('modules'); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $this->down(); |
| 17 | 17 | |
| 18 | - Schema::create('variables', function (Blueprint $table) { |
|
| 18 | + Schema::create('variables', function(Blueprint $table) { |
|
| 19 | 19 | $table->string('name', 128)->primary(); |
| 20 | 20 | $table->text('value'); |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | - Schema::create('modules', function (Blueprint $table) { |
|
| 23 | + Schema::create('modules', function(Blueprint $table) { |
|
| 24 | 24 | $table->string('class', 512); |
| 25 | 25 | $table->string('alias', 128)->unique(); |
| 26 | 26 | $table->smallInteger('priority')->default(0); |