Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/phoebe/controllers/database/IndexController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 		$exclude = ['neon\core\form\fields\filters\File'];
99 99
 		$appClasses = neon()->getAppClasses('', \neon\core\interfaces\IComponent::class);
100 100
 		$out = [];
101
-		foreach($appClasses as $app => $classes) {
102
-			foreach($classes as $class) {
101
+		foreach ($appClasses as $app => $classes) {
102
+			foreach ($classes as $class) {
103 103
 				/** @var \neon\core\form\fields\Field $f */
104 104
 				$f = new $class(uuid(), []);
105 105
 				// register all form field js scripts
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			}
187 187
 		}
188 188
 		return $this->render('create-table-raw.tpl', [
189
-			'class' => [ 'label' => 'Create Table'],
189
+			'class' => ['label' => 'Create Table'],
190 190
 			'form'=>$form
191 191
 		]);
192 192
 	}
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 			'label' => $data['label'],
205 205
 			'fields' => []
206 206
 		];
207
-		$fields = json_decode($data['fields'],true);
207
+		$fields = json_decode($data['fields'], true);
208 208
 		if (is_array($fields)) {
209 209
 			foreach ($fields as $field) {
210 210
 				$field['classLabel'] = isset($field['classLabel']) ? $field['classLabel'] : ucwords($field['class']);
211
-				$field['label'] = isset($field['label']) ? $field['label'] : ucwords(str_replace(['_','-'],' ',$field['name']));
211
+				$field['label'] = isset($field['label']) ? $field['label'] : ucwords(str_replace(['_', '-'], ' ', $field['name']));
212 212
 				$definition['fields'][] = $field;
213 213
 			}
214 214
 			return $definition;
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function actionEdit($type = null)
56 56
 	{
57
-		if (!$this->canDevelop())
58
-			throw new HttpException(403, 'This operation is not permitted here');
57
+		if (!$this->canDevelop()) {
58
+					throw new HttpException(403, 'This operation is not permitted here');
59
+		}
59 60
 
60 61
 		$form = $this->getPhoebeForm($type, $isNewForm, false, true);
61 62
 		return $this->render('edit-fields', [
@@ -95,9 +96,13 @@  discard block
 block discarded – undo
95 96
 				// register all form field js scripts
96 97
 				$f->registerScripts(neon()->view);
97 98
 				$class = substr($class, 1);
98
-				if (in_array($class, $exclude)) continue;
99
+				if (in_array($class, $exclude)) {
100
+					continue;
101
+				}
99 102
 				$details = $f->getComponentDetails();
100
-				if ($details === false) continue;
103
+				if ($details === false) {
104
+					continue;
105
+				}
101 106
 				$defaultField = Arr::except($f->toArray(), ['dataKey']);
102 107
 				$cmp = Arr::merge($defaultField, [
103 108
 					'class' => $class,
@@ -162,8 +167,9 @@  discard block
 block discarded – undo
162 167
 			]
163 168
 		];
164 169
 		$form = new \neon\core\form\Form($formDefinition);
165
-		if (neon()->request->isAjax)
166
-			return $form->ajaxValidation();
170
+		if (neon()->request->isAjax) {
171
+					return $form->ajaxValidation();
172
+		}
167 173
 		if ($form->processRequest()) {
168 174
 			$data = $form->getData();
169 175
 			$definition = $this->canonicaliseDefinition($data);
Please login to merge, or discard this patch.
neon/utilities/controllers/ClearCacheController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$cmp = neon()->getApp($app)->get($component);
34 34
 		if ($cmp !== null && $cmp instanceof CacheInterface) {
35 35
 			if ($cmp->flush()) {
36
-				neon()->session->setFlash('success', $component . ' cache successfully flushed');
36
+				neon()->session->setFlash('success', $component.' cache successfully flushed');
37 37
 				return $this->redirect(['/utilities/clear-cache/index']);
38 38
 			}
39 39
 		}
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	public function actionClearAll()
66 66
 	{
67 67
 		$caches = $this->getCaches();
68
-		foreach($caches as $app => $caches) {
68
+		foreach ($caches as $app => $caches) {
69 69
 			$a = neon()->getApp($app);
70 70
 			if ($a === null) return;
71
-			foreach($caches as $name => $component) {
71
+			foreach ($caches as $name => $component) {
72 72
 				$cmp = $a->get($name);
73 73
 				if ($cmp !== null && $cmp instanceof CacheInterface) {
74 74
 					$cmp->flush();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		$r = new Renderer();
93 93
 		$r->smarty->clearCompiledTemplate();
94 94
 		$r->smarty->clearAllCache();
95
-		foreach(neon()->view->renderers as $ext => $config) {
95
+		foreach (neon()->view->renderers as $ext => $config) {
96 96
 			$renderer = neon()->view->getRendererByExtension($ext);
97 97
 			if ($renderer instanceof ICanFlushTemplates) {
98 98
 				$renderer->flushTemplates();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
 		$caches = $this->getCaches();
68 68
 		foreach($caches as $app => $caches) {
69 69
 			$a = neon()->getApp($app);
70
-			if ($a === null) return;
70
+			if ($a === null) {
71
+				return;
72
+			}
71 73
 			foreach($caches as $name => $component) {
72 74
 				$cmp = $a->get($name);
73 75
 				if ($cmp !== null && $cmp instanceof CacheInterface) {
@@ -132,7 +134,9 @@  discard block
 block discarded – undo
132 134
 	public function getCaches()
133 135
 	{
134 136
 		return collect(neon()->getAllApps())->map(function($config, $app) {
135
-			$a = neon()->getApp($app); if ($a === null) return;
137
+			$a = neon()->getApp($app); if ($a === null) {
138
+				return;
139
+			}
136 140
 			return $this->getCacheComponents($a->getComponents());
137 141
 		})
138 142
 		->put('neon', $this->getCacheComponents(neon()->getComponents()))
Please login to merge, or discard this patch.
neon/utilities/controllers/DbBackupController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	public function actionBackup()
57 57
 	{
58 58
 		$backup = neon()->db->backup();
59
-		neon()->session->setFlash('success', 'New backup created ' . $backup);
59
+		neon()->session->setFlash('success', 'New backup created '.$backup);
60 60
 		$zipPath = $this->zip($backup);
61 61
 		return neon()->getResponse()->sendFile($zipPath, null, [
62 62
 			'mimeType' => 'application/zip',
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	private function zip($file)
74 74
 	{
75 75
 		File::createDirectory(neon()->getAlias('@runtime/temp'));
76
-		$zipPath = neon()->getAlias('@runtime/temp/'.pathinfo($file, PATHINFO_FILENAME) . '.zip');
76
+		$zipPath = neon()->getAlias('@runtime/temp/'.pathinfo($file, PATHINFO_FILENAME).'.zip');
77 77
 
78 78
 		if (is_file($zipPath) && !File::unlink($zipPath)) {
79 79
 			\Neon::warning("Unable to delete the file \"{$zipPath}\": ", __METHOD__);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$zip = new ZipArchive();
83 83
 		if ($zip->open($zipPath, ZipArchive::CREATE) !== true) {
84
-			throw new \Exception('Cannot create zip at ' . $zipPath);
84
+			throw new \Exception('Cannot create zip at '.$zipPath);
85 85
 		}
86 86
 		$zip->addFile($file, pathinfo($file, PATHINFO_BASENAME));
87 87
 		$zip->close();
Please login to merge, or discard this patch.
neon/utilities/controllers/requirements.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 function maxExecutionTimeRequirement()
9 9
 {
10
-	$maxExecutionTime = (int)trim(ini_get('max_execution_time'));
10
+	$maxExecutionTime = (int) trim(ini_get('max_execution_time'));
11 11
 
12
-	$humanTime = $maxExecutionTime . ($maxExecutionTime === 0 ? ' (no limit)' : '');
12
+	$humanTime = $maxExecutionTime.($maxExecutionTime === 0 ? ' (no limit)' : '');
13 13
 	$memo = "Neon requires a minimum PHP max execution time of 120 seconds. The max_execution_time directive in php.ini is currently set to {$humanTime}.";
14 14
 
15 15
 	return array(
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$memoryLimit = ini_get('memory_limit');
26 26
 	$bytes = getByteSize($memoryLimit);
27 27
 
28
-	$humanLimit = $memoryLimit . ($memoryLimit === -1 ? ' (no limit)' : '');
28
+	$humanLimit = $memoryLimit.($memoryLimit === -1 ? ' (no limit)' : '');
29 29
 	$memo = "Neon requires a minimum PHP memory limit of 256M. The memory_limit directive in php.ini is currently set to {$humanLimit}.";
30 30
 
31 31
 	return array(
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 {
68 68
 	// Copied from craft\helpers\App::phpConfigValueInBytes()
69 69
 	if (!preg_match('/(\d+)(K|M|G)/i', $value, $matches)) {
70
-		return (int)$value;
70
+		return (int) $value;
71 71
 	}
72 72
 
73
-	$value = (int)$matches[1];
73
+	$value = (int) $matches[1];
74 74
 
75 75
 	// Multiply!
76 76
 	switch (strtolower($matches[2])) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         (for example, plural in
259 259
         <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\">
260 260
         Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU version is ' .
261
-			(defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)') . '.'
261
+			(defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)').'.'
262 262
 	],
263 263
 	[
264 264
 		'name' => 'ICU Data version',
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         (for example, plural in
270 270
         <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\">
271 271
         Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU Data version is ' .
272
-			(defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)') . '.'
272
+			(defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)').'.'
273 273
 	],
274 274
 	[
275 275
 		'name' => 'Parse Ini File',
Please login to merge, or discard this patch.
neon/utilities/App.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 	public function checkAuthorization(string $class): bool
90 90
 	{
91 91
 		/** @var string|IUtilitiy $class */
92
-		return neon()->getUser()->checkPermission('utility:' . $class::id());
92
+		return neon()->getUser()->checkPermission('utility:'.$class::id());
93 93
 	}
94 94
 
95 95
 	/**
Please login to merge, or discard this patch.
neon/firefly/services/FileManager.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 		$q = new Query();
108 108
 		foreach ($all as $i => $field) {
109 109
 			if ($i === 0) {
110
-				$q->select(['_uuid'],"'$field[class_type]' as 'class',")
111
-					->from('ddt_' . $field['class_type'])
110
+				$q->select(['_uuid'], "'$field[class_type]' as 'class',")
111
+					->from('ddt_'.$field['class_type'])
112 112
 					->where([$field['member_ref'] => $uuid]);
113 113
 			} else {
114
-				$q->union((new Query())->select(['_uuid'],"'$field[class_type]' as 'class',")
115
-					->from('ddt_' . $field['class_type'])
114
+				$q->union((new Query())->select(['_uuid'], "'$field[class_type]' as 'class',")
115
+					->from('ddt_'.$field['class_type'])
116 116
 					->where([$field['member_ref'] => $uuid]));
117 117
 			}
118 118
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	/**
184 184
 	 * @inheritdoc
185 185
 	 */
186
-	public function getImage($uuid, $params=[])
186
+	public function getImage($uuid, $params = [])
187 187
 	{
188 188
 		$p = array_merge(['/firefly/file/img', 'id'=>$uuid], $params);
189 189
 		return Url::to($p, true);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		try {
235 235
 			$f = $this->_get($uuid);
236 236
 			return $f->delete();
237
-		} catch(FileNotFoundException $e) {
237
+		} catch (FileNotFoundException $e) {
238 238
 			return false;
239 239
 		}
240 240
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	/**
300 300
 	 * @inheritdoc
301 301
 	 */
302
-	public function sendFile($uuid, $download=false)
302
+	public function sendFile($uuid, $download = false)
303 303
 	{
304 304
 		$meta = $this->getMeta($uuid);
305 305
 		$drive = $this->getDriveFor($uuid, $file);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	public function getFileName($uuid)
342 342
 	{
343 343
 		$meta = $this->getMeta($uuid);
344
-		return isset($meta['name']) ? $meta['name'] : false ;
344
+		return isset($meta['name']) ? $meta['name'] : false;
345 345
 	}
346 346
 
347 347
 	/**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	public function getSize($uuid)
365 365
 	{
366 366
 		$meta = $this->getMeta($uuid);
367
-		return isset($meta['size']) ? $meta['size'] : false ;
367
+		return isset($meta['size']) ? $meta['size'] : false;
368 368
 	}
369 369
 
370 370
 	/**
@@ -435,16 +435,16 @@  discard block
 block discarded – undo
435 435
 	 * @param  string  $name  - The actual file name
436 436
 	 * @return  string  - The full file past on the drive
437 437
 	 */
438
-	protected function _generatePath(&$name=null, $fm)
438
+	protected function _generatePath(&$name = null, $fm)
439 439
 	{
440 440
 		$info = pathinfo($name);
441 441
 		$fileName = $info['filename'];
442
-		$extension = isset($info['extension']) ? '.' . $info['extension'] : '';
442
+		$extension = isset($info['extension']) ? '.'.$info['extension'] : '';
443 443
 		if (empty($fileName)) {
444 444
 			$fileName = 'nameless';
445 445
 			$name = 'nameless';
446 446
 		}
447
-		return date('Y') . '/' . date('m') . '/' . $fileName . '.' . $fm->uuid . $extension;
447
+		return date('Y').'/'.date('m').'/'.$fileName.'.'.$fm->uuid.$extension;
448 448
 	}
449 449
 
450 450
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
 		neon()->firefly->isFileObjectValid($file);
67 67
 		$stream = fopen($file->getRealPath(), 'r+');
68 68
 		$uuid = $this->save($stream, $file->getFilename(), $meta);
69
-		if (is_resource($stream)) fclose($stream);
69
+		if (is_resource($stream)) {
70
+			fclose($stream);
71
+		}
70 72
 		return $uuid;
71 73
 	}
72 74
 
@@ -105,8 +107,9 @@  discard block
 block discarded – undo
105 107
 			->orWhere(['data_type_ref' => 'file_ref_multi'])
106 108
 			->all();
107 109
 			
108
-		if (empty($all))
109
-			return [];
110
+		if (empty($all)) {
111
+					return [];
112
+		}
110 113
 
111 114
 		$q = new Query();
112 115
 		foreach ($all as $i => $field) {
@@ -249,7 +252,9 @@  discard block
 block discarded – undo
249 252
 	public function destroy($uuid)
250 253
 	{
251 254
 		$file = Model::findWithDeleted()->where(['uuid' => $uuid])->one();
252
-		if ($file === null) return false;
255
+		if ($file === null) {
256
+			return false;
257
+		}
253 258
 		return $file->destroy();
254 259
 	}
255 260
 
@@ -332,7 +337,9 @@  discard block
 block discarded – undo
332 337
 			$driver = $this->getDriveFor($uuid, $file);
333 338
 			$hash = $driver->hash($file['path']);
334 339
 			$model = $this->_get($uuid);
335
-			if (!$hash) return false;
340
+			if (!$hash) {
341
+				return false;
342
+			}
336 343
 			$model->file_hash = $hash;
337 344
 			$model->save();
338 345
 		}
@@ -396,8 +403,9 @@  discard block
 block discarded – undo
396 403
 	{
397 404
 		$model = $this->_get($uuid);
398 405
 		$model->attributes = $updates;
399
-		if (!$model->save())
400
-			throw new HttpException(400, $model->getErrors());
406
+		if (!$model->save()) {
407
+					throw new HttpException(400, $model->getErrors());
408
+		}
401 409
 		return $model->toArray();
402 410
 	}
403 411
 
@@ -411,8 +419,9 @@  discard block
 block discarded – undo
411 419
 	public function findFile($drive, $path)
412 420
 	{
413 421
 		$model = Model::find()->where(['drive' => $drive, 'path' => $path])->one();
414
-		if ($model === null)
415
-			return null;
422
+		if ($model === null) {
423
+					return null;
424
+		}
416 425
 		return $model->toArray();
417 426
 	}
418 427
 
Please login to merge, or discard this patch.
neon/firefly/services/driveManager/interfaces/IFileSystem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws \InvalidArgumentException if the $contents is an object and it does not have a getRealPath function
166 166
 	 * @return bool  True on success, false on failure.
167 167
 	 */
168
-	public function put($path, $contents, $visibility=null);
168
+	public function put($path, $contents, $visibility = null);
169 169
 
170 170
 	/**
171 171
 	 * Get meta data for this file
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @param  string  $algorithm  - Any algorithm supported by hash()
236 236
 	 * @return string  return the hash output string on success or an empty string if the file path can not be read as a stream
237 237
 	 */
238
-	public function hash($path, $algorithm='md5');
238
+	public function hash($path, $algorithm = 'md5');
239 239
 
240 240
 	/**
241 241
 	 * Get the underlying Flysystem driver
Please login to merge, or discard this patch.
neon/firefly/services/fileManager/models/FileManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 	 * @param string $uuid
103 103
 	 * @return FileManager|null
104 104
 	 */
105
-	public static function get($uuid, $throwNotFoundExcaption=true)
105
+	public static function get($uuid, $throwNotFoundExcaption = true)
106 106
 	{
107 107
 		$model = neon()->cache->getOrSet($uuid, static function() use ($uuid) {
108 108
 			return static::findOne($uuid);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,9 @@
 block discarded – undo
107 107
 		$model = neon()->cache->getOrSet($uuid, static function() use ($uuid) {
108 108
 			return static::findOne($uuid);
109 109
 		});
110
-		if ($model === null && $throwNotFoundExcaption)
111
-			throw new FileNotFoundException("No file with id '$uuid' exists.");
110
+		if ($model === null && $throwNotFoundExcaption) {
111
+					throw new FileNotFoundException("No file with id '$uuid' exists.");
112
+		}
112 113
 		return $model;
113 114
 	}
114 115
 
Please login to merge, or discard this patch.
neon/firefly/services/fileManager/interfaces/IFileManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 *   'h' => height
135 135
 	 * @return string
136 136
 	 */
137
-	public function getImage($uuid, $params=[]);
137
+	public function getImage($uuid, $params = []);
138 138
 
139 139
 	/**
140 140
 	 * Get a file's visibility.
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * - otherwise it will just return the value from the database
216 216
 	 * @return string|false - string the md5 checksum of the file contents, false on failure
217 217
 	 */
218
-	public function getFileHash($uuid, $refresh=false);
218
+	public function getFileHash($uuid, $refresh = false);
219 219
 
220 220
 	/**
221 221
 	 * Get the file size in bytes
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * If false will display the file in the browser
244 244
 	 * @return Response
245 245
 	 */
246
-	public function sendFile($uuid, $download=false);
246
+	public function sendFile($uuid, $download = false);
247 247
 
248 248
 	/**
249 249
 	 * Find a file manager file data by its drive and path location
Please login to merge, or discard this patch.