Passed
Push — master ( 3ff9e0...540cb8 )
by Georgi
03:25
created
src/UI/Traits/Notifies.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 {
7 7
 	public function notify($options, $attachTo = null)
8 8
 	{
9
-		$options = array_merge(['duration'=> 1500], is_array($options)? $options: ['content' => $options]);
9
+		$options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['content' => $options]);
10 10
 		
11
-		$attachTo = $attachTo?: $this;
11
+		$attachTo = $attachTo ?: $this;
12 12
 		
13 13
 		return (new \atk4\ui\jsNotify($options, $attachTo));
14 14
 	}
15 15
 	
16 16
 	public function notifyError($options, $attachTo = null)
17 17
 	{
18
-		$options = array_merge(['color' => 'red'], is_array($options)? $options: ['content' => $options]);
18
+		$options = array_merge(['color' => 'red'], is_array($options) ? $options : ['content' => $options]);
19 19
 		
20 20
 		return $this->notify($options, $attachTo);
21 21
 	}
Please login to merge, or discard this patch.
src/Providers/EpesiServiceProvider.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,57 +10,57 @@
 block discarded – undo
10 10
 
11 11
 class EpesiServiceProvider extends ServiceProvider
12 12
 {
13
-    /**
14
-     * Booting the package.
15
-     */
16
-    public function boot()
17
-    {
18
-    	$this->ensureHttps();
13
+	/**
14
+	 * Booting the package.
15
+	 */
16
+	public function boot()
17
+	{
18
+		$this->ensureHttps();
19 19
     	
20
-    	Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web', 'auth']], function() {
21
-    		header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1
22
-    		header("Pragma: no-cache"); //HTTP 1.0
23
-    		header("Expires: 0");
20
+		Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => ['web', 'auth']], function() {
21
+			header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1
22
+			header("Pragma: no-cache"); //HTTP 1.0
23
+			header("Expires: 0");
24 24
     		
25
-    		Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view');
26
-    	});
25
+			Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view');
26
+		});
27 27
     	
28 28
 		// Register providers declared in modules
29 29
 		foreach (Module::collect('providers') as $provider) {
30 30
 			$this->app->register($provider);
31 31
 		}
32 32
 
33
-    	// Register admin service provider if in admin mode or in console
34
-    	// TODO: apply access restriction to admin mode
33
+		// Register admin service provider if in admin mode or in console
34
+		// TODO: apply access restriction to admin mode
35 35
 //     	if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) {
36
-    	if ($this->app->runningInConsole() || request('admin', false)) {
37
-    		$this->app->register(AdminServiceProvider::class);
38
-    	}
39
-    }
36
+		if ($this->app->runningInConsole() || request('admin', false)) {
37
+			$this->app->register(AdminServiceProvider::class);
38
+		}
39
+	}
40 40
 
41
-    /**
42
-     * Register the provider.
43
-     */
44
-    public function register()
45
-    {
46
-    	$this->app->singleton(App::class);
47
-    }
41
+	/**
42
+	 * Register the provider.
43
+	 */
44
+	public function register()
45
+	{
46
+		$this->app->singleton(App::class);
47
+	}
48 48
     
49
-    /**
50
-     * Force to set https scheme if https enabled.
51
-     *
52
-     * @return void
53
-     */
54
-    protected function ensureHttps()
55
-    {
56
-    	if (config('epesi.https') || config('epesi.secure')) {
57
-    		url()->forceScheme('https');
58
-    		$this->app['request']->server->set('HTTPS', true);
59
-    	}
60
-    }
49
+	/**
50
+	 * Force to set https scheme if https enabled.
51
+	 *
52
+	 * @return void
53
+	 */
54
+	protected function ensureHttps()
55
+	{
56
+		if (config('epesi.https') || config('epesi.secure')) {
57
+			url()->forceScheme('https');
58
+			$this->app['request']->server->set('HTTPS', true);
59
+		}
60
+	}
61 61
     
62
-    protected function registerStorageDisk()
63
-    {
64
-    	$this->app['config']['filesystems.disks.epesi'] = config('epesi.disk');
65
-    }
62
+	protected function registerStorageDisk()
63
+	{
64
+		$this->app['config']['filesystems.disks.epesi'] = config('epesi.disk');
65
+	}
66 66
 }
Please login to merge, or discard this patch.
src/Providers/AdminServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     	$this->publishes(Module::collect('public'), 'epesi.module.public');
24 24
     	
25 25
     	// Publish epesi configuration files
26
-    	$this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config');
26
+    	$this->publishes([__DIR__ . '/../../config' => config_path()], 'epesi.config');
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@
 block discarded – undo
11 11
 			\Epesi\Core\Console\AdminCommand::class
12 12
 	];
13 13
 	
14
-    /**
15
-     * Booting the package.
16
-     */
17
-    public function boot()
18
-    {
19
-    	// Register migrations from installed modules
20
-    	$this->loadMigrationsFrom(Module::collect('migrations'));
14
+	/**
15
+	 * Booting the package.
16
+	 */
17
+	public function boot()
18
+	{
19
+		// Register migrations from installed modules
20
+		$this->loadMigrationsFrom(Module::collect('migrations'));
21 21
 
22
-    	// Publish files from installed modules
23
-    	$this->publishes(Module::collect('public'), 'epesi.module.public');
22
+		// Publish files from installed modules
23
+		$this->publishes(Module::collect('public'), 'epesi.module.public');
24 24
     	
25
-    	// Publish epesi configuration files
26
-    	$this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config');
27
-    }
25
+		// Publish epesi configuration files
26
+		$this->publishes([__DIR__.'/../../config' => config_path()], 'epesi.config');
27
+	}
28 28
 
29
-    /**
30
-     * Register the provider.
31
-     */
32
-    public function register()
33
-    {
34
-    	$this->commands($this->commands);
35
-    }
29
+	/**
30
+	 * Register the provider.
31
+	 */
32
+	public function register()
33
+	{
34
+		$this->commands($this->commands);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
src/Console/AdminCommand.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@  discard block
 block discarded – undo
8 8
 
9 9
 class AdminCommand 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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Facades/Epesi.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Integration/Concerns/HasAssets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 	{
18 18
 		$source = implode(DIRECTORY_SEPARATOR, [static::path(), 'Public']);
19 19
 
20
-		return is_dir($source)? [
20
+		return is_dir($source) ? [
21 21
 				$source => self::publicPath()
22
-		]: [];
22
+		] : [];
23 23
 	}
24 24
 		
25 25
 	/**
Please login to merge, or discard this patch.
src/Integration/Concerns/HasModule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	final public static function view($alias = null)
16 16
 	{
17
-		$class = self::namespace() . '\\' . ($alias? Str::studly($alias): self::name()) . 'View';
17
+		$class = self::namespace() . '\\' . ($alias ? Str::studly($alias) : self::name()) . 'View';
18 18
 		
19 19
 		if ($alias) return $class;
20 20
 		
21
-		return static::$view?: $class;
21
+		return static::$view ?: $class;
22 22
 	}
23 23
 	
24 24
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		$names = array_slice(explode('\\', static::class), -2, -1);
66 66
 		
67
-		return $names? reset($names): '';
67
+		return $names ? reset($names) : '';
68 68
 	}
69 69
 	
70 70
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
 	{
17 17
 		$class = self::namespace() . '\\' . ($alias? Str::studly($alias): self::name()) . 'View';
18 18
 		
19
-		if ($alias) return $class;
19
+		if ($alias) {
20
+			return $class;
21
+		}
20 22
 		
21 23
 		return static::$view?: $class;
22 24
 	}
Please login to merge, or discard this patch.
src/Integration/Concerns/HasLinks.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 		
22 22
 		$viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView;
23 23
 		
24
-		if ($viewClass == $defaultView) $viewClass = null;
24
+		if ($viewClass == $defaultView) {
25
+			$viewClass = null;
26
+		}
25 27
 		
26 28
 		return url(implode('/', ['view', implode('_', array_filter([self::alias(), $viewClass])), $method, self::encodeArgs($args)]));
27 29
 	}
@@ -52,11 +54,15 @@  discard block
 block discarded – undo
52 54
 	 * @throws \Illuminate\Http\Exceptions\HttpResponseException
53 55
 	 */
54 56
 	final public static function decodeArgs($hash) {
55
-		if (! $hash) return [];
57
+		if (! $hash) {
58
+			return [];
59
+		}
56 60
 		
57 61
 		$args = session($hash);
58 62
 
59
-		if (is_null($args)) abort(419);
63
+		if (is_null($args)) {
64
+			abort(419);
65
+		}
60 66
 		
61 67
 		return is_array($args)? $args: [$args];
62 68
 	}
@@ -70,7 +76,9 @@  discard block
 block discarded – undo
70 76
 	final public static function encodeArgs($args) {
71 77
 		$args = is_array($args)? $args: [$args];
72 78
 		
73
-		if (! $args) return;
79
+		if (! $args) {
80
+			return;
81
+		}
74 82
 		
75 83
 		$hash = md5(serialize($args));
76 84
 		
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	{
20 20
 		$defaultView = self::module()::view();
21 21
 		
22
-		$viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView;
22
+		$viewClass = is_a(static::class, ModuleView::class, true) ? static::class : $defaultView;
23 23
 		
24 24
 		if ($viewClass == $defaultView) $viewClass = null;
25 25
 		
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	final public static function moduleLink($module, $method = 'body', $args = [])
40 40
 	{
41
-		$alias = class_exists($module)? $module::alias(): $module;
41
+		$alias = class_exists($module) ? $module::alias() : $module;
42 42
 		
43 43
 		return url(implode('/', ['view', $alias, $method, self::encodeArgs($args)]));
44 44
 	}
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 * @throws \Illuminate\Http\Exceptions\HttpResponseException
53 53
 	 */
54 54
 	final public static function decodeArgs($hash) {
55
-		if (! $hash) return [];
55
+		if (!$hash) return [];
56 56
 		
57 57
 		$args = session($hash);
58 58
 
59 59
 		if (is_null($args)) abort(419);
60 60
 		
61
-		return is_array($args)? $args: [$args];
61
+		return is_array($args) ? $args : [$args];
62 62
 	}
63 63
 	
64 64
 	/**
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	 * @return string
69 69
 	 */
70 70
 	final public static function encodeArgs($args) {
71
-		$args = is_array($args)? $args: [$args];
71
+		$args = is_array($args) ? $args : [$args];
72 72
 		
73
-		if (! $args) return;
73
+		if (!$args) return;
74 74
 		
75 75
 		$hash = md5(serialize($args));
76 76
 		
Please login to merge, or discard this patch.
src/Integration/Concerns/HasAssetsAccess.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 	}
13 13
 	
14 14
 	final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) {
15
-		return epesi()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer);
15
+		return epesi()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer);
16 16
 	}
17 17
 	
18 18
 	final public static function requireCSS($file = 'default.css') {
19
-		return epesi()->requireCSS(self::assetUrl('css/'. $file));
19
+		return epesi()->requireCSS(self::assetUrl('css/' . $file));
20 20
 	}
21 21
 	
22 22
 	/**
Please login to merge, or discard this patch.