Passed
Push — develop ( 319bd8...330c7a )
by Neill
16:41 queued 15s
created
neon/core/grid/column/Button.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param array $options - additional html attribute options
32 32
 	 * @return $this
33 33
 	 */
34
-	public function setEdit($url, array $options=[])
34
+	public function setEdit($url, array $options = [])
35 35
 	{
36 36
 		$this->_buttons['edit'] = $options;
37 37
 		$this->_buttons['edit']['url'] = $url;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param array|string $url
44 44
 	 * @param array $options - additional html attribute options
45 45
 	 */
46
-	public function setDelete($url, array $options=[])
46
+	public function setDelete($url, array $options = [])
47 47
 	{
48 48
 		$this->_buttons['delete'] = $options;
49 49
 		$this->_buttons['delete']['url'] = $url;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *   will append text to the CSS class e.g. btn-$type
60 60
 	 * @param array $options - passed to Html::buttonCustom
61 61
 	 */
62
-	public function addButton($key, $url, $text, $icon='', $class='', $options=[])
62
+	public function addButton($key, $url, $text, $icon = '', $class = '', $options = [])
63 63
 	{
64 64
 		$this->_buttons[$key] = array_merge(compact('url', 'text', 'icon', 'class'), $options);
65 65
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function getWidth()
85 85
 	{
86
-		return 'calc(' . (count($this->_buttons)+count($this->_actions)) . ' * ' .$this->buttonWidth . ')';
86
+		return 'calc('.(count($this->_buttons) + count($this->_actions)).' * '.$this->buttonWidth.')';
87 87
 	}
88 88
 
89 89
 	/**
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 				if (!isset($btnOps['data']))
98 98
 					$btnOps['data'] = [];
99 99
 				if ($this->getGrid()->hasIndexColumn())
100
-					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
100
+					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()]];
101 101
 				$func = 'buttonCustom';
102 102
 				if ($buttonKey === 'delete') {
103 103
 					$func = 'buttonDelete';
104
-					$btnOps['data'] = Arr::merge($btnOps['data'], ['data'=> ['delete-ajax' => true ]]);
104
+					$btnOps['data'] = Arr::merge($btnOps['data'], ['data'=> ['delete-ajax' => true]]);
105 105
 				}
106 106
 				if ($buttonKey === 'edit') {
107 107
 					$func = 'buttonEdit';
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				$text = Arr::remove($btnOps, 'text', '');
110 110
 				$url = Arr::remove($btnOps, 'url', '');
111 111
 				$url = $this->grid->replaceRowTagsWithValues($url, $model);
112
-				$btnOps['class'] = Arr::get($btnOps, 'class', '') . ' btn-grid';
112
+				$btnOps['class'] = Arr::get($btnOps, 'class', '').' btn-grid';
113 113
 				$buttons[] = Html::$func($url, $text, $btnOps);
114 114
 			}
115
-			return '<div class="btn-group btn-column">' . implode('', $buttons) . '</div>';
115
+			return '<div class="btn-group btn-column">'.implode('', $buttons).'</div>';
116 116
 		}
117 117
 	}
118 118
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,10 +94,12 @@
 block discarded – undo
94 94
 		if (count($this->_buttons)) {
95 95
 			$buttons = [];
96 96
 			foreach ($this->_buttons as $buttonKey => $btnOps) {
97
-				if (!isset($btnOps['data']))
98
-					$btnOps['data'] = [];
99
-				if ($this->getGrid()->hasIndexColumn())
100
-					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
97
+				if (!isset($btnOps['data'])) {
98
+									$btnOps['data'] = [];
99
+				}
100
+				if ($this->getGrid()->hasIndexColumn()) {
101
+									$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
102
+				}
101 103
 				$func = 'buttonCustom';
102 104
 				if ($buttonKey === 'delete') {
103 105
 					$func = 'buttonDelete';
Please login to merge, or discard this patch.
neon/user/migrations/develop/__m20200720_143700_user_make_id_the_uuid.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 
23 23
 		$apiTokens = UserApiToken::find()->all();
24 24
 		$tableApiToken = UserApiToken::tableName();
25
-		foreach($apiTokens as $apiToken) {
25
+		foreach ($apiTokens as $apiToken) {
26 26
 			$this->execute("UPDATE $tableApiToken SET user_id = :uuid where user_id = :id", [
27 27
 				':uuid' =>  $idToUuuid->get($apiToken->user_id),
28 28
 				':id' =>  $apiToken->user_id
29 29
 			]);
30 30
 		}
31 31
 		$tableUser = User::tableName();
32
-		foreach($users as $user) {
32
+		foreach ($users as $user) {
33 33
 			$this->execute("UPDATE $tableUser SET id = :uuid, old_id = :id where id = :id", [
34 34
 				':uuid' => $idToUuuid->get($user->id),
35 35
 				':id' => $user->id
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$authTable = \neon\user\models\AuthAssignment::tableName();
40 40
 		$authAssignments = \neon\user\models\AuthAssignment::find()->all();
41
-		foreach($authAssignments as $auth) {
41
+		foreach ($authAssignments as $auth) {
42 42
 			$this->execute("UPDATE $authTable SET user_id = :uuid where user_id = :id", [
43 43
 				':uuid' => $idToUuuid->get($auth->user_id),
44 44
 				':id' => $auth->user_id
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$tableFfs = \neon\firefly\services\fileManager\models\FileManager::tableName();
51 51
 		$this->alterColumn($tableFfs, 'created_by', $this->uuid64());
52 52
 		$this->alterColumn($tableFfs, 'updated_by', $this->uuid64());
53
-		foreach($ffs as $f) {
53
+		foreach ($ffs as $f) {
54 54
 			$this->execute("UPDATE $tableFfs SET created_by = :uuid where created_by = :id", [
55 55
 				':uuid' => $idToUuuid->get($f->created_by),
56 56
 				':id' => $f->created_by
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 
74 74
 		$apiTokens = UserApiToken::find()->all();
75 75
 		$tableApiToken = UserApiToken::tableName();
76
-		foreach($apiTokens as $apiToken) {
76
+		foreach ($apiTokens as $apiToken) {
77 77
 			$this->execute("UPDATE $tableApiToken SET user_id = :id where user_id = :uuid", [
78 78
 				':id' =>  $uuidToId->get($apiToken->user_id),
79 79
 				':uuid' =>  $apiToken->user_id
80 80
 			]);
81 81
 		}
82 82
 
83
-		foreach($users as $user) {
83
+		foreach ($users as $user) {
84 84
 			$this->execute("UPDATE $tableUser SET id = :id where id = :uuid", [
85 85
 				':id' => $uuidToId->get($user->id),
86 86
 				':uuid' => $user->id
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$authTable = \neon\user\models\AuthAssignment::tableName();
91 91
 		$authAssignments = \neon\user\models\AuthAssignment::find()->all();
92
-		foreach($authAssignments as $auth) {
92
+		foreach ($authAssignments as $auth) {
93 93
 			$this->execute("UPDATE $authTable SET user_id = :id where user_id = :uuid", [
94 94
 				':id' => $uuidToId->get($auth->user_id),
95 95
 				':uuid' => $auth->user_id
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// update firefly created_by and updated_by
100 100
 		$ffs = \neon\firefly\services\fileManager\models\FileManager::find()->all();
101 101
 		$tableFfs = \neon\firefly\services\fileManager\models\FileManager::tableName();
102
-		foreach($ffs as $f) {
102
+		foreach ($ffs as $f) {
103 103
 			$this->execute("UPDATE $tableFfs SET created_by = :id where created_by = :uuid", [
104 104
 				':id' => $uuidToId->get($f->created_by),
105 105
 				':uuid' => $f->created_by
Please login to merge, or discard this patch.
neon/core/web/FilterGlobalPassword.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$niceId = setting('core', 'global_password_holding_page', '');
64 64
 			$page = neon()->cms->getPage();
65 65
 			// check the page with the nice_id exists
66
-			if (! $page->setById($niceId)) throw new \yii\web\HttpException(404, 'No page found');
66
+			if (!$page->setById($niceId)) throw new \yii\web\HttpException(404, 'No page found');
67 67
 			neon()->response->content = $page->render();
68 68
 			//return false;
69 69
 			return true;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		// No holding page niceId has been given so display a standard password screen
101 101
 		neon()->response->content = neon()->view->render('@neon/core/views/global-password.php', [
102 102
 			'passwordParam' => $this->passwordParam,
103
-			'incorrectPassword' => ($this->getSuppliedPassword()!==null)
103
+			'incorrectPassword' => ($this->getSuppliedPassword() !== null)
104 104
 		]);
105 105
 	}
106 106
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,16 +34,19 @@  discard block
 block discarded – undo
34 34
 	public function beforeAction($action)
35 35
 	{
36 36
 		// If the global password option is not set then return - and continue as normal
37
-		if (setting('core', 'global_password_enabled', false) === 0)
38
-			return true;
37
+		if (setting('core', 'global_password_enabled', false) === 0) {
38
+					return true;
39
+		}
39 40
 		// If the global password is set - still allow the following app controller paths to work.
40 41
 		if (neon()->request->isRoute('/admin*') || neon()->request->isRoute('/user/*') || neon()->request->isRoute('/settings*')) {
41 42
 			return true;
42 43
 		}
43
-		if ($this->passwordIsValid())
44
-			return true;
45
-		if ($this->shouldDisplayHoldingPage())
46
-			return false;
44
+		if ($this->passwordIsValid()) {
45
+					return true;
46
+		}
47
+		if ($this->shouldDisplayHoldingPage()) {
48
+					return false;
49
+		}
47 50
 		$this->displayGlobalPasswordPage();
48 51
 		return false;
49 52
 	}
@@ -63,7 +66,9 @@  discard block
 block discarded – undo
63 66
 			$niceId = setting('core', 'global_password_holding_page', '');
64 67
 			$page = neon()->cms->getPage();
65 68
 			// check the page with the nice_id exists
66
-			if (! $page->setById($niceId)) throw new \yii\web\HttpException(404, 'No page found');
69
+			if (! $page->setById($niceId)) {
70
+				throw new \yii\web\HttpException(404, 'No page found');
71
+			}
67 72
 			neon()->response->content = $page->render();
68 73
 			//return false;
69 74
 			return true;
Please login to merge, or discard this patch.
neon/core/console/PublishController.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 	 * Useful git command:
47 47
 	 * Under some circumstances you may discover an error or a minor change after publishing.
48 48
 	 * In order to up issue the current version without changing the number you have to delete the tag:
49
-		 * `git push --delete origin v2.0.2 && git tag -d v2.0.2`
49
+	 * `git push --delete origin v2.0.2 && git tag -d v2.0.2`
50 50
 	 * Note that in most circumstances its easier and preferable just to increment the patch number.
51 51
 	 *
52 52
 	 * @return boolean successful publish
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 		// Check the version number conforms to semver format - 2.0.1 or 3.0.0[-beta][+build]
62 62
 		if (!preg_match('/^[0-9]+\.[0-9]+\.[0-9]+([-+].*)?$/', $version, $match)) {
63
-			$this->stderr("!! The version number is not a valid version it must be in the format '#.#.#' or '#.#.#[-description][+build]'.\n",  Console::FG_RED);
63
+			$this->stderr("!! The version number is not a valid version it must be in the format '#.#.#' or '#.#.#[-description][+build]'.\n", Console::FG_RED);
64 64
 			return ExitCode::UNSPECIFIED_ERROR;
65 65
 		}
66 66
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 		// Check to see if the javascript has been built since changing
77 77
 		if (!$this->confirm("=> Have you run the neon build process?\n")) {
78
-			$this->stdout("-> Please run the build process before continuing! =>./neo core/build/neon\n",  Console::FG_CYAN);
78
+			$this->stdout("-> Please run the build process before continuing! =>./neo core/build/neon\n", Console::FG_CYAN);
79 79
 			return ExitCode::UNSPECIFIED_ERROR;
80 80
 		}
81 81
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		// need to make sure that the version to update to is specified and checked in, in the composer.json file
84 84
 		// this ensures the tag will have the correct version listed
85 85
 		if (!$this->confirm("=> Are your tests passing?\n")) {
86
-			$this->stdout("-> Please run all of the tests! =>./codecept run\n",  Console::FG_CYAN);
86
+			$this->stdout("-> Please run all of the tests! =>./codecept run\n", Console::FG_CYAN);
87 87
 			return ExitCode::UNSPECIFIED_ERROR;
88 88
 		}
89 89
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 		$process->wait();
101 101
 		$gitVersions = explode("\n", $process->getOutput());
102 102
 		$versions = [];
103
-		foreach($gitVersions as $v) {
104
-			$v = substr($v, strrpos($v, "/")+1);
103
+		foreach ($gitVersions as $v) {
104
+			$v = substr($v, strrpos($v, "/") + 1);
105 105
 			if ($v == '') continue;
106
-			$versions[] = $v ;
106
+			$versions[] = $v;
107 107
 		}
108 108
 		if (in_array($version, $versions)) {
109 109
 			if (!$this->force) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@
 block discarded – undo
102 102
 		$versions = [];
103 103
 		foreach($gitVersions as $v) {
104 104
 			$v = substr($v, strrpos($v, "/")+1);
105
-			if ($v == '') continue;
105
+			if ($v == '') {
106
+				continue;
107
+			}
106 108
 			$versions[] = $v ;
107 109
 		}
108 110
 		if (in_array($version, $versions)) {
Please login to merge, or discard this patch.
neon/cms/components/Daedalus.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @param array $params  any paramters from @see dds and dds_choice
176 176
 	 * @param object $renderer  the render object
177 177
 	 */
178
-	public function __construct($params, $renderer=null)
178
+	public function __construct($params, $renderer = null)
179 179
 	{
180 180
 		$this->params = $params;
181 181
 		$this->renderer = $renderer;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$request = self::convertDataRequestToJson($this->params['data']);
201 201
 			$responded = neon()->cms->getPage()->requestWidgetData($request, $data, $id, false, $meta);
202 202
 			if ($responded) {
203
-				$result['hasData'] = count($data)>0;
203
+				$result['hasData'] = count($data) > 0;
204 204
 				$result['hasResponse'] = true;
205 205
 				$result['data'] = $data;
206 206
 				$result['meta'] = $meta;
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
 	 * @return null|errors|array  returns errors if not valid, null if called
226 226
 	 *   from within a template and the data if from within a plugin
227 227
 	 */
228
-	protected function queryChoice($template=true)
228
+	protected function queryChoice($template = true)
229 229
 	{
230 230
 		// check usage
231 231
 		if (!isset($this->params['member']))
232
-			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
232
+			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params, true);
233 233
 		if ($this->renderer && !isset($this->params['assign']))
234
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
235
-		if (strpos($this->params['member'],':') === false && !isset($this->params['class']))
234
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
235
+		if (strpos($this->params['member'], ':') === false && !isset($this->params['class']))
236 236
 			return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
237 237
 
238 238
 		// extract out class and member
239 239
 		$class = null;
240 240
 		$member = null;
241
-		if (strpos($this->params['member'],':') !== false)
242
-			list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
241
+		if (strpos($this->params['member'], ':') !== false)
242
+			list ($class, $member) = explode(':', str_replace('::', ':', $this->params['member']));
243 243
 		else {
244 244
 			$class = $this->params['class'];
245 245
 			$member = $this->params['member'];
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	{
288 288
 		// check usage
289 289
 		if (!isset($this->params['class']))
290
-			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
290
+			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params, true);
291 291
 
292 292
 		if ($this->renderer && !isset($this->params['assign']))
293
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
293
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
294 294
 
295 295
 		$fields = isset($this->params['fields']) ? $this->params['fields'] : [];
296 296
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				if (is_array($dps['dds_filter']))
389 389
 					$filters[] = json_encode($dps['dds_filter']);
390 390
 				// else deprecated json approach
391
-				else if (strpos(trim($dps['dds_filter']), '[')!==0)
391
+				else if (strpos(trim($dps['dds_filter']), '[') !== 0)
392 392
 					$filters[] = "[$dps[dds_filter]]";
393 393
 				else
394 394
 					$filters[] = $dps['dds_filter'];
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 			// create the filters clause
398 398
 			if (count($filters))
399
-				$data[] = "'filters':".implode(',',$filters);
399
+				$data[] = "'filters':".implode(',', $filters);
400 400
 
401 401
 			// sort out the order
402 402
 			if (isset($dps['dds_order'])) {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 				$classType = $d['_class_type'];
464 464
 				foreach ($d as $field=>$value) {
465 465
 					// ignore all bookkeeping fields
466
-					if (strpos($field, '_')===0)
466
+					if (strpos($field, '_') === 0)
467 467
 						continue;
468 468
 					$edit[$i][$field] = self::createFieldEditable($classType, $field, $d['_uuid'], $value);
469 469
 				}
Please login to merge, or discard this patch.
Braces   +91 added lines, -66 removed lines patch added patch discarded remove patch
@@ -209,10 +209,11 @@  discard block
 block discarded – undo
209 209
 				// $result['edit'] = $this->createEditable($data);
210 210
 			}
211 211
 		}
212
-		if ($this->renderer)
213
-			$this->renderer->assign($this->params['assign'], $result);
214
-		else
215
-			return $result;
212
+		if ($this->renderer) {
213
+					$this->renderer->assign($this->params['assign'], $result);
214
+		} else {
215
+					return $result;
216
+		}
216 217
 	}
217 218
 
218 219
 	/**
@@ -230,19 +231,22 @@  discard block
 block discarded – undo
230 231
 	protected function queryChoice($template=true)
231 232
 	{
232 233
 		// check usage
233
-		if (!isset($this->params['member']))
234
-			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
235
-		if ($this->renderer && !isset($this->params['assign']))
236
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
237
-		if (strpos($this->params['member'],':') === false && !isset($this->params['class']))
238
-			return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
234
+		if (!isset($this->params['member'])) {
235
+					return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
236
+		}
237
+		if ($this->renderer && !isset($this->params['assign'])) {
238
+					return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
239
+		}
240
+		if (strpos($this->params['member'],':') === false && !isset($this->params['class'])) {
241
+					return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
242
+		}
239 243
 
240 244
 		// extract out class and member
241 245
 		$class = null;
242 246
 		$member = null;
243
-		if (strpos($this->params['member'],':') !== false)
244
-			list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
245
-		else {
247
+		if (strpos($this->params['member'],':') !== false) {
248
+					list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
249
+		} else {
246 250
 			$class = $this->params['class'];
247 251
 			$member = $this->params['member'];
248 252
 		}
@@ -254,10 +258,11 @@  discard block
 block discarded – undo
254 258
 		if (!isset(self::$_choices[$key])) {
255 259
 			$dds = neon('dds')->iDdsClassManagement;
256 260
 			$result = $dds->getMember($class, $member, ['choices']);
257
-			if (!empty($result) && isset($result['choices']))
258
-				self::$_choices[$key] = $result['choices'];
259
-			else
260
-				self::$_choices[$key] = [];
261
+			if (!empty($result) && isset($result['choices'])) {
262
+							self::$_choices[$key] = $result['choices'];
263
+			} else {
264
+							self::$_choices[$key] = [];
265
+			}
261 266
 		}
262 267
 		$choices = self::$_choices[$key];
263 268
 		if (isset($this->params['order'])) {
@@ -267,10 +272,11 @@  discard block
 block discarded – undo
267 272
 				asort($choices);
268 273
 			}
269 274
 		}
270
-		if ($this->renderer)
271
-			$this->renderer->assign($this->params['assign'], $choices);
272
-		else
273
-			return $choices;
275
+		if ($this->renderer) {
276
+					$this->renderer->assign($this->params['assign'], $choices);
277
+		} else {
278
+					return $choices;
279
+		}
274 280
 	}
275 281
 
276 282
 	/**
@@ -288,11 +294,13 @@  discard block
 block discarded – undo
288 294
 	protected function queryMap()
289 295
 	{
290 296
 		// check usage
291
-		if (!isset($this->params['class']))
292
-			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
297
+		if (!isset($this->params['class'])) {
298
+					return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
299
+		}
293 300
 
294
-		if ($this->renderer && !isset($this->params['assign']))
295
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
301
+		if ($this->renderer && !isset($this->params['assign'])) {
302
+					return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
303
+		}
296 304
 
297 305
 		$fields = isset($this->params['fields']) ? $this->params['fields'] : [];
298 306
 
@@ -311,11 +319,13 @@  discard block
 block discarded – undo
311 319
 			self::$_maps[$class] = $result;
312 320
 		}
313 321
 		$map = self::$_maps[$class];
314
-		if (isset($this->params['flip']))
315
-			$map = array_flip($map);
322
+		if (isset($this->params['flip'])) {
323
+					$map = array_flip($map);
324
+		}
316 325
 
317
-		if ($this->renderer)
318
-			$this->renderer->assign($this->params['assign'], $map);
326
+		if ($this->renderer) {
327
+					$this->renderer->assign($this->params['assign'], $map);
328
+		}
319 329
 		return $map;
320 330
 	}
321 331
 
@@ -331,11 +341,13 @@  discard block
 block discarded – undo
331 341
 		$json = trim(str_replace("'", '"', $data));
332 342
 		if (strlen($json) > 0) {
333 343
 			// for convenience the beginning and ending brackets are optional so add if not supplied
334
-			if (strpos($json, '{') !== 0)
335
-				$json = '{'.$json.'}';
344
+			if (strpos($json, '{') !== 0) {
345
+							$json = '{'.$json.'}';
346
+			}
336 347
 			$request = json_decode($json, true);
337
-			if ($request === null)
338
-				throw new \Exception("Failing to json decode the data request: $json converted from $data. ");
348
+			if ($request === null) {
349
+							throw new \Exception("Failing to json decode the data request: $json converted from $data. ");
350
+			}
339 351
 		}
340 352
 		return $request;
341 353
 	}
@@ -360,10 +372,12 @@  discard block
 block discarded – undo
360 372
 		$dps = array_intersect_key($params, array_flip($dpa));
361 373
 		if (count($dps)) {
362 374
 			$data = [];
363
-			if ((isset($dps['dds']) || isset($dps['dds_page'])) && empty($dps['dds_class']))
364
-				$dps['dds_class'] = $params['type'];
365
-			if (isset($dps['dds_class']))
366
-				$data[] = "'class':'$dps[dds_class]'";
375
+			if ((isset($dps['dds']) || isset($dps['dds_page'])) && empty($dps['dds_class'])) {
376
+							$dps['dds_class'] = $params['type'];
377
+			}
378
+			if (isset($dps['dds_class'])) {
379
+							$data[] = "'class':'$dps[dds_class]'";
380
+			}
367 381
 
368 382
 			// create the filters
369 383
 			$filters = [];
@@ -371,9 +385,9 @@  discard block
 block discarded – undo
371 385
 			// create the page specific filter
372 386
 			if (!empty($dps['dds_page'])) {
373 387
 				$pageId = null;
374
-				if ($dps['dds_page'] === true || $dps['dds_page'] === 'true')
375
-					$pageId = neon()->cms->getPage()->getId();
376
-				else {
388
+				if ($dps['dds_page'] === true || $dps['dds_page'] === 'true') {
389
+									$pageId = neon()->cms->getPage()->getId();
390
+				} else {
377 391
 					// either a nice id or a page id
378 392
 					// $pageId = self::$page->niceId2PageId($dps['dds_page']);
379 393
 					// if (!$pageId)
@@ -381,43 +395,51 @@  discard block
 block discarded – undo
381 395
 					// object therefore has not worked for a while!
382 396
 					$pageId = $dps['dds_page'];
383 397
 				}
384
-				if ($pageId)
385
-					$filters[] = "['page_id','=','$pageId']";
398
+				if ($pageId) {
399
+									$filters[] = "['page_id','=','$pageId']";
400
+				}
386 401
 			}
387 402
 
388 403
 			// add other filters
389 404
 			if (isset($dps['dds_filter']) && !empty($dps['dds_filter'])) {
390
-				if (is_array($dps['dds_filter']))
391
-					$filters[] = json_encode($dps['dds_filter']);
405
+				if (is_array($dps['dds_filter'])) {
406
+									$filters[] = json_encode($dps['dds_filter']);
407
+				}
392 408
 				// else deprecated json approach
393
-				else if (strpos(trim($dps['dds_filter']), '[')!==0)
394
-					$filters[] = "[$dps[dds_filter]]";
395
-				else
396
-					$filters[] = $dps['dds_filter'];
409
+				else if (strpos(trim($dps['dds_filter']), '[')!==0) {
410
+									$filters[] = "[$dps[dds_filter]]";
411
+				} else {
412
+									$filters[] = $dps['dds_filter'];
413
+				}
397 414
 			}
398 415
 
399 416
 			// create the filters clause
400
-			if (count($filters))
401
-				$data[] = "'filters':".implode(',',$filters);
417
+			if (count($filters)) {
418
+							$data[] = "'filters':".implode(',',$filters);
419
+			}
402 420
 
403 421
 			// sort out the order
404 422
 			if (isset($dps['dds_order'])) {
405
-				if (is_array($dps['dds_order']))
406
-					$data[] = "'order':".json_encode($dps['dds_order']);
423
+				if (is_array($dps['dds_order'])) {
424
+									$data[] = "'order':".json_encode($dps['dds_order']);
425
+				}
407 426
 				// else deprecated json approach
408
-				else
409
-					$data[] = "'order':{".$dps['dds_order']."}";
427
+				else {
428
+									$data[] = "'order':{".$dps['dds_order']."}";
429
+				}
410 430
 			}
411 431
 
412 432
 			// sort out the limit
413 433
 			if (isset($dps['dds_limit'])) {
414
-				if (is_numeric($dps['dds_limit']))
415
-					$data[] = "'limit':{'length':$dps[dds_limit]}";
416
-				else if (is_array($dps['dds_limit']))
417
-					$data[] = "'limit':".json_encode($dps['dds_limit']);
434
+				if (is_numeric($dps['dds_limit'])) {
435
+									$data[] = "'limit':{'length':$dps[dds_limit]}";
436
+				} else if (is_array($dps['dds_limit'])) {
437
+									$data[] = "'limit':".json_encode($dps['dds_limit']);
438
+				}
418 439
 				// else deprecated json approach
419
-				else
420
-					$data[] = "'limit':{".$dps['dds_limit']."}";
440
+				else {
441
+									$data[] = "'limit':{".$dps['dds_limit']."}";
442
+				}
421 443
 			}
422 444
 			$params['data'] = '{'.implode(', ', $data).'}';
423 445
 		}
@@ -434,8 +456,9 @@  discard block
 block discarded – undo
434 456
 	protected function canonicalise($params)
435 457
 	{
436 458
 		$canon = [];
437
-		if (empty($params['assign']) && $this->renderer !== null)
438
-			throw new \InvalidArgumentException("You must set an 'assign' parameter when using the 'dds' tag");
459
+		if (empty($params['assign']) && $this->renderer !== null) {
460
+					throw new \InvalidArgumentException("You must set an 'assign' parameter when using the 'dds' tag");
461
+		}
439 462
 		foreach ($params as $k => $v) {
440 463
 			if ($k == 'assign') {
441 464
 				$canon[$k] = $v;
@@ -465,8 +488,9 @@  discard block
 block discarded – undo
465 488
 				$classType = $d['_class_type'];
466 489
 				foreach ($d as $field=>$value) {
467 490
 					// ignore all bookkeeping fields
468
-					if (strpos($field, '_')===0)
469
-						continue;
491
+					if (strpos($field, '_')===0) {
492
+											continue;
493
+					}
470 494
 					$edit[$i][$field] = self::createFieldEditable($classType, $field, $d['_uuid'], $value);
471 495
 				}
472 496
 			}
@@ -488,8 +512,9 @@  discard block
 block discarded – undo
488 512
 	 */
489 513
 	public static function createFieldEditable($classType, $field, $key, $value)
490 514
 	{
491
-		if (is_array($value))
492
-			return $value;
515
+		if (is_array($value)) {
516
+					return $value;
517
+		}
493 518
 
494 519
 		/**
495 520
 		 * This needs to be changed to generate an appropriate form to edit the
Please login to merge, or discard this patch.
neon/core/form/fields/ImageMultiple.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,14 +47,14 @@
 block discarded – undo
47 47
 		];
48 48
 	}
49 49
 
50
-	public function getValueDisplay($context='')
50
+	public function getValueDisplay($context = '')
51 51
 	{
52 52
 		$json = $this->getValue();
53 53
 		if (empty($json))
54 54
 			return neon()->formatter->asJson($this->getValue());
55
-		if ($context==='grid') {
55
+		if ($context === 'grid') {
56 56
 			$out = '';
57
-			foreach($json as $image) {
57
+			foreach ($json as $image) {
58 58
 				$url = neon()->firefly->getImage($image);
59 59
 				$out .= "<img src='$url' />";
60 60
 			}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,10 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function setValue($value)
26 26
 	{
27
-		if (is_array($value))
28
-			$this->_value = $value;
29
-		if (is_string($value))
30
-			$this->_value = json_decode($value);
27
+		if (is_array($value)) {
28
+					$this->_value = $value;
29
+		}
30
+		if (is_string($value)) {
31
+					$this->_value = json_decode($value);
32
+		}
31 33
 	}
32 34
 
33 35
 	/**
@@ -62,8 +64,9 @@  discard block
 block discarded – undo
62 64
 	public function getValueDisplay($context='')
63 65
 	{
64 66
 		$json = $this->getValue();
65
-		if (empty($json))
66
-			return neon()->formatter->asJson($this->getValue());
67
+		if (empty($json)) {
68
+					return neon()->formatter->asJson($this->getValue());
69
+		}
67 70
 		if ($context==='grid') {
68 71
 			$out = '';
69 72
 			foreach($json as $image) {
Please login to merge, or discard this patch.
neon/cms/form/fields/ImageCompare.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@
 block discarded – undo
48 48
 		];
49 49
     }
50 50
     
51
-    public function getValueDisplay($context='')
51
+    public function getValueDisplay($context = '')
52 52
 	{
53 53
 		$json = $this->getValue();
54 54
 		if (empty($json))
55 55
 			return neon()->formatter->asJson($this->getValue());
56
-		if ($context==='grid') {
56
+		if ($context === 'grid') {
57 57
 			$out = '';
58
-			foreach($json as $image) {
58
+			foreach ($json as $image) {
59 59
 				$url = neon()->firefly->getImage($image);
60 60
 				$out .= "<img src='$url' />";
61 61
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
     public function getValueDisplay($context='')
52 52
 	{
53 53
 		$json = $this->getValue();
54
-		if (empty($json))
55
-			return neon()->formatter->asJson($this->getValue());
54
+		if (empty($json)) {
55
+					return neon()->formatter->asJson($this->getValue());
56
+		}
56 57
 		if ($context==='grid') {
57 58
 			$out = '';
58 59
 			foreach($json as $image) {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
 
15 15
 class ImageCompare extends ImageMultiple
16 16
 {
17
-    /**
17
+	/**
18 18
 	 * @inheritdoc
19 19
 	 */
20
-    public $ddsDataType = 'json';
20
+	public $ddsDataType = 'json';
21 21
 
22
-    /**
22
+	/**
23 23
 	 * @inheritdoc
24 24
 	 */
25 25
 	public function registerScripts($view)
26 26
 	{
27
-        $view->registerAssetBundle(\neon\cms\assets\CmsFormAsset::class);
27
+		$view->registerAssetBundle(\neon\cms\assets\CmsFormAsset::class);
28 28
 		$view->registerAssetBundle(\neon\firefly\assets\BrowserAsset::class);
29
-    }
29
+	}
30 30
 
31
-    /**
31
+	/**
32 32
 	 * @inheritdoc
33 33
 	 */
34 34
 	public function getFilterField()
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		return ['class' => 'neon\\core\\form\\fields\\Text'];
37 37
 	}
38 38
 
39
-    /**
39
+	/**
40 40
 	 * @inheritdoc
41 41
 	 */
42 42
 	public function getComponentDetails()
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 		return [
45 45
 			'icon' => 'fa fa-image', 'group' => 'Media', 'order' => 612, 'label' => 'Image Compare'
46 46
 		];
47
-    }
47
+	}
48 48
 
49
-    public function getValueDisplay($context='')
49
+	public function getValueDisplay($context='')
50 50
 	{
51 51
 		$json = $this->getValue();
52 52
 		if (empty($json))
Please login to merge, or discard this patch.
neon/firefly/services/ImageManager.php 2 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,11 +38,13 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		// get firefly image if the source is a firefly id
40 40
 		if (Hash::isUuid64($source)) {
41
-			if (!neon()->firefly->fileManager->exists($source))
42
-				throw new HttpException(404);
41
+			if (!neon()->firefly->fileManager->exists($source)) {
42
+							throw new HttpException(404);
43
+			}
43 44
 			$meta = neon()->firefly->fileManager->getMeta($source);
44
-			if ($meta['mime_type'] == 'image/svg')
45
-				return neon()->firefly->fileManager->read($source);
45
+			if ($meta['mime_type'] == 'image/svg') {
46
+							return neon()->firefly->fileManager->read($source);
47
+			}
46 48
 			$source = neon()->firefly->fileManager->readStream($source);
47 49
 		}
48 50
 		$manager = new InterventionImageManager();
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	public function imageRotate(Image & $image, $params)
104 106
 	{
105 107
 		$rotate = Arr::get($params, 'rotate', false);
106
-		if ($rotate) $image->rotate($rotate);
108
+		if ($rotate) {
109
+			$image->rotate($rotate);
110
+		}
107 111
 	}
108 112
 
109 113
 	/**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			// add callback functionality to retain maximal original image size
85 85
 			$options = ['top-left', 'top', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom', 'bottom-right'];
86 86
 			$option = in_array($params['fit'], $options) ? $params['fit'] : 'center';
87
-			$image->fit($width, $height, function ($constraint) {
87
+			$image->fit($width, $height, function($constraint) {
88 88
 				$constraint->aspectRatio();
89 89
 				$constraint->upsize();
90 90
 			}, $option);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		} elseif ($width || $height) {
94 94
 			$width = $width * $pd;
95 95
 			$height = $height * $pd;
96
-			$image->resize($width, $height, function ($constraint) {
96
+			$image->resize($width, $height, function($constraint) {
97 97
 				$constraint->aspectRatio();
98 98
 				$constraint->upsize();
99 99
 			});
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		$filter = Arr::get($params, 'filter', false);
155 155
 		if ($filter) {
156
-			$filters = explode(',',$filter);
156
+			$filters = explode(',', $filter);
157 157
 			if (in_array('greyscale', $filters, true)) {
158 158
 				$image->greyscale();
159 159
 			}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 				$x = Arr::get($crop, 'x', null);
189 189
 				$y = Arr::get($crop, 'y', null);
190 190
 			}
191
-			if ($w == 0 && $h == 0 && $x == 0 && $y ==0) {
191
+			if ($w == 0 && $h == 0 && $x == 0 && $y == 0) {
192 192
 				return $image;
193 193
 			}
194 194
 			$image->crop($w, $h, $x, $y);
Please login to merge, or discard this patch.
neon/cms/controllers/RenderController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * slug it uses - without this property the canonical function will return the url of the first blog-post
83 83
 	 * (collection page) it finds.
84 84
 	 */
85
-	public function actionPage($nice_id, $slug='')
85
+	public function actionPage($nice_id, $slug = '')
86 86
 	{
87 87
 		\Neon::beginProfile('COBE::RENDER_ACTION', 'cobe');
88 88
 		$cms = $this->getCms();
89 89
 		$page = $cms->getPage();
90 90
 		// check the page with the nice_id exists
91
-		if (! $page->setById($nice_id)) {
91
+		if (!$page->setById($nice_id)) {
92 92
 			$this->pageNotFound();
93 93
 		}
94 94
 		//return neon()->view->injectHtml('');
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		}
104 104
 
105 105
 		// Don't display draft pages unless in edit mode.
106
-		if ($page->isStatusDraft() && ! $page->isInEditMode()) {
106
+		if ($page->isStatusDraft() && !$page->isInEditMode()) {
107 107
 			$this->pageNotFound();
108 108
 		}
109 109
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			->innerJoin(CmsPage::tableName(), 'cms_page.nice_id = cms_url.nice_id')
136 136
 			->where("status='PUBLISHED'")
137 137
 			->all()
138
-		)->reduce(function($carry, $url){
139
-			return $carry . "\t<url>\n\t\t<loc>" . url($url['url'], true) . "</loc>\n\t</url>" . "\n";
138
+		)->reduce(function($carry, $url) {
139
+			return $carry."\t<url>\n\t\t<loc>".url($url['url'], true)."</loc>\n\t</url>"."\n";
140 140
 		});
141 141
 		header('Content-Type:application/rss+xml');
142 142
 		echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 
110 110
 		$render = $page->render();
111
-		if ($render === false)
112
-			throw new \yii\web\HttpException(404, 'No template found');
111
+		if ($render === false) {
112
+					throw new \yii\web\HttpException(404, 'No template found');
113
+		}
113 114
 
114 115
 		\Neon::endProfile('COBE::RENDER_ACTION', 'cobe');
115 116
 
@@ -153,10 +154,12 @@  discard block
 block discarded – undo
153 154
 	{
154 155
 		$request = neon()->request;
155 156
 		$url = $request->get('page');
156
-		if (!$url)
157
-			$this->pageNotFound();
158
-		if (($urlEntry = CmsUrl::findByUrl($url)))
159
-			return $this->actionPage($urlEntry['nice_id']);
157
+		if (!$url) {
158
+					$this->pageNotFound();
159
+		}
160
+		if (($urlEntry = CmsUrl::findByUrl($url))) {
161
+					return $this->actionPage($urlEntry['nice_id']);
162
+		}
160 163
 		$this->pageNotFound();
161 164
 	}
162 165
 
Please login to merge, or discard this patch.