| @@ -12,73 +12,73 @@ | ||
| 12 | 12 | |
| 13 | 13 | class EpesiServiceProvider extends ServiceProvider | 
| 14 | 14 |  { | 
| 15 | - /** | |
| 16 | - * Booting the package. | |
| 17 | - */ | |
| 18 | - public function boot() | |
| 19 | -    { | |
| 20 | - $this->ensureHttps(); | |
| 15 | + /** | |
| 16 | + * Booting the package. | |
| 17 | + */ | |
| 18 | + public function boot() | |
| 19 | +	{ | |
| 20 | + $this->ensureHttps(); | |
| 21 | 21 | |
| 22 | -    	if (env('APP_DEBUG', false)) ModuleManager::clearCache(); | |
| 22 | +		if (env('APP_DEBUG', false)) ModuleManager::clearCache(); | |
| 23 | 23 | |
| 24 | -    	Route::group(['namespace' => 'Epesi\Core', 'middleware' => 'web'], function() { | |
| 25 | -    		Route::any('/', 'Controller@index'); | |
| 26 | -    		Route::get('logo', 'Controller@logo'); | |
| 27 | -    		Route::any('install', 'Controller@install'); | |
| 24 | +		Route::group(['namespace' => 'Epesi\Core', 'middleware' => 'web'], function() { | |
| 25 | +			Route::any('/', 'Controller@index'); | |
| 26 | +			Route::get('logo', 'Controller@logo'); | |
| 27 | +			Route::any('install', 'Controller@install'); | |
| 28 | 28 | |
| 29 | -    		Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { | |
| 30 | -    			Route::any('home', 'Controller@home')->name('home'); | |
| 29 | +			Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { | |
| 30 | +				Route::any('home', 'Controller@home')->name('home'); | |
| 31 | 31 | |
| 32 | -    			Route::any('view/{alias}/{method?}/{args?}', 'Controller@view'); | |
| 33 | - }); | |
| 34 | - }); | |
| 32 | +				Route::any('view/{alias}/{method?}/{args?}', 'Controller@view'); | |
| 33 | + }); | |
| 34 | + }); | |
| 35 | 35 | |
| 36 | - // call boot methods on all modules | |
| 37 | -    	ModuleManager::call('boot'); | |
| 36 | + // call boot methods on all modules | |
| 37 | +		ModuleManager::call('boot'); | |
| 38 | 38 | |
| 39 | 39 |  		foreach (ModuleManager::collect('translations') as $path) { | 
| 40 | 40 | $this->loadJsonTranslationsFrom($path); | 
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | - // Register admin service provider if in admin mode or in console | |
| 44 | - // TODO: apply access restriction to admin mode | |
| 43 | + // Register admin service provider if in admin mode or in console | |
| 44 | + // TODO: apply access restriction to admin mode | |
| 45 | 45 |  //     	if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { | 
| 46 | -    	if ($this->app->runningInConsole() || request('admin', false)) { | |
| 47 | - $this->app->register(AdminServiceProvider::class); | |
| 48 | - } | |
| 49 | - } | |
| 46 | +		if ($this->app->runningInConsole() || request('admin', false)) { | |
| 47 | + $this->app->register(AdminServiceProvider::class); | |
| 48 | + } | |
| 49 | + } | |
| 50 | 50 | |
| 51 | - /** | |
| 52 | - * Register the provider. | |
| 53 | - */ | |
| 54 | - public function register() | |
| 55 | -    { | |
| 56 | - $this->app->singleton(UI::class); | |
| 51 | + /** | |
| 52 | + * Register the provider. | |
| 53 | + */ | |
| 54 | + public function register() | |
| 55 | +	{ | |
| 56 | + $this->app->singleton(UI::class); | |
| 57 | 57 | |
| 58 | - $this->app->singleton( | |
| 59 | - SQL::class, | |
| 60 | -    			function ($app) { | |
| 61 | - /** | |
| 62 | - * Database Manager | |
| 63 | - * | |
| 64 | - * @var \Illuminate\Database\DatabaseManager $db | |
| 65 | - */ | |
| 66 | - $db = DB::getFacadeRoot(); | |
| 58 | + $this->app->singleton( | |
| 59 | + SQL::class, | |
| 60 | +				function ($app) { | |
| 61 | + /** | |
| 62 | + * Database Manager | |
| 63 | + * | |
| 64 | + * @var \Illuminate\Database\DatabaseManager $db | |
| 65 | + */ | |
| 66 | + $db = DB::getFacadeRoot(); | |
| 67 | 67 | |
| 68 | - return new SQL($db); | |
| 69 | - }); | |
| 70 | - } | |
| 68 | + return new SQL($db); | |
| 69 | + }); | |
| 70 | + } | |
| 71 | 71 | |
| 72 | - /** | |
| 73 | - * Force to set https scheme if https enabled. | |
| 74 | - * | |
| 75 | - * @return void | |
| 76 | - */ | |
| 77 | - protected function ensureHttps() | |
| 78 | -    { | |
| 79 | -    	if (config('epesi.https') || config('epesi.secure')) { | |
| 80 | -    		url()->forceScheme('https'); | |
| 81 | -    		$this->app['request']->server->set('HTTPS', true); | |
| 82 | - } | |
| 83 | - } | |
| 72 | + /** | |
| 73 | + * Force to set https scheme if https enabled. | |
| 74 | + * | |
| 75 | + * @return void | |
| 76 | + */ | |
| 77 | + protected function ensureHttps() | |
| 78 | +	{ | |
| 79 | +		if (config('epesi.https') || config('epesi.secure')) { | |
| 80 | +			url()->forceScheme('https'); | |
| 81 | +			$this->app['request']->server->set('HTTPS', true); | |
| 82 | + } | |
| 83 | + } | |
| 84 | 84 | } | 
| @@ -25,10 +25,10 @@ discard block | ||
| 25 | 25 |  	{ | 
| 26 | 26 | parent::__construct([ | 
| 27 | 27 |  				'title' => config('epesi.ui.title', 'EPESI'), | 
| 28 | -		        'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), | |
| 28 | +				'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), | |
| 29 | 29 | //TODO: set the skin from admin / user selection | 
| 30 | -		        'skin' => config('epesi.ui.skin', $this->skin), | |
| 31 | -		        'template_dir' => array_merge(ModuleManager::collect('templates', [$this->skin]), (array) $this->template_dir), | |
| 30 | +				'skin' => config('epesi.ui.skin', $this->skin), | |
| 31 | +				'template_dir' => array_merge(ModuleManager::collect('templates', [$this->skin]), (array) $this->template_dir), | |
| 32 | 32 |  // 		        'catch_error_types' => config('app.debug') ?  | 
| 33 | 33 | // // debug mode | 
| 34 | 34 | // E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : | 
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | |
| 40 | 40 | final public static function module() | 
| 41 | 41 |  	{ | 
| 42 | - return System\SystemCore::class; | |
| 42 | + return System\SystemCore::class; | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | public function response() | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | |
| 59 | 59 | public function render() | 
| 60 | 60 |  	{			 | 
| 61 | -	    System\SystemCore::requireCSS('epesi.css'); | |
| 61 | +		System\SystemCore::requireCSS('epesi.css'); | |
| 62 | 62 | |
| 63 | 63 | $this->addCsrfToken(); | 
| 64 | 64 | |
| @@ -81,18 +81,18 @@ discard block | ||
| 81 | 81 | */ | 
| 82 | 82 | public function renderException($exception) | 
| 83 | 83 |  	{ | 
| 84 | - ob_start(); | |
| 85 | -	    if ($exception instanceof TokenMismatchException) { | |
| 86 | -	        $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); | |
| 87 | - } | |
| 88 | -	    elseif ($exception instanceof NotFoundHttpException) { | |
| 89 | -	        $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); | |
| 90 | - } | |
| 91 | -	    else { | |
| 92 | - $this->caughtException($exception); | |
| 93 | - } | |
| 84 | + ob_start(); | |
| 85 | +		if ($exception instanceof TokenMismatchException) { | |
| 86 | +			$this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); | |
| 87 | + } | |
| 88 | +		elseif ($exception instanceof NotFoundHttpException) { | |
| 89 | +			$this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); | |
| 90 | + } | |
| 91 | +		else { | |
| 92 | + $this->caughtException($exception); | |
| 93 | + } | |
| 94 | 94 | |
| 95 | - return ob_get_clean(); | |
| 95 | + return ob_get_clean(); | |
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | /** | 
| @@ -102,20 +102,20 @@ discard block | ||
| 102 | 102 | */ | 
| 103 | 103 | public function jsRedirectHomepage($message) | 
| 104 | 104 |  	{ | 
| 105 | - $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); | |
| 105 | + $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); | |
| 106 | 106 | |
| 107 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); | |
| 107 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); | |
| 108 | 108 | |
| 109 | -	    if ($this->isJsonRequest()) { | |
| 110 | - $this->outputResponseJSON([ | |
| 111 | - 'success' => true, | |
| 112 | - 'message' => $message, | |
| 113 | - 'atkjs' => $redirectJs | |
| 114 | - ]); | |
| 115 | - } | |
| 116 | -	    else { | |
| 117 | -	        $this->outputResponseHTML($this->getTag('script', $redirectJs)); | |
| 118 | - } | |
| 109 | +		if ($this->isJsonRequest()) { | |
| 110 | + $this->outputResponseJSON([ | |
| 111 | + 'success' => true, | |
| 112 | + 'message' => $message, | |
| 113 | + 'atkjs' => $redirectJs | |
| 114 | + ]); | |
| 115 | + } | |
| 116 | +		else { | |
| 117 | +			$this->outputResponseHTML($this->getTag('script', $redirectJs)); | |
| 118 | + } | |
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | 121 | /** | 
| @@ -127,9 +127,9 @@ discard block | ||
| 127 | 127 | */ | 
| 128 | 128 | public function jsRedirectConfirm($page, $message) | 
| 129 | 129 |  	{ | 
| 130 | - $redirectJs = $this->jsRedirect($page)->jsRender(); | |
| 130 | + $redirectJs = $this->jsRedirect($page)->jsRender(); | |
| 131 | 131 | |
| 132 | -	    return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); | |
| 132 | +		return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); | |
| 133 | 133 | } | 
| 134 | 134 | |
| 135 | 135 | /** | 
| @@ -2,35 +2,35 @@ | ||
| 2 | 2 | |
| 3 | 3 |  if (! function_exists('ui')) { | 
| 4 | 4 | function ui() : Epesi\Core\UI | 
| 5 | -    { | |
| 6 | - return resolve(Epesi\Core\UI::class); | |
| 7 | - } | |
| 5 | +	{ | |
| 6 | + return resolve(Epesi\Core\UI::class); | |
| 7 | + } | |
| 8 | 8 | } | 
| 9 | 9 | |
| 10 | 10 |  if (! function_exists('eval_css')) { | 
| 11 | 11 | function eval_css($css) | 
| 12 | -    { | |
| 13 | - ui()->addStyle($css); | |
| 14 | - } | |
| 12 | +	{ | |
| 13 | + ui()->addStyle($css); | |
| 14 | + } | |
| 15 | 15 | } | 
| 16 | 16 | |
| 17 | 17 |  if (! function_exists('eval_js')) { | 
| 18 | 18 | function eval_js($js, $args = []) | 
| 19 | -    { | |
| 20 | - ui()->addJs($js, $args); | |
| 21 | - } | |
| 19 | +	{ | |
| 20 | + ui()->addJs($js, $args); | |
| 21 | + } | |
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 |  if (! function_exists('load_css')) { | 
| 25 | 25 | function load_css($url) | 
| 26 | -    { | |
| 27 | - return ui()->requireCss($url); | |
| 28 | - } | |
| 26 | +	{ | |
| 27 | + return ui()->requireCss($url); | |
| 28 | + } | |
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 |  if (! function_exists('load_js')) { | 
| 32 | 32 | function load_js($url) | 
| 33 | -    { | |
| 34 | - return ui()->requireJs($url); | |
| 35 | - } | |
| 33 | +	{ | |
| 34 | + return ui()->requireJs($url); | |
| 35 | + } | |
| 36 | 36 | } | 
| @@ -1,34 +1,34 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -if (! function_exists('ui')) { | |
| 3 | +if (!function_exists('ui')) { | |
| 4 | 4 | function ui() : Epesi\Core\UI | 
| 5 | 5 |      { | 
| 6 | 6 | return resolve(Epesi\Core\UI::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 | ui()->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 | ui()->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 ui()->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 ui()->requireJs($url); | 
| @@ -30,8 +30,8 @@ discard block | ||
| 30 | 30 |  	{ | 
| 31 | 31 | $modules = collect(ModuleManager::getAll()); | 
| 32 | 32 | |
| 33 | -		return $modules->filter(function ($subModuleClass) use ($modules) { | |
| 34 | -			return ! $modules->map(function($moduleClass){ | |
| 33 | +		return $modules->filter(function($subModuleClass) use ($modules) { | |
| 34 | +			return !$modules->map(function($moduleClass) { | |
| 35 | 35 | return $moduleClass::namespace(); | 
| 36 | 36 | })->contains($subModuleClass::parentNamespace()); | 
| 37 | 37 | })->sort(); | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | |
| 66 | 66 |  			$section->add($label, 'title')->setStyle('float', 'right'); | 
| 67 | 67 | |
| 68 | -			$submodules = collect(ModuleManager::getAll())->filter(function ($subModuleClass) use ($moduleClass) { | |
| 68 | +			$submodules = collect(ModuleManager::getAll())->filter(function($subModuleClass) use ($moduleClass) { | |
| 69 | 69 | return $subModuleClass::isSubModuleOf($moduleClass); | 
| 70 | 70 | }); | 
| 71 | 71 | |
| @@ -79,11 +79,11 @@ discard block | ||
| 79 | 79 | |
| 80 | 80 | public function formatModuleInfo($moduleClass) | 
| 81 | 81 |  	{ | 
| 82 | -		$moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); | |
| 82 | +		$moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); | |
| 83 | 83 | |
| 84 | 84 | $ret = []; | 
| 85 | 85 |  		foreach ($moduleInfo as $label => $text) { | 
| 86 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; | |
| 86 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; | |
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | 89 |  		return implode('<br>', $ret); | 
| @@ -123,12 +123,12 @@ discard block | ||
| 123 | 123 | |
| 124 | 124 | $form = Form::addTo($view); | 
| 125 | 125 |  					foreach ($recommended as $childModule) { | 
| 126 | - if (! ModuleManager::isAvailable($childModule)) continue; | |
| 126 | + if (!ModuleManager::isAvailable($childModule)) continue; | |
| 127 | 127 | |
| 128 | 128 | $form->addControl($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); | 
| 129 | 129 | } | 
| 130 | 130 | |
| 131 | -					$form->onSubmit(function ($form) use ($moduleClass) { | |
| 131 | +					$form->onSubmit(function($form) use ($moduleClass) { | |
| 132 | 132 | ob_start(); | 
| 133 | 133 | ModuleManager::install($moduleClass, array_keys($form->getValues(), true)); | 
| 134 | 134 | |
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | 139 |  				\atk4\ui\Button::addTo($view, [__('Install'), 'primary'])->on('click', [ | 
| 140 | - isset($form)? $form->submit(): $installCallback | |
| 140 | + isset($form) ? $form->submit() : $installCallback | |
| 141 | 141 | ]); | 
| 142 | 142 | }); | 
| 143 | 143 | |
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | ]; | 
| 164 | 164 | }); | 
| 165 | 165 | |
| 166 | -		if ($dependents = ModuleManager::listDependents()[$moduleClass]?? []) { | |
| 166 | +		if ($dependents = ModuleManager::listDependents()[$moduleClass] ?? []) { | |
| 167 | 167 |  			$modal = \atk4\ui\Modal::addTo($this, ['title' => __(':module Module Installation', ['module' => $moduleClass::label()])])->set(function($view) use ($moduleClass, $dependents, $uninstallCallback) { | 
| 168 | 168 |  				$message = \atk4\ui\Message::addTo($view, [__('Module is required by following modules')]); | 
| 169 | 169 | |
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 |  	{ | 
| 55 | 55 |  		return self::$installed = self::$installed ?? self::getCached('epesi-modules-installed', function() { | 
| 56 | 56 |  			try { | 
| 57 | -			    $installedModules = Module::pluck('class', 'alias'); | |
| 57 | +				$installedModules = Module::pluck('class', 'alias'); | |
| 58 | 58 |  			} catch (\Exception $e) { | 
| 59 | 59 | $installedModules = collect(); | 
| 60 | 60 | } | 
| @@ -87,32 +87,31 @@ discard block | ||
| 87 | 87 | */ | 
| 88 | 88 | protected static function discoverModuleClasses(string $namespace, string $basePath): array | 
| 89 | 89 |  	{ | 
| 90 | - $ret = collect(); | |
| 90 | + $ret = collect(); | |
| 91 | 91 | |
| 92 | - $moduleNamespace = trim($namespace, '\\'); | |
| 92 | + $moduleNamespace = trim($namespace, '\\'); | |
| 93 | 93 | |
| 94 | -	    $names = array_slice(explode('\\', $moduleNamespace), - 1); | |
| 94 | +		$names = array_slice(explode('\\', $moduleNamespace), - 1); | |
| 95 | 95 | |
| 96 | -	    if ($name = $names? reset($names): '') { | |
| 97 | - $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; | |
| 96 | +		if ($name = $names? reset($names): '') { | |
| 97 | + $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; | |
| 98 | 98 | |
| 99 | -	        if (is_subclass_of($moduleClass, ModuleCore::class)) { | |
| 100 | - $ret->add($moduleClass); | |
| 101 | - } | |
| 102 | - } | |
| 99 | +			if (is_subclass_of($moduleClass, ModuleCore::class)) { | |
| 100 | + $ret->add($moduleClass); | |
| 101 | + } | |
| 102 | + } | |
| 103 | 103 | |
| 104 | -	    foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { | |
| 105 | - $subModuleNamespace = $moduleNamespace . '\\' . basename($path); | |
| 104 | +		foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { | |
| 105 | + $subModuleNamespace = $moduleNamespace . '\\' . basename($path); | |
| 106 | 106 | |
| 107 | - $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); | |
| 108 | - } | |
| 107 | + $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); | |
| 108 | + } | |
| 109 | 109 | |
| 110 | - return $ret->all(); | |
| 110 | + return $ret->all(); | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | 
| 114 | 114 | * Common method to use for caching of data within module manager | 
| 115 | - | |
| 116 | 115 | * @return mixed | 
| 117 | 116 | */ | 
| 118 | 117 | protected static function getCached(string $key, \Closure $default) | 
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 | */ | 
| 39 | 39 | public static function getClass(string $classOrAlias, bool $installedOnly = false): ?string | 
| 40 | 40 |  	{ | 
| 41 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); | |
| 41 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); | |
| 42 | 42 | |
| 43 | 43 |  		if (collect($modules)->contains($classOrAlias)) { | 
| 44 | 44 | return $classOrAlias; | 
| @@ -68,9 +68,9 @@ discard block | ||
| 68 | 68 | */ | 
| 69 | 69 | public static function getAll(): array | 
| 70 | 70 |  	{ | 
| 71 | -		return self::getCached('epesi-modules-available', function () { | |
| 71 | +		return self::getCached('epesi-modules-available', function() { | |
| 72 | 72 | $modules = collect(); | 
| 73 | -			foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $namespace => $path) { | |
| 73 | +			foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $namespace => $path) { | |
| 74 | 74 |  				foreach (self::discoverModuleClasses($namespace, $path) as $moduleClass) { | 
| 75 | 75 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); | 
| 76 | 76 | } | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | |
| 94 | 94 |  	    $names = array_slice(explode('\\', $moduleNamespace), - 1); | 
| 95 | 95 | |
| 96 | -	    if ($name = $names? reset($names): '') { | |
| 96 | +	    if ($name = $names ? reset($names) : '') { | |
| 97 | 97 | $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; | 
| 98 | 98 | |
| 99 | 99 |  	        if (is_subclass_of($moduleClass, ModuleCore::class)) { | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 | } | 
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | -	    foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { | |
| 104 | +	    foreach (glob($basePath . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $path) { | |
| 105 | 105 | $subModuleNamespace = $moduleNamespace . '\\' . basename($path); | 
| 106 | 106 | |
| 107 | 107 | $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | */ | 
| 118 | 118 | protected static function getCached(string $key, \Closure $default) | 
| 119 | 119 |  	{ | 
| 120 | -		if (! Cache::has($key)) { | |
| 120 | +		if (!Cache::has($key)) { | |
| 121 | 121 | Cache::forever($key, $default()); | 
| 122 | 122 | } | 
| 123 | 123 | |
| @@ -152,7 +152,7 @@ discard block | ||
| 152 | 152 | $installedModules = collect(self::getInstalled()); | 
| 153 | 153 | |
| 154 | 154 | // if epesi is not installed fake having the system module to enable its functionality | 
| 155 | -		if (! $installedModules->contains(\Epesi\Core\System\SystemCore::class)) { | |
| 155 | +		if (!$installedModules->contains(\Epesi\Core\System\SystemCore::class)) { | |
| 156 | 156 | $installedModules = collect([ | 
| 157 | 157 | 'system' => \Epesi\Core\System\SystemCore::class | 
| 158 | 158 | ]); | 
| @@ -160,9 +160,9 @@ discard block | ||
| 160 | 160 | |
| 161 | 161 | $ret = []; | 
| 162 | 162 |  		foreach ($installedModules as $module) { | 
| 163 | - if (! $list = $module::$method(...$args)) continue; | |
| 163 | + if (!$list = $module::$method(...$args)) continue; | |
| 164 | 164 | |
| 165 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); | |
| 165 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); | |
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | 168 | return $ret; | 
| @@ -179,7 +179,7 @@ discard block | ||
| 179 | 179 | return true; | 
| 180 | 180 | } | 
| 181 | 181 | |
| 182 | -		if (! $moduleClass = self::getClass($classOrAlias)) {			 | |
| 182 | +		if (!$moduleClass = self::getClass($classOrAlias)) {			 | |
| 183 | 183 |  			throw new \Exception(sprintf('Module "%s" could not be identified', $classOrAlias)); | 
| 184 | 184 | } | 
| 185 | 185 | |
| @@ -209,7 +209,7 @@ discard block | ||
| 209 | 209 | ]); | 
| 210 | 210 | |
| 211 | 211 |  		if ($installRecommended) { | 
| 212 | - $installRecommended = is_array($installRecommended)? $installRecommended: $module->recommended(); | |
| 212 | + $installRecommended = is_array($installRecommended) ? $installRecommended : $module->recommended(); | |
| 213 | 213 | |
| 214 | 214 |  			foreach ($installRecommended as $recommendedModule) { | 
| 215 | 215 |  				try { | 
| @@ -238,11 +238,11 @@ discard block | ||
| 238 | 238 |  		while ($unsatisfiedDependencies = self::unsatisfiedDependencies($moduleClass)) { | 
| 239 | 239 | $parentModule = array_shift($unsatisfiedDependencies); | 
| 240 | 240 | |
| 241 | -			if (self::$processing[$parentModule]?? false) { | |
| 241 | +			if (self::$processing[$parentModule] ?? false) { | |
| 242 | 242 |  				throw new \Exception(sprintf('Cross dependency: %s', $parentModule)); | 
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | -			if (! self::isAvailable($parentModule)) { | |
| 245 | +			if (!self::isAvailable($parentModule)) { | |
| 246 | 246 |  				throw new \Exception(sprintf('Module "%s" not found!', $parentModule)); | 
| 247 | 247 | } | 
| 248 | 248 | |
| @@ -314,17 +314,17 @@ discard block | ||
| 314 | 314 | */ | 
| 315 | 315 | public static function uninstall(string $classOrAlias): bool | 
| 316 | 316 |  	{ | 
| 317 | -		if (! self::isInstalled($classOrAlias)) { | |
| 317 | +		if (!self::isInstalled($classOrAlias)) { | |
| 318 | 318 |  			print sprintf('Module "%s" is not installed!', $classOrAlias); | 
| 319 | 319 | |
| 320 | 320 | return true; | 
| 321 | 321 | } | 
| 322 | 322 | |
| 323 | -		if (! $moduleClass = self::getClass($classOrAlias)) { | |
| 323 | +		if (!$moduleClass = self::getClass($classOrAlias)) { | |
| 324 | 324 |  			throw new \Exception(sprintf('Module "%s" could not be identified', $classOrAlias)); | 
| 325 | 325 | } | 
| 326 | 326 | |
| 327 | -		foreach (self::listDependents()[$moduleClass]?? [] as $childModule) { | |
| 327 | +		foreach (self::listDependents()[$moduleClass] ?? [] as $childModule) { | |
| 328 | 328 | self::uninstall($childModule); | 
| 329 | 329 | } | 
| 330 | 330 | |
| @@ -160,7 +160,9 @@ | ||
| 160 | 160 | |
| 161 | 161 | $ret = []; | 
| 162 | 162 |  		foreach ($installedModules as $module) { | 
| 163 | - if (! $list = $module::$method(...$args)) continue; | |
| 163 | +			if (! $list = $module::$method(...$args)) { | |
| 164 | + continue; | |
| 165 | + } | |
| 164 | 166 | |
| 165 | 167 | $ret = array_merge($ret, is_array($list)? $list: [$list]); | 
| 166 | 168 | } |