Test Failed
Push — master ( 8f2167...5d2217 )
by Georgi
08:27
created
src/App.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		//TODO: set the skin from admin / user selection
34 34
 		$this->skin = config('epesi.app.skin', $this->skin);
35 35
 
36
-		$this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir?: []);
36
+		$this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir ?: []);
37 37
 	}
38 38
 	
39 39
 	final public static function module()
@@ -87,35 +87,35 @@  discard block
 block discarded – undo
87 87
 		
88 88
 		// jQuery
89 89
 		$urlJs = $this->cdn['jquery']?? $localJs;
90
-		$this->requireJS($urlJs.'/jquery.min.js');
90
+		$this->requireJS($urlJs . '/jquery.min.js');
91 91
 		
92 92
 		// Semantic UI
93 93
 		$urlJs = $this->cdn['semantic-ui']?? $localJs;
94 94
 		$urlCss = $this->cdn['semantic-ui']?? $localCss;
95
-		$this->requireJS($urlJs.'/semantic.min.js');
96
-		$this->requireCSS($urlCss.'/semantic.min.css');
95
+		$this->requireJS($urlJs . '/semantic.min.js');
96
+		$this->requireCSS($urlCss . '/semantic.min.css');
97 97
 		
98 98
 		// Serialize Object
99 99
 		$urlJs = $this->cdn['serialize-object']?? $localJs;
100
-		$this->requireJS($urlJs.'/jquery.serialize-object.min.js');
100
+		$this->requireJS($urlJs . '/jquery.serialize-object.min.js');
101 101
 		
102 102
 		// Agile UI
103 103
 		$urlJs = $this->cdn['atk']?? $localJs;
104 104
 		$urlCss = $this->cdn['atk']?? $localCss;
105
-		$this->requireJS($urlJs.'/atkjs-ui.min.js');
106
-		$this->requireCSS($urlCss.'/agileui.css');
105
+		$this->requireJS($urlJs . '/atkjs-ui.min.js');
106
+		$this->requireCSS($urlCss . '/agileui.css');
107 107
 		
108 108
 		// Draggable
109 109
 		$urlJs = $this->cdn['draggable']?? $localJs;
110
-		$this->requireJS($urlJs.'/draggable.bundle.js');
110
+		$this->requireJS($urlJs . '/draggable.bundle.js');
111 111
 		
112 112
 		// jQuery niceScroll	
113 113
 		$urlJs = $this->cdn['jquery-nicescroll']?? $localJs;
114
-		$this->requireJS($urlJs.'/jquery.nicescroll.js');
114
+		$this->requireJS($urlJs . '/jquery.nicescroll.js');
115 115
 		
116 116
 		// clipboard.js
117 117
 		$urlJs = $this->cdn['clipboardjs']?? $localJs;
118
-		$this->requireJS($urlJs.'/clipboard.js');
118
+		$this->requireJS($urlJs . '/clipboard.js');
119 119
 	}
120 120
 	
121 121
 	public function addCsrfToken()
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		
193 193
 		$key = md5(serialize(func_get_args()));
194 194
 		
195
-		if (! isset($cache[$key])) {
195
+		if (!isset($cache[$key])) {
196 196
 			$cache[$key] = true;
197 197
 			
198 198
 			parent::requireJS($url, $isAsync, $isDefer);
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -83,43 +83,43 @@
 block discarded – undo
83 83
 	
84 84
 	public function renderException($exception)
85 85
 	{
86
-	    ob_start();
87
-	    if ($exception instanceof TokenMismatchException) {
88
-	        $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...'));
89
-	    }
90
-	    elseif ($exception instanceof NotFoundHttpException) {
91
-	        $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...'));
92
-	    }	    
93
-	    else {
94
-	        $this->caughtException($exception);
95
-	    }
86
+		ob_start();
87
+		if ($exception instanceof TokenMismatchException) {
88
+			$this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...'));
89
+		}
90
+		elseif ($exception instanceof NotFoundHttpException) {
91
+			$this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...'));
92
+		}	    
93
+		else {
94
+			$this->caughtException($exception);
95
+		}
96 96
 	    
97
-	    return ob_get_clean();
97
+		return ob_get_clean();
98 98
 	}
99 99
 	
100 100
 	public function jsRedirectHomepage($message)
101 101
 	{
102
-	    $homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser());
102
+		$homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser());
103 103
 	    
104
-	    $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender();
104
+		$redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender();
105 105
 	    
106
-	    if ($this->isJsonRequest()) {
107
-	        $this->outputResponseJSON([
108
-	                'success'   => true,
109
-	                'message'   => $message,
110
-	                'atkjs'   => $redirectJs
111
-	        ]);
112
-	    }
113
-	    else {
114
-	        $this->outputResponseHTML('<script>' . $redirectJs . '</script>');
115
-	    }
106
+		if ($this->isJsonRequest()) {
107
+			$this->outputResponseJSON([
108
+					'success'   => true,
109
+					'message'   => $message,
110
+					'atkjs'   => $redirectJs
111
+			]);
112
+		}
113
+		else {
114
+			$this->outputResponseHTML('<script>' . $redirectJs . '</script>');
115
+		}
116 116
 	}
117 117
 	
118 118
 	public function jsRedirectConfirm($page, $message)
119 119
 	{
120
-	    $redirectJs = $this->jsRedirect($page)->jsRender();
120
+		$redirectJs = $this->jsRedirect($page)->jsRender();
121 121
 	    
122
-	    return new jsExpression("if (confirm([])) { $redirectJs }", [$message]);
122
+		return new jsExpression("if (confirm([])) { $redirectJs }", [$message]);
123 123
 	}
124 124
 	
125 125
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,11 +86,9 @@  discard block
 block discarded – undo
86 86
 	    ob_start();
87 87
 	    if ($exception instanceof TokenMismatchException) {
88 88
 	        $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...'));
89
-	    }
90
-	    elseif ($exception instanceof NotFoundHttpException) {
89
+	    } elseif ($exception instanceof NotFoundHttpException) {
91 90
 	        $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...'));
92
-	    }	    
93
-	    else {
91
+	    } else {
94 92
 	        $this->caughtException($exception);
95 93
 	    }
96 94
 	    
@@ -109,8 +107,7 @@  discard block
 block discarded – undo
109 107
 	                'message'   => $message,
110 108
 	                'atkjs'   => $redirectJs
111 109
 	        ]);
112
-	    }
113
-	    else {
110
+	    } else {
114 111
 	        $this->outputResponseHTML('<script>' . $redirectJs . '</script>');
115 112
 	    }
116 113
 	}
Please login to merge, or discard this patch.
src/Data/Persistence/SQL.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 class SQL extends \atk4\data\Persistence\SQL
9 9
 {
10
-    /**
11
-     * Take a laravel connection and pass it to ATK Data
12
-     *
13
-     * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager
14
-     *
15
-     * @return \atk4\data\Persistence_SQL
16
-     * @throws \atk4\data\Exception
17
-     * @throws \atk4\dsql\Exception
18
-     */
19
-    public function __construct(DatabaseManager $database)
20
-    {
21
-    	parent::__construct(Connection::connect($database->connection()->getPdo()));
22
-    }
10
+	/**
11
+	 * Take a laravel connection and pass it to ATK Data
12
+	 *
13
+	 * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager
14
+	 *
15
+	 * @return \atk4\data\Persistence_SQL
16
+	 * @throws \atk4\data\Exception
17
+	 * @throws \atk4\dsql\Exception
18
+	 */
19
+	public function __construct(DatabaseManager $database)
20
+	{
21
+		parent::__construct(Connection::connect($database->connection()->getPdo()));
22
+	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
src/Helpers/Utils.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class Utils
6 6
 {
7
-    public static function bytesToHuman($bytes)
8
-    {
9
-        $units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')];
7
+	public static function bytesToHuman($bytes)
8
+	{
9
+		$units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')];
10 10
 
11
-        for ($i = 0; $bytes > 1024; $i++) {
12
-            $bytes /= 1024;
13
-        }
11
+		for ($i = 0; $bytes > 1024; $i++) {
12
+			$bytes /= 1024;
13
+		}
14 14
 
15
-        return round($bytes, 2) . ' ' . $units[$i];
16
-    }
15
+		return round($bytes, 2) . ' ' . $units[$i];
16
+	}
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/System/User/Access/AccessSettings.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	
36 36
 	protected function showEditPermissions()
37 37
 	{
38
-		$permissionsData = Permission::all(['id', 'name'])->map(function($permission){
38
+		$permissionsData = Permission::all(['id', 'name'])->map(function($permission) {
39 39
 			$permission['name'] = trans(ucwords($permission['name']));
40 40
 			
41 41
 			return $permission;
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	
100 100
 	protected function columns()
101 101
 	{
102
-		return $this->columns = $this->columns?: $this->add('Columns');
102
+		return $this->columns = $this->columns ?: $this->add('Columns');
103 103
 	}
104 104
 	
105 105
 	protected function permissionId()
106 106
 	{
107
-		return $this->app->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission');
107
+		return $this->app->stickyGet($this->columns()->name) ?: $this->getModuleVariable('permission');
108 108
 	}
109 109
 	
110 110
 	protected function reload($permissionExpression = null)
111 111
 	{
112 112
 		$columns = $this->columns();
113 113
 		
114
-		return $this->reload = $this->reload?: new jsReload($columns, [$columns->name => $permissionExpression?: '']);
114
+		return $this->reload = $this->reload ?: new jsReload($columns, [$columns->name => $permissionExpression ?: '']);
115 115
 	}
116 116
 	
117 117
 	protected function getModel($array)
Please login to merge, or discard this patch.
tests/ModuleManagerTest.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@
 block discarded – undo
8 8
 
9 9
 class ModuleManagerTest extends TestCase
10 10
 {
11
-    /**
12
-     * Setup the test environment.
13
-     */
14
-    protected function setUp(): void
15
-    {
16
-        parent::setUp();
11
+	/**
12
+	 * Setup the test environment.
13
+	 */
14
+	protected function setUp(): void
15
+	{
16
+		parent::setUp();
17 17
         
18
-        config([
19
-                'epesi.modules' => [
20
-                        '\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']),
21
-                ]
22
-        ]);
18
+		config([
19
+				'epesi.modules' => [
20
+						'\\Epesi\\Core\\' => __DIR__ . implode(DIRECTORY_SEPARATOR, ['..', '..', 'src']),
21
+				]
22
+		]);
23 23
         
24
-        ModuleManager::install('system');
25
-    }
24
+		ModuleManager::install('system');
25
+	}
26 26
     
27
-    public function testContentStorage()
28
-    {
29
-        $installedModules = ModuleManager::getInstalled();
27
+	public function testContentStorage()
28
+	{
29
+		$installedModules = ModuleManager::getInstalled();
30 30
         
31
-        $this->assertArrayHasKey('system', $installedModules, 'System module not installed');
32
-    }
31
+		$this->assertArrayHasKey('system', $installedModules, 'System module not installed');
32
+	}
33 33
     
34 34
 
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
tests/VariablesTest.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,41 +7,41 @@
 block discarded – undo
7 7
 
8 8
 class VariablesTest extends TestCase
9 9
 {
10
-    /**
11
-     * Setup the test environment.
12
-     */
13
-    protected function setUp(): void
14
-    {
15
-        parent::setUp();
10
+	/**
11
+	 * Setup the test environment.
12
+	 */
13
+	protected function setUp(): void
14
+	{
15
+		parent::setUp();
16 16
 
17
-        Variable::migrate();
18
-    }
17
+		Variable::migrate();
18
+	}
19 19
     
20
-    public function testVariableStorage()
21
-    {
22
-        $varString = 'test';
20
+	public function testVariableStorage()
21
+	{
22
+		$varString = 'test';
23 23
         
24
-        Variable::memorize('testString', $varString);
24
+		Variable::memorize('testString', $varString);
25 25
         
26
-        $this->assertEquals($varString, Variable::recall('testString'), 'String variable not stored correctly in database');
26
+		$this->assertEquals($varString, Variable::recall('testString'), 'String variable not stored correctly in database');
27 27
         
28
-        Variable::forget('testString');
28
+		Variable::forget('testString');
29 29
         
30
-        $this->assertEmpty(Variable::recall('testString'), 'String variable not cleared correctly from database');
30
+		$this->assertEmpty(Variable::recall('testString'), 'String variable not cleared correctly from database');
31 31
         
32
-        $varArray = [
33
-                'aa' => 'test1',
34
-                'bb' => 'test2'
35
-        ];
32
+		$varArray = [
33
+				'aa' => 'test1',
34
+				'bb' => 'test2'
35
+		];
36 36
         
37
-        Variable::memorize('testArray', $varArray);
37
+		Variable::memorize('testArray', $varArray);
38 38
         
39
-        $this->assertEquals($varArray, Variable::recall('testArray'), 'Array variable not stored correctly in database');
39
+		$this->assertEquals($varArray, Variable::recall('testArray'), 'Array variable not stored correctly in database');
40 40
         
41
-        Variable::forget('testArray');
41
+		Variable::forget('testArray');
42 42
         
43
-        $this->assertEmpty(Variable::recall('testArray'), 'String variable not cleared correctly from database');
44
-    }
43
+		$this->assertEmpty(Variable::recall('testArray'), 'String variable not cleared correctly from database');
44
+	}
45 45
     
46 46
 
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/HomePage/HomePageSettings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 		
31 31
 		$grid->setModel(HomePage::create());
32 32
 
33
-		$grid->addDragHandler()->onReorder(function ($order) {
33
+		$grid->addDragHandler()->onReorder(function($order) {
34 34
 			foreach (HomePage::create() as $homepage) {
35 35
 				$homepage->save(['priority' => array_search($homepage['id'], $order)]);
36 36
 			}
Please login to merge, or discard this patch.
src/HomePage/Models/HomePage.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 class HomePage extends Model
12 12
 {
13
-    use HasEpesiConnection;
13
+	use HasEpesiConnection;
14 14
     
15 15
 	public $table = 'home_pages';
16 16
 	
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		parent::init();
30 30
 		
31 31
 		$this->addFields([
32
-		        'path' => [
32
+				'path' => [
33 33
 						'type' => 'enum',
34 34
 						'caption' => __('Page'),
35 35
 						'values' => self::list(),
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 								'filter' => true
41 41
 						],
42 42
 				],
43
-		        'role' => [
43
+				'role' => [
44 44
 						'type' => 'enum', 
45 45
 						'caption' => __('Role'), 
46 46
 						'values' => Role::get()->pluck('name', 'name')->all(), 
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 								'filter' => true
49 49
 						]
50 50
 				],
51
-		        'date' => [
51
+				'date' => [
52 52
 						'type' => 'date', 
53 53
 						'caption' => __('Date'),
54
-		                'never_persist' => true,
54
+						'never_persist' => true,
55 55
 						'ui' => [
56 56
 								'filter' => true
57 57
 						]
58 58
 				],
59 59
 				'priority' => [
60
-				        'default' => 0
60
+						'default' => 0
61 61
 				],
62 62
 		]);
63 63
 		
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->setOrder('priority');
65 65
 
66 66
 		$this->addHook('beforeInsert', function($model, & $data) {
67
-			$data['priority'] = $data['priority']?: $this->action('fx', ['max', 'priority'])->getOne() + 1;
67
+			$data['priority'] = $data['priority'] ?: $this->action('fx', ['max', 'priority'])->getOne() + 1;
68 68
 		});
69 69
 	}
70 70
 	
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	{
78 78
 		static $cache;
79 79
 		
80
-		if (! isset($cache)) {
80
+		if (!isset($cache)) {
81 81
 			$cache = [];
82 82
 			foreach (HomePageJoint::collect() as $joint) {
83 83
 				$cache[$joint->link()] = $joint->caption();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public static function ofUser()
96 96
 	{
97
-		if (! $user = Auth::user()) return;
97
+		if (!$user = Auth::user()) return;
98 98
 		
99 99
 		return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny();
100 100
 	}
@@ -106,6 +106,6 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public static function pathOfUser()
108 108
 	{
109
-		return HomePage::ofUser()['path']?: self::$defaultPath;
109
+		return HomePage::ofUser()['path'] ?: self::$defaultPath;
110 110
 	}
111 111
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@
 block discarded – undo
94 94
 	 */
95 95
 	public static function ofUser()
96 96
 	{
97
-		if (! $user = Auth::user()) return;
97
+		if (! $user = Auth::user()) {
98
+			return;
99
+		}
98 100
 		
99 101
 		return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny();
100 102
 	}
Please login to merge, or discard this patch.
src/HomePage/HomePageCore.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
 	
22 22
 	public function install()
23 23
 	{
24
-	    Models\HomePage::migrate();
24
+		Models\HomePage::migrate();
25 25
 	    
26 26
 		// setup default home pages
27 27
 		Models\HomePage::create()->import([
28
-	    		[
29
-			    		'path' => 'view/dashboard',
30
-			    		'role' => 'Super Admin'
31
-	    		],
28
+				[
29
+						'path' => 'view/dashboard',
30
+						'role' => 'Super Admin'
31
+				],
32 32
 				[
33 33
 						'path' => 'view/dashboard',
34 34
 						'role' => 'Employee'
Please login to merge, or discard this patch.