Test Failed
Push — master ( 9287ab...2f3843 )
by Georgi
03:56
created
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.
src/Data/HasEpesiConnection.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,33 +41,33 @@
 block discarded – undo
41 41
 	 */
42 42
 	public static function pluck($value, $key = null)
43 43
 	{
44
-	    return collect(self::create()->export())->pluck($value, $key);
44
+		return collect(self::create()->export())->pluck($value, $key);
45 45
 	}
46 46
 	
47 47
 	// to be removed for atk4/data 2.0
48 48
 	public function addFields($fields = [], $defaults = [])
49 49
 	{
50
-	    foreach ($fields as $key => $field) {
51
-	        if (!is_int($key)) {
52
-	            // field name can be passed as array key
53
-	            $name = $key;
54
-	        } elseif (is_string($field)) {
55
-	            // or it can be simple string = field name
56
-	            $name = $field;
57
-	            $field = [];
58
-	        } elseif (is_array($field) && isset($field[0]) && is_string($field[0])) {
59
-	            // or field name can be passed as first element of seed array (old behaviour)
60
-	            $name = array_shift($field);
61
-	        } else {
62
-	            // some unsupported format, maybe throw exception here?
63
-	            continue;
64
-	        }
50
+		foreach ($fields as $key => $field) {
51
+			if (!is_int($key)) {
52
+				// field name can be passed as array key
53
+				$name = $key;
54
+			} elseif (is_string($field)) {
55
+				// or it can be simple string = field name
56
+				$name = $field;
57
+				$field = [];
58
+			} elseif (is_array($field) && isset($field[0]) && is_string($field[0])) {
59
+				// or field name can be passed as first element of seed array (old behaviour)
60
+				$name = array_shift($field);
61
+			} else {
62
+				// some unsupported format, maybe throw exception here?
63
+				continue;
64
+			}
65 65
 	        
66
-	        $seed = array_merge($defaults, (array) $field);
66
+			$seed = array_merge($defaults, (array) $field);
67 67
 	        
68
-	        $this->addField($name, $seed);
69
-	    }
68
+			$this->addField($name, $seed);
69
+		}
70 70
 	    
71
-	    return $this;
71
+		return $this;
72 72
 	}
73 73
 }
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
src/System/Seeds/Form.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	protected $validationRules = [];
18 18
 	
19 19
 	public function addElements($elements, $parent = null) {
20
-		$parent = $parent?: $this;
20
+		$parent = $parent ?: $this;
21 21
 		
22 22
 		foreach ($elements as $name => $desc) {
23 23
 			$name = $desc['name']?? $name;
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 			
27 27
 			switch ($desc['type']?? 'field') {
28 28
 				case 'field':
29
-					$desc = is_string($desc)? [
29
+					$desc = is_string($desc) ? [
30 30
 					'decorator' => [$desc]
31
-					]: $desc;
31
+					] : $desc;
32 32
 					
33 33
 					$field = $parent->addField($name, $desc['decorator']?? [], $desc['options']?? []);
34 34
 					
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 	
79 79
 	public function addFieldsDisplayRules($fieldsDisplayRules) {
80
-		$this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules?: [], $fieldsDisplayRules));
80
+		$this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules ?: [], $fieldsDisplayRules));
81 81
 	}
82 82
 	
83 83
 	public function addGroupDisplayRules($groupDisplayRules) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 	
91 91
 	public function addFieldRules($field, $rules = []) {
92
-		if (! $rules) return;
92
+		if (!$rules) return;
93 93
 		
94 94
 		$this->fieldRules[$field] = $rules['rules']?? [
95 95
 				'identifier' => $field,
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 				'fields' => $this->fieldRules
110 110
 		]);
111 111
 		
112
-		$this->onSubmit(function ($form) use ($callback) {
112
+		$this->onSubmit(function($form) use ($callback) {
113 113
 			$errors = [];
114
-			foreach ($this->validationRules?: [] as $ruleCallback) {
115
-				if (! is_callable($ruleCallback)) continue;
114
+			foreach ($this->validationRules ?: [] as $ruleCallback) {
115
+				if (!is_callable($ruleCallback)) continue;
116 116
 				
117 117
 				$ruleErrors = $ruleCallback($form);
118 118
 				
119
-				$errors = array_merge($errors, $ruleErrors?: []);
119
+				$errors = array_merge($errors, $ruleErrors ?: []);
120 120
 			}
121 121
 			
122
-			return $errors?: $callback($this);
122
+			return $errors ?: $callback($this);
123 123
 		});
124 124
 			
125 125
 			return $this;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	
133 133
 	public function confirmLeave($confirm = true)
134 134
 	{
135
-		$this->canLeave = ! $confirm;
135
+		$this->canLeave = !$confirm;
136 136
 		
137 137
 		return $this;
138 138
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,9 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 	
91 91
 	public function addFieldRules($field, $rules = []) {
92
-		if (! $rules) return;
92
+		if (! $rules) {
93
+			return;
94
+		}
93 95
 		
94 96
 		$this->fieldRules[$field] = $rules['rules']?? [
95 97
 				'identifier' => $field,
@@ -112,7 +114,9 @@  discard block
 block discarded – undo
112 114
 		$this->onSubmit(function ($form) use ($callback) {
113 115
 			$errors = [];
114 116
 			foreach ($this->validationRules?: [] as $ruleCallback) {
115
-				if (! is_callable($ruleCallback)) continue;
117
+				if (! is_callable($ruleCallback)) {
118
+					continue;
119
+				}
116 120
 				
117 121
 				$ruleErrors = $ruleCallback($form);
118 122
 				
Please login to merge, or discard this patch.
src/System/User/Database/Models/atk4/User.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class User extends Model
9 9
 {
10
-    use HasEpesiConnection;
10
+	use HasEpesiConnection;
11 11
     
12 12
 	public $table = 'users';
13 13
 	
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     
12 12
 	public $table = 'users';
13 13
 	
14
-	function init(){
14
+	function init() {
15 15
 		parent::init();
16 16
 		
17 17
 		$this->addFields(['name']);
Please login to merge, or discard this patch.
src/System/SystemCore.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
 	
25 25
 	public function migrate()
26 26
 	{
27
-	    Models\Module::migrate();
27
+		Models\Module::migrate();
28 28
 	    
29
-	    Models\Variable::migrate();
29
+		Models\Variable::migrate();
30 30
 	    
31
-	    return parent::migrate();
31
+		return parent::migrate();
32 32
 	}
33 33
 	
34 34
 }
Please login to merge, or discard this patch.
src/System/Models/Module.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 class Module extends Model
9 9
 {
10
-    use HasEpesiConnection;
10
+	use HasEpesiConnection;
11 11
     
12
-    public $table = 'modules';
12
+	public $table = 'modules';
13 13
     
14
-    function init() {
15
-        parent::init();
14
+	function init() {
15
+		parent::init();
16 16
         
17
-        $this->addFields([
18
-                'class',
19
-                'alias',
20
-                'priority' => ['default' => 0],
21
-                'state' => ['default' => 1]
22
-        ]);
23
-    }
17
+		$this->addFields([
18
+				'class',
19
+				'alias',
20
+				'priority' => ['default' => 0],
21
+				'state' => ['default' => 1]
22
+		]);
23
+	}
24 24
 }
Please login to merge, or discard this patch.
src/System/Models/Variable.php 3 patches
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	public $strict_types = false;
21 21
 	
22 22
 	private static function cache() {
23
-		if(isset(self::$variables)) return;
23
+		if(isset(self::$variables)) {
24
+			return;
25
+		}
24 26
 		
25 27
 		self::$variables = self::pluck('value', 'name');
26 28
 	}
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
 	public static function recall($name, $default = null) {
46 48
 		self::cache();
47 49
 		
48
-		if (! self::$variables->has($name)) return $default;
50
+		if (! self::$variables->has($name)) {
51
+			return $default;
52
+		}
49 53
 		
50 54
 		return self::$variables->get($name, $default)?? $default;
51 55
 	}
@@ -65,8 +69,7 @@  discard block
 block discarded – undo
65 69
 		
66 70
 		if ($variable->loaded()) {
67 71
 		    $variable->save(compact('value'));
68
-		}
69
-		else {
72
+		} else {
70 73
 		    $variable->insert(compact('name', 'value'));
71 74
 		}
72 75
 	}
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Variable extends Model
10 10
 {
11
-    use HasEpesiConnection;
11
+	use HasEpesiConnection;
12 12
     
13 13
 	/**
14 14
 	 * @var Collection
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 	}
27 27
 	
28 28
 	public function init() {
29
-	    parent::init();
29
+		parent::init();
30 30
 	    
31
-	    $this->addFields([
32
-	            'name',
33
-	            'value' => ['type' => 'text', 'serialize' => 'base64']
34
-	    ]);
31
+		$this->addFields([
32
+				'name',
33
+				'value' => ['type' => 'text', 'serialize' => 'base64']
34
+		]);
35 35
 	}
36 36
 	
37 37
 	public static function recall($name, $default = null) {
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 		$variable = self::create()->addCondition('name', $name)->tryLoadAny();
57 57
 
58 58
 		if ($variable->loaded()) {
59
-		    $variable->save(compact('value'));
59
+			$variable->save(compact('value'));
60 60
 		}
61 61
 		else {
62
-		    $variable->insert(compact('name', 'value'));
62
+			$variable->insert(compact('name', 'value'));
63 63
 		}
64 64
 	}
65 65
 	
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	public $strict_types = false;
21 21
 	
22 22
 	private static function cache() {
23
-		if(isset(self::$variables)) return;
23
+		if (isset(self::$variables)) return;
24 24
 		
25 25
 		self::$variables = self::pluck('value', 'name');
26 26
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	public static function recall($name, $default = null) {
38 38
 		self::cache();
39 39
 		
40
-		if (! self::$variables->has($name)) return $default;
40
+		if (!self::$variables->has($name)) return $default;
41 41
 		
42 42
 		return self::$variables->get($name, $default)?? $default;
43 43
 	}
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 		}
64 64
 	}
65 65
 	
66
-	public static function forget($name, $throwError=true) {
66
+	public static function forget($name, $throwError = true) {
67 67
 		self::cache();
68 68
 		
69
-		if (! self::$variables->has($name) && $throwError) {
69
+		if (!self::$variables->has($name) && $throwError) {
70 70
 			throw new \Exception('No such variable in database: ' . $name);
71 71
 		}
72 72
 		
Please login to merge, or discard this patch.