Passed
Push — master ( 9b6cf0...d3c4d5 )
by Georgi
05:20
created
Access/Database/Migrations/2019_10_24_195050_create_permission_tables.php 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -6,97 +6,97 @@
 block discarded – undo
6 6
 
7 7
 class CreatePermissionTables extends Migration
8 8
 {
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        $tableNames = config('permission.table_names');
17
-        $columnNames = config('permission.column_names');
18
-
19
-        Schema::create($tableNames['permissions'], function (Blueprint $table) {
20
-            $table->bigIncrements('id');
21
-            $table->string('name');
22
-            $table->string('guard_name');
23
-            $table->timestamps();
24
-        });
25
-
26
-        Schema::create($tableNames['roles'], function (Blueprint $table) {
27
-            $table->bigIncrements('id');
28
-            $table->string('name');
29
-            $table->string('guard_name');
30
-            $table->timestamps();
31
-        });
32
-
33
-        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
34
-            $table->unsignedBigInteger('permission_id');
35
-
36
-            $table->string('model_type');
37
-            $table->unsignedBigInteger($columnNames['model_morph_key']);
38
-            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index');
39
-
40
-            $table->foreign('permission_id')
41
-                ->references('id')
42
-                ->on($tableNames['permissions'])
43
-                ->onDelete('cascade');
44
-
45
-            $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
46
-                    'model_has_permissions_permission_model_type_primary');
47
-        });
48
-
49
-        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
50
-            $table->unsignedBigInteger('role_id');
51
-
52
-            $table->string('model_type');
53
-            $table->unsignedBigInteger($columnNames['model_morph_key']);
54
-            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index');
55
-
56
-            $table->foreign('role_id')
57
-                ->references('id')
58
-                ->on($tableNames['roles'])
59
-                ->onDelete('cascade');
60
-
61
-            $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
62
-                    'model_has_roles_role_model_type_primary');
63
-        });
64
-
65
-        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
66
-            $table->unsignedBigInteger('permission_id');
67
-            $table->unsignedBigInteger('role_id');
68
-
69
-            $table->foreign('permission_id')
70
-                ->references('id')
71
-                ->on($tableNames['permissions'])
72
-                ->onDelete('cascade');
73
-
74
-            $table->foreign('role_id')
75
-                ->references('id')
76
-                ->on($tableNames['roles'])
77
-                ->onDelete('cascade');
78
-
79
-            $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
80
-        });
81
-
82
-        app('cache')
83
-            ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
84
-            ->forget(config('permission.cache.key'));
85
-    }
86
-
87
-    /**
88
-     * Reverse the migrations.
89
-     *
90
-     * @return void
91
-     */
92
-    public function down()
93
-    {
94
-        $tableNames = config('permission.table_names');
95
-
96
-        Schema::drop($tableNames['role_has_permissions']);
97
-        Schema::drop($tableNames['model_has_roles']);
98
-        Schema::drop($tableNames['model_has_permissions']);
99
-        Schema::drop($tableNames['roles']);
100
-        Schema::drop($tableNames['permissions']);
101
-    }
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		$tableNames = config('permission.table_names');
17
+		$columnNames = config('permission.column_names');
18
+
19
+		Schema::create($tableNames['permissions'], function (Blueprint $table) {
20
+			$table->bigIncrements('id');
21
+			$table->string('name');
22
+			$table->string('guard_name');
23
+			$table->timestamps();
24
+		});
25
+
26
+		Schema::create($tableNames['roles'], function (Blueprint $table) {
27
+			$table->bigIncrements('id');
28
+			$table->string('name');
29
+			$table->string('guard_name');
30
+			$table->timestamps();
31
+		});
32
+
33
+		Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
34
+			$table->unsignedBigInteger('permission_id');
35
+
36
+			$table->string('model_type');
37
+			$table->unsignedBigInteger($columnNames['model_morph_key']);
38
+			$table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index');
39
+
40
+			$table->foreign('permission_id')
41
+				->references('id')
42
+				->on($tableNames['permissions'])
43
+				->onDelete('cascade');
44
+
45
+			$table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
46
+					'model_has_permissions_permission_model_type_primary');
47
+		});
48
+
49
+		Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
50
+			$table->unsignedBigInteger('role_id');
51
+
52
+			$table->string('model_type');
53
+			$table->unsignedBigInteger($columnNames['model_morph_key']);
54
+			$table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index');
55
+
56
+			$table->foreign('role_id')
57
+				->references('id')
58
+				->on($tableNames['roles'])
59
+				->onDelete('cascade');
60
+
61
+			$table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
62
+					'model_has_roles_role_model_type_primary');
63
+		});
64
+
65
+		Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
66
+			$table->unsignedBigInteger('permission_id');
67
+			$table->unsignedBigInteger('role_id');
68
+
69
+			$table->foreign('permission_id')
70
+				->references('id')
71
+				->on($tableNames['permissions'])
72
+				->onDelete('cascade');
73
+
74
+			$table->foreign('role_id')
75
+				->references('id')
76
+				->on($tableNames['roles'])
77
+				->onDelete('cascade');
78
+
79
+			$table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
80
+		});
81
+
82
+		app('cache')
83
+			->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
84
+			->forget(config('permission.cache.key'));
85
+	}
86
+
87
+	/**
88
+	 * Reverse the migrations.
89
+	 *
90
+	 * @return void
91
+	 */
92
+	public function down()
93
+	{
94
+		$tableNames = config('permission.table_names');
95
+
96
+		Schema::drop($tableNames['role_has_permissions']);
97
+		Schema::drop($tableNames['model_has_roles']);
98
+		Schema::drop($tableNames['model_has_permissions']);
99
+		Schema::drop($tableNames['roles']);
100
+		Schema::drop($tableNames['permissions']);
101
+	}
102 102
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
         $tableNames = config('permission.table_names');
17 17
         $columnNames = config('permission.column_names');
18 18
 
19
-        Schema::create($tableNames['permissions'], function (Blueprint $table) {
19
+        Schema::create($tableNames['permissions'], function(Blueprint $table) {
20 20
             $table->bigIncrements('id');
21 21
             $table->string('name');
22 22
             $table->string('guard_name');
23 23
             $table->timestamps();
24 24
         });
25 25
 
26
-        Schema::create($tableNames['roles'], function (Blueprint $table) {
26
+        Schema::create($tableNames['roles'], function(Blueprint $table) {
27 27
             $table->bigIncrements('id');
28 28
             $table->string('name');
29 29
             $table->string('guard_name');
30 30
             $table->timestamps();
31 31
         });
32 32
 
33
-        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
33
+        Schema::create($tableNames['model_has_permissions'], function(Blueprint $table) use ($tableNames, $columnNames) {
34 34
             $table->unsignedBigInteger('permission_id');
35 35
 
36 36
             $table->string('model_type');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                     'model_has_permissions_permission_model_type_primary');
47 47
         });
48 48
 
49
-        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
49
+        Schema::create($tableNames['model_has_roles'], function(Blueprint $table) use ($tableNames, $columnNames) {
50 50
             $table->unsignedBigInteger('role_id');
51 51
 
52 52
             $table->string('model_type');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     'model_has_roles_role_model_type_primary');
63 63
         });
64 64
 
65
-        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
65
+        Schema::create($tableNames['role_has_permissions'], function(Blueprint $table) use ($tableNames) {
66 66
             $table->unsignedBigInteger('permission_id');
67 67
             $table->unsignedBigInteger('role_id');
68 68
 
Please login to merge, or discard this patch.
src/System/User/Access/AccessCore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public static function boot()
51 51
 	{
52 52
 		// allow Super Admin full access
53
-		Gate::after(function ($user, $ability) {
53
+		Gate::after(function($user, $ability) {
54 54
 			return $user->hasRole('Super Admin');
55 55
 		});
56 56
 	}
Please login to merge, or discard this patch.
src/System/User/Settings/Database/Models/UserSetting.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 	
25 25
 	private static function cacheUserVariables() {
26
-		if(isset(self::$userVariables)) return;
26
+		if (isset(self::$userVariables)) return;
27 27
 
28 28
 		$userId = Auth::id();
29 29
 		
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 	
35 35
 	private static function cacheAdminVariables() {
36
-		if(isset(self::$adminVariables)) return;
36
+		if (isset(self::$adminVariables)) return;
37 37
 
38 38
 		foreach (self::where('user_id', 0) as $row) {
39 39
 			self::$adminVariables[$row['group']][$row['name']] = $row['value'];
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 	
43 43
 	public static function get($group, $name, $user = null) {
44
-		$user = $user?: Auth::id();
44
+		$user = $user ?: Auth::id();
45 45
 		
46 46
 		if (!$user || !is_numeric($user)) return;
47 47
 		
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 	
53 53
 	public static function getGroup($group, $user = null) {
54
-		$user = $user?: Auth::id();
54
+		$user = $user ?: Auth::id();
55 55
 		
56 56
 		if (!$user || !is_numeric($user)) return;
57 57
 		
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 	
75 75
 	public static function put($group, $name, $value, $user = null) {
76
-		$user_id = $user?: Auth::id();
76
+		$user_id = $user ?: Auth::id();
77 77
 		
78 78
 		if (!$user_id || !is_numeric($user_id)) return;
79 79
 		
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	
103 103
 	public static function forget($group, $name, $user = null) {
104
-		$user_id = $user?: Auth::id();
104
+		$user_id = $user ?: Auth::id();
105 105
 		
106 106
 		if (!$user_id || !is_numeric($user_id)) return;
107 107
 		
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 	
25 25
 	private static function cacheUserVariables() {
26
-		if(isset(self::$userVariables)) return;
26
+		if(isset(self::$userVariables)) {
27
+			return;
28
+		}
27 29
 
28 30
 		$userId = Auth::id();
29 31
 		
@@ -33,7 +35,9 @@  discard block
 block discarded – undo
33 35
 	}
34 36
 	
35 37
 	private static function cacheAdminVariables() {
36
-		if(isset(self::$adminVariables)) return;
38
+		if(isset(self::$adminVariables)) {
39
+			return;
40
+		}
37 41
 
38 42
 		foreach (self::where('user_id', 0) as $row) {
39 43
 			self::$adminVariables[$row['group']][$row['name']] = $row['value'];
@@ -43,7 +47,9 @@  discard block
 block discarded – undo
43 47
 	public static function get($group, $name, $user = null) {
44 48
 		$user = $user?: Auth::id();
45 49
 		
46
-		if (!$user || !is_numeric($user)) return;
50
+		if (!$user || !is_numeric($user)) {
51
+			return;
52
+		}
47 53
 		
48 54
 		self::cache();
49 55
 		
@@ -53,7 +59,9 @@  discard block
 block discarded – undo
53 59
 	public static function getGroup($group, $user = null) {
54 60
 		$user = $user?: Auth::id();
55 61
 		
56
-		if (!$user || !is_numeric($user)) return;
62
+		if (!$user || !is_numeric($user)) {
63
+			return;
64
+		}
57 65
 		
58 66
 		self::cache();
59 67
 
@@ -75,7 +83,9 @@  discard block
 block discarded – undo
75 83
 	public static function put($group, $name, $value, $user = null) {
76 84
 		$user_id = $user?: Auth::id();
77 85
 		
78
-		if (!$user_id || !is_numeric($user_id)) return;
86
+		if (!$user_id || !is_numeric($user_id)) {
87
+			return;
88
+		}
79 89
 		
80 90
 		self::cache();
81 91
 
@@ -103,7 +113,9 @@  discard block
 block discarded – undo
103 113
 	public static function forget($group, $name, $user = null) {
104 114
 		$user_id = $user?: Auth::id();
105 115
 		
106
-		if (!$user_id || !is_numeric($user_id)) return;
116
+		if (!$user_id || !is_numeric($user_id)) {
117
+			return;
118
+		}
107 119
 		
108 120
 		self::cache();
109 121
 		
Please login to merge, or discard this patch.
Database/Migrations/2019_09_18_173148_create_user_settings_table.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@
 block discarded – undo
6 6
 
7 7
 class CreateUserSettingsTable 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('user_settings', function (Blueprint $table) {
19
-    		$table->increments('id');
20
-    		$table->unsignedInteger('user_id');
21
-            $table->string('group', 512);
22
-            $table->string('name', 128);
23
-            $table->text('value');
24
-        });
25
-    }
18
+		Schema::create('user_settings', function (Blueprint $table) {
19
+			$table->increments('id');
20
+			$table->unsignedInteger('user_id');
21
+			$table->string('group', 512);
22
+			$table->string('name', 128);
23
+			$table->text('value');
24
+		});
25
+	}
26 26
 
27
-    /**
28
-     * Reverse the migrations.
29
-     *
30
-     * @return void
31
-     */
32
-    public function down()
33
-    {
34
-    	Schema::dropIfExists('user_settings');
35
-    }
27
+	/**
28
+	 * Reverse the migrations.
29
+	 *
30
+	 * @return void
31
+	 */
32
+	public function down()
33
+	{
34
+		Schema::dropIfExists('user_settings');
35
+	}
36 36
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
     	$this->down();
17 17
     	
18
-    	Schema::create('user_settings', function (Blueprint $table) {
18
+    	Schema::create('user_settings', function(Blueprint $table) {
19 19
     		$table->increments('id');
20 20
     		$table->unsignedInteger('user_id');
21 21
             $table->string('group', 512);
Please login to merge, or discard this patch.
src/System/User/Settings/Integration/Joints/UserSettingsJoint.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	public function group()
27 27
 	{
28
-		return $this->group?: static::class;
28
+		return $this->group ?: static::class;
29 29
 	}
30 30
 	
31 31
 	/**
Please login to merge, or discard this patch.
src/System/Integration/Modules/PackageManifest.php 2 patches
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -7,168 +7,168 @@
 block discarded – undo
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, $package) {
81
-    		return array_map(function($moduleRelativePath) use ($package) {
82
-    			return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath]));
83
-    		}, (array) ($configuration['modules'] ?? []));
84
-    	})->filter()->all();
85
-    }
86
-
87
-    /**
88
-     * Get the current package manifest.
89
-     *
90
-     * @return array
91
-     */
92
-    protected function getManifest()
93
-    {
94
-        if (isset($this->manifest)) {
95
-            return $this->manifest;
96
-        }
97
-
98
-        if (! file_exists($this->manifestPath)) {
99
-            $this->build();
100
-        }
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, $package) {
81
+			return array_map(function($moduleRelativePath) use ($package) {
82
+				return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath]));
83
+			}, (array) ($configuration['modules'] ?? []));
84
+		})->filter()->all();
85
+	}
86
+
87
+	/**
88
+	 * Get the current package manifest.
89
+	 *
90
+	 * @return array
91
+	 */
92
+	protected function getManifest()
93
+	{
94
+		if (isset($this->manifest)) {
95
+			return $this->manifest;
96
+		}
97
+
98
+		if (! file_exists($this->manifestPath)) {
99
+			$this->build();
100
+		}
101 101
         
102
-        return $this->manifest = file_exists($this->manifestPath) ?
103
-            $this->files->getRequire($this->manifestPath) : [];
104
-    }
105
-
106
-    /**
107
-     * Build the manifest and write it to disk.
108
-     *
109
-     * @return void
110
-     */
111
-    public function build()
112
-    {
113
-        $packages = [];
114
-
115
-        if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
116
-            $packages = json_decode($this->files->get($path), true);
117
-        }
118
-
119
-        $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore());
120
-
121
-        $this->write(collect($packages)->mapWithKeys(function ($package) {
122
-            return [$this->format($package['name']) => $package['extra']['epesi'] ?? []];
123
-        })->each(function ($configuration) use (&$ignore) {
124
-            $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []);
125
-        })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) {
126
-            return $ignoreAll || in_array($package, $ignore);
127
-        })->filter()->all());
128
-    }
129
-
130
-    /**
131
-     * Format the given package name.
132
-     *
133
-     * @param  string  $package
134
-     * @return string
135
-     */
136
-    protected function format($package)
137
-    {
138
-        return str_replace($this->vendorPath.'/', '', $package);
139
-    }
140
-
141
-    /**
142
-     * Get all of the package names that should be ignored.
143
-     *
144
-     * @return array
145
-     */
146
-    protected function packagesToIgnore()
147
-    {
148
-        if (! file_exists($this->basePath.'/composer.json')) {
149
-            return [];
150
-        }
151
-
152
-        return json_decode(file_get_contents(
153
-            $this->basePath.'/composer.json'
154
-        ), true)['extra']['epesi']['dont-discover'] ?? [];
155
-    }
156
-
157
-    /**
158
-     * Write the given manifest array to disk.
159
-     *
160
-     * @param  array  $manifest
161
-     * @return void
162
-     * @throws \Exception
163
-     */
164
-    protected function write(array $manifest)
165
-    {
166
-        if (! is_writable(dirname($this->manifestPath))) {
167
-            throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.');
168
-        }
169
-
170
-        $this->files->put(
171
-            $this->manifestPath, '<?php return '.var_export($manifest, true).';'
172
-        );
173
-    }
102
+		return $this->manifest = file_exists($this->manifestPath) ?
103
+			$this->files->getRequire($this->manifestPath) : [];
104
+	}
105
+
106
+	/**
107
+	 * Build the manifest and write it to disk.
108
+	 *
109
+	 * @return void
110
+	 */
111
+	public function build()
112
+	{
113
+		$packages = [];
114
+
115
+		if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
116
+			$packages = json_decode($this->files->get($path), true);
117
+		}
118
+
119
+		$ignoreAll = in_array('*', $ignore = $this->packagesToIgnore());
120
+
121
+		$this->write(collect($packages)->mapWithKeys(function ($package) {
122
+			return [$this->format($package['name']) => $package['extra']['epesi'] ?? []];
123
+		})->each(function ($configuration) use (&$ignore) {
124
+			$ignore = array_merge($ignore, $configuration['dont-discover'] ?? []);
125
+		})->reject(function ($configuration, $package) use ($ignore, $ignoreAll) {
126
+			return $ignoreAll || in_array($package, $ignore);
127
+		})->filter()->all());
128
+	}
129
+
130
+	/**
131
+	 * Format the given package name.
132
+	 *
133
+	 * @param  string  $package
134
+	 * @return string
135
+	 */
136
+	protected function format($package)
137
+	{
138
+		return str_replace($this->vendorPath.'/', '', $package);
139
+	}
140
+
141
+	/**
142
+	 * Get all of the package names that should be ignored.
143
+	 *
144
+	 * @return array
145
+	 */
146
+	protected function packagesToIgnore()
147
+	{
148
+		if (! file_exists($this->basePath.'/composer.json')) {
149
+			return [];
150
+		}
151
+
152
+		return json_decode(file_get_contents(
153
+			$this->basePath.'/composer.json'
154
+		), true)['extra']['epesi']['dont-discover'] ?? [];
155
+	}
156
+
157
+	/**
158
+	 * Write the given manifest array to disk.
159
+	 *
160
+	 * @param  array  $manifest
161
+	 * @return void
162
+	 * @throws \Exception
163
+	 */
164
+	protected function write(array $manifest)
165
+	{
166
+		if (! is_writable(dirname($this->manifestPath))) {
167
+			throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.');
168
+		}
169
+
170
+		$this->files->put(
171
+			$this->manifestPath, '<?php return '.var_export($manifest, true).';'
172
+		);
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
77 77
      */
78 78
     public function modules()
79 79
     {
80
-    	return collect($this->getManifest())->flatMap(function ($configuration, $package) {
80
+    	return collect($this->getManifest())->flatMap(function($configuration, $package) {
81 81
     		return array_map(function($moduleRelativePath) use ($package) {
82 82
     			return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath]));
83 83
     		}, (array) ($configuration['modules'] ?? []));
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             return $this->manifest;
96 96
         }
97 97
 
98
-        if (! file_exists($this->manifestPath)) {
98
+        if (!file_exists($this->manifestPath)) {
99 99
             $this->build();
100 100
         }
101 101
         
@@ -112,17 +112,17 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $packages = [];
114 114
 
115
-        if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
115
+        if ($this->files->exists($path = $this->vendorPath . '/composer/installed.json')) {
116 116
             $packages = json_decode($this->files->get($path), true);
117 117
         }
118 118
 
119 119
         $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore());
120 120
 
121
-        $this->write(collect($packages)->mapWithKeys(function ($package) {
121
+        $this->write(collect($packages)->mapWithKeys(function($package) {
122 122
             return [$this->format($package['name']) => $package['extra']['epesi'] ?? []];
123
-        })->each(function ($configuration) use (&$ignore) {
123
+        })->each(function($configuration) use (&$ignore) {
124 124
             $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []);
125
-        })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) {
125
+        })->reject(function($configuration, $package) use ($ignore, $ignoreAll) {
126 126
             return $ignoreAll || in_array($package, $ignore);
127 127
         })->filter()->all());
128 128
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     protected function format($package)
137 137
     {
138
-        return str_replace($this->vendorPath.'/', '', $package);
138
+        return str_replace($this->vendorPath . '/', '', $package);
139 139
     }
140 140
 
141 141
     /**
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function packagesToIgnore()
147 147
     {
148
-        if (! file_exists($this->basePath.'/composer.json')) {
148
+        if (!file_exists($this->basePath . '/composer.json')) {
149 149
             return [];
150 150
         }
151 151
 
152 152
         return json_decode(file_get_contents(
153
-            $this->basePath.'/composer.json'
153
+            $this->basePath . '/composer.json'
154 154
         ), true)['extra']['epesi']['dont-discover'] ?? [];
155 155
     }
156 156
 
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function write(array $manifest)
165 165
     {
166
-        if (! is_writable(dirname($this->manifestPath))) {
167
-            throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.');
166
+        if (!is_writable(dirname($this->manifestPath))) {
167
+            throw new Exception('The ' . dirname($this->manifestPath) . ' directory must be present and writable.');
168 168
         }
169 169
 
170 170
         $this->files->put(
171
-            $this->manifestPath, '<?php return '.var_export($manifest, true).';'
171
+            $this->manifestPath, '<?php return ' . var_export($manifest, true) . ';'
172 172
         );
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
src/System/SystemInstallWizard.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		
80 80
 		$form->addField('language', ['DropDown', 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en'));
81 81
 		
82
-		$form->onSubmit(function ($form) use ($wizard) {
82
+		$form->onSubmit(function($form) use ($wizard) {
83 83
 			$wizard->memorize('language', $form->model['language']);
84 84
 			
85 85
 			App::setLocale($form->model['language']);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$form->addField('support', ['CheckBox', 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]);
112 112
 		$form->addField('store', ['CheckBox', 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.app.title')])], ['required'=>true]);
113 113
 		
114
-		$form->onSubmit(function ($form) use ($wizard) {
114
+		$form->onSubmit(function($form) use ($wizard) {
115 115
 			return $wizard->jsNext();
116 116
 		});
117 117
 			
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 		$form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')]));
140 140
 
141 141
 		foreach ($wizard->recall('connection', []) as $name => $value) {
142
-			if (! $field = $form->fields[$name]?? null) continue;
142
+			if (!$field = $form->fields[$name]?? null) continue;
143 143
 			
144 144
 			$field->set($value);
145 145
 		}
146 146
 
147
-		$form->onSubmit(function ($form) use ($wizard) {
147
+		$form->onSubmit(function($form) use ($wizard) {
148 148
 			$connection = $form->model->get();
149 149
 
150 150
 			$wizard->memorize('connection', $connection);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		
193 193
 		$form->setValues($wizard->recall('user'));
194 194
 		
195
-		$form->validate(function ($form) use ($wizard) {
195
+		$form->validate(function($form) use ($wizard) {
196 196
 			$wizard->memorize('user', $form->model->get());
197 197
 			
198 198
 			return $wizard->jsNext();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,9 @@
 block discarded – undo
139 139
 		$form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')]));
140 140
 
141 141
 		foreach ($wizard->recall('connection', []) as $name => $value) {
142
-			if (! $field = $form->fields[$name]?? null) continue;
142
+			if (! $field = $form->fields[$name]?? null) {
143
+				continue;
144
+			}
143 145
 			
144 146
 			$field->set($value);
145 147
 		}
Please login to merge, or discard this patch.
src/Providers/EpesiServiceProvider.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
     {
18 18
     	$this->ensureHttps();
19 19
     	
20
-    	if (env('APP_DEBUG', false)) ModuleManager::clearCache();
20
+    	if (env('APP_DEBUG', false)) {
21
+    		ModuleManager::clearCache();
22
+    	}
21 23
     	
22 24
     	Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() {
23 25
     		Route::any('/', 'SystemController@index');
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -12,73 +12,73 @@
 block discarded – undo
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\Controllers', 'middleware' => 'web'], function() {
25
-    		Route::any('/', 'SystemController@index');
26
-    		Route::get('logo', 'SystemController@logo');
27
-    		Route::any('install', 'SystemController@install');
24
+		Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() {
25
+			Route::any('/', 'SystemController@index');
26
+			Route::get('logo', 'SystemController@logo');
27
+			Route::any('install', 'SystemController@install');
28 28
     		
29
-    		Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() {
30
-    			Route::any('home', 'SystemController@home')->name('home');
29
+			Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() {
30
+				Route::any('home', 'SystemController@home')->name('home');
31 31
     			
32
-    			Route::any('view/{alias}/{method?}/{args?}', 'SystemController@view');
33
-    		});
34
-    	});
32
+				Route::any('view/{alias}/{method?}/{args?}', 'SystemController@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(App::class);
51
+	/**
52
+	 * Register the provider.
53
+	 */
54
+	public function register()
55
+	{
56
+		$this->app->singleton(App::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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     	
58 58
     	$this->app->singleton(
59 59
     			SQL::class,
60
-    			function ($app) {
60
+    			function($app) {
61 61
     				/**
62 62
     				 * Database Manager
63 63
     				 *
Please login to merge, or discard this patch.
src/System/Logo/LogoSettings.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@
 block discarded – undo
42 42
 		});
43 43
 
44 44
 		$logo->onUpload(function ($files) use ($form, $logo) {
45
-			if ($files === 'error')	return $form->error('logo', __('Error uploading image'));
45
+			if ($files === 'error') {
46
+				return $form->error('logo', __('Error uploading image'));
47
+			}
46 48
 			
47 49
 			$tmpPath = self::alias() . '/tmp/' . $files['name'];
48 50
 			
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			$logo->setThumbnailSrc(asset('storage/' . self::alias() . '/' . self::$defaultLogo));
49 49
 		});
50 50
 
51
-		$logo->onUpload(function ($files) use ($form, $logo) {
51
+		$logo->onUpload(function($files) use ($form, $logo) {
52 52
 			if ($files === 'error')	return $form->error('logo', __('Error uploading image'));
53 53
 			
54 54
 			$tmpPath = self::alias() . '/tmp/' . $files['name'];
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		});
60 60
 					
61 61
 		$form->onSubmit(function($form) {
62
-			if ($name = $form->model['custom_logo']? $form->model['logo']: null) {
62
+			if ($name = $form->model['custom_logo'] ? $form->model['logo'] : null) {
63 63
 				$storage = $this->storage();
64 64
 				$from = self::alias() . '/tmp/' . $name;
65 65
 				$to = self::alias() . '/' . $name;				
Please login to merge, or discard this patch.