Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/firefly/migrations/m161126_123100_firefly_file_manager.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 class m161126_123100_firefly_file_manager extends Migration
7 7
 {
8 8
 
9
-    public function safeUp()
10
-    {
9
+	public function safeUp()
10
+	{
11 11
 		$this->createTable(FileManager::tableName(), [
12 12
 
13 13
 			'uuid' => $this->char(36)->notNull()->comment('The uuid for this file'),
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 			'PRIMARY KEY (uuid)'
36 36
 
37 37
 		]);
38
-    }
38
+	}
39 39
 
40
-    public function safeDown()
41
-    {
40
+	public function safeDown()
41
+	{
42 42
 		$this->dropTable(FileManager::tableName());
43
-    }
43
+	}
44 44
 
45 45
 }
Please login to merge, or discard this patch.
neon/firefly/migrations/m161130_132459_firefly_uuid_change_to_22_chars.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class m161130_132459_firefly_uuid_change_to_22_chars extends Migration
6 6
 {
7
-    public function safeUp()
8
-    {
7
+	public function safeUp()
8
+	{
9 9
 		$this->alterColumn('firefly_file_manager', 'uuid', "CHAR(22) NOT NULL COMMENT 'The unique identifier for this file'");
10
-    }
10
+	}
11 11
 
12
-    public function safeDown()
13
-    {
12
+	public function safeDown()
13
+	{
14 14
 		$this->alterColumn('firefly_file_manager', 'uuid', "CHAR(36) NOT NULL COMMENT 'The uuid for this file'");
15
-    }
15
+	}
16 16
 }
Please login to merge, or discard this patch.
neon/firefly/migrations/m190204_134239_firefly_interface_change_db_fix.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
 	private function convertFireflyGetsToFiles($search, $replace)
34 34
 	{
35 35
 		$potentiallyAffected = $this->db->createCommand("SELECT `class_type`, `member_ref` FROM `dds_member` WHERE `data_type_ref`='textlong'")->queryAll();
36
-		if (count($potentiallyAffected)==0)
36
+		if (count($potentiallyAffected) == 0)
37 37
 			return;
38 38
 		$classes = [];
39 39
 		foreach ($potentiallyAffected as $pa)
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$dds = neon('dds')->IDdsObjectManagement;
72 72
 		foreach ($wysiwygFields as $classType => $fields) {
73
-			$start=0;
73
+			$start = 0;
74 74
 			do {
75 75
 				$found = $dds->listObjects($classType, $total, true, true, $start, 100);
76 76
 				$start += count($found);
77 77
 				foreach ($found as $objectData) {
78 78
 					$changes = [];
79 79
 					foreach ($fields as $field) {
80
-						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false)
80
+						if (!empty($objectData[$field]) && strpos($objectData[$field], $search) !== false)
81 81
 							$changes[$field] = str_replace($search, $replace, $objectData[$field]);
82 82
 					}
83 83
 					if (count($changes)) {
84 84
 						$dds->editObject($objectData['_uuid'], $changes);
85 85
 					}
86 86
 				}
87
-			} while (count($found)>0);
87
+			} while (count($found) > 0);
88 88
 		}
89 89
 
90 90
 		return true;
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,22 +33,26 @@  discard block
 block discarded – undo
33 33
 	private function convertFireflyGetsToFiles($search, $replace)
34 34
 	{
35 35
 		$potentiallyAffected = $this->db->createCommand("SELECT `class_type`, `member_ref` FROM `dds_member` WHERE `data_type_ref`='textlong'")->queryAll();
36
-		if (count($potentiallyAffected)==0)
37
-			return;
36
+		if (count($potentiallyAffected)==0) {
37
+					return;
38
+		}
38 39
 		$classes = [];
39
-		foreach ($potentiallyAffected as $pa)
40
-			$classes[$pa['class_type']][] = $pa['member_ref'];
40
+		foreach ($potentiallyAffected as $pa) {
41
+					$classes[$pa['class_type']][] = $pa['member_ref'];
42
+		}
41 43
 		$phoebeClasses = array_keys($classes);
42 44
 		$phoebe = neon('phoebe')->getIPhoebeType('daedalus');
43 45
 
44 46
 		$phoebeDefinition = [];
45
-		foreach ($phoebeClasses as $pc)
46
-			$phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false);
47
+		foreach ($phoebeClasses as $pc) {
48
+					$phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false);
49
+		}
47 50
 
48 51
 		$potentiallyAffectedLookup = [];
49 52
 		foreach ($potentiallyAffected as $pa) {
50
-			if (empty($potentiallyAffectedLookup[$pa['class_type']]))
51
-				$potentiallyAffectedLookup[$pa['class_type']] = [];
53
+			if (empty($potentiallyAffectedLookup[$pa['class_type']])) {
54
+							$potentiallyAffectedLookup[$pa['class_type']] = [];
55
+			}
52 56
 			$potentiallyAffectedLookup[$pa['class_type']][] = $pa['member_ref'];
53 57
 		}
54 58
 
@@ -77,8 +81,9 @@  discard block
 block discarded – undo
77 81
 				foreach ($found as $objectData) {
78 82
 					$changes = [];
79 83
 					foreach ($fields as $field) {
80
-						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false)
81
-							$changes[$field] = str_replace($search, $replace, $objectData[$field]);
84
+						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false) {
85
+													$changes[$field] = str_replace($search, $replace, $objectData[$field]);
86
+						}
82 87
 					}
83 88
 					if (count($changes)) {
84 89
 						$dds->editObject($objectData['_uuid'], $changes);
Please login to merge, or discard this patch.
neon/firefly/App.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	/**
204 204
 	 * @inheritdoc
205 205
 	 */
206
-	public function getImage($uuid, $params=[])
206
+	public function getImage($uuid, $params = [])
207 207
 	{
208 208
 		return $this->fileManager->getImage($uuid, $params);
209 209
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param  string  $name
301 301
 	 * @return \neon\firefly\services\driveManager\interfaces\IFileSystem
302 302
 	 */
303
-	public function drive($name=null)
303
+	public function drive($name = null)
304 304
 	{
305 305
 		return $this->driveManager->drive($name);
306 306
 	}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	/**
309 309
 	 * @inheritdoc
310 310
 	 */
311
-	public function sendFile($uuid, $download=false)
311
+	public function sendFile($uuid, $download = false)
312 312
 	{
313 313
 		return $this->fileManager->sendFile($uuid, $download);
314 314
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param boolean $throwExceptions - whether to throw exceptions on validation failure
365 365
 	 * @return boolean
366 366
 	 */
367
-	public function isFileObjectValid($file, $throwExceptions=true)
367
+	public function isFileObjectValid($file, $throwExceptions = true)
368 368
 	{
369 369
 		if ($file instanceof IFile)
370 370
 			return true;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 			&& method_exists($file, 'getRealPath')
375 375
 			&& method_exists($file, 'getFilename');
376 376
 		// the $file param must be an object with getRealPath and getFilename functions
377
-		if (! $objectIsValid && $throwExceptions) {
377
+		if (!$objectIsValid && $throwExceptions) {
378 378
 			throw new \InvalidArgumentException('$file param must be an object with a getRealPath and getFilename method');
379 379
 		}
380 380
 		return $objectIsValid;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -366,8 +366,9 @@
 block discarded – undo
366 366
 	 */
367 367
 	public function isFileObjectValid($file, $throwExceptions=true)
368 368
 	{
369
-		if ($file instanceof IFile)
370
-			return true;
369
+		if ($file instanceof IFile) {
370
+					return true;
371
+		}
371 372
 		// not all objects have the privilege of implementing the IFile interface like \SplFileObject
372 373
 		// Firefly only cares about these two functions 'getRealPath' and 'getFilename'
373 374
 		$objectIsValid = is_object($file)
Please login to merge, or discard this patch.
neon/cms/components/Theme.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param array &$read - the set of read components to prevent infinite looping
67 67
 	 * @return array  the set of components
68 68
 	 */
69
-	private static function &getComponents($path, &$components=[], &$read=[])
69
+	private static function &getComponents($path, &$components = [], &$read = [])
70 70
 	{
71 71
 		$root = self::getRoot();
72 72
 		$configFile = $root.$path.'/_config.php';
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 					}
92 92
 				}
93 93
 			} catch (\Exception $e) {
94
-				throw new \InvalidArgumentException("Something went wrong when trying to parse the config file $configFile. The error was ".$e->getMessage(). ". The file contained <pre>".print_r($config,true)."</pre>.");
94
+				throw new \InvalidArgumentException("Something went wrong when trying to parse the config file $configFile. The error was ".$e->getMessage().". The file contained <pre>".print_r($config, true)."</pre>.");
95 95
 			}
96 96
 		}
97 97
 		return $components;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 			if (is_string($root) && count($themes)) {
30 30
 				foreach ($themes as $theme) {
31 31
 					$themePath = $root.$theme;
32
-					if (!isset($hierarchy[$theme]))
33
-						$hierarchy[$theme] = [];
32
+					if (!isset($hierarchy[$theme])) {
33
+											$hierarchy[$theme] = [];
34
+					}
34 35
 
35 36
 					// add the default template and plugin directories
36 37
 					$hierarchy[$theme]['templates'][] = $themePath;
@@ -104,8 +105,9 @@  discard block
 block discarded – undo
104 105
 	private static function getRoot()
105 106
 	{
106 107
 		static $root = null;
107
-		if ($root === null)
108
-			$root = Neon::getAlias('@root/themes/');
108
+		if ($root === null) {
109
+					$root = Neon::getAlias('@root/themes/');
110
+		}
109 111
 		return $root;
110 112
 	}
111 113
 }
Please login to merge, or discard this patch.
neon/cms/services/cmsManager/CmsManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 	public function bulkStaticContentRequest($requests)
44 44
 	{
45 45
 		$requestedData = [];
46
-		if (count($requests)>0) {
46
+		if (count($requests) > 0) {
47 47
 			$query = CmsStaticContent::find()
48 48
 				->select("`key`, `page_id` as `pageId`, `content`");
49 49
 			foreach ($requests as $id => $request) {
Please login to merge, or discard this patch.
neon/cms/controllers/DataController.php 2 patches
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,17 +39,19 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		// see if we have a key and if not we can do nothing
41 41
 		$key = neon()->request->post('key');
42
-		if (empty($key))
43
-			return;
42
+		if (empty($key)) {
43
+					return;
44
+		}
44 45
 		$content = neon()->request->postUnsafe('content');
45 46
 		$content = Html::sanitise($content, $this->inlineAllowedTags);
46 47
 		$pageId = neon()->request->post('pageId', null);
47 48
 		try {
48 49
 			$result = neon('cms')->getICmsStaticData()->editStaticContent($key, $pageId, $content);
49
-			if ($result === true)
50
-				return ['success'=>true, 'saved'=>$content];
51
-			else
52
-				return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
50
+			if ($result === true) {
51
+							return ['success'=>true, 'saved'=>$content];
52
+			} else {
53
+							return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
54
+			}
53 55
 		} catch (\Exception $e) {
54 56
 			return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false];
55 57
 		}
@@ -67,10 +69,11 @@  discard block
 block discarded – undo
67 69
 		$pageId = neon()->request->post('pageId', null);
68 70
 		try {
69 71
 			$result = neon()->cms->getICmsStaticData()->editStaticContent($key, $pageId, $content);
70
-			if ($result === true)
71
-				return ['success'=>true, 'saved'=>$content];
72
-			else if (neon()->debug)
73
-				return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
72
+			if ($result === true) {
73
+							return ['success'=>true, 'saved'=>$content];
74
+			} else if (neon()->debug) {
75
+							return neon()->debug ? ['success'=>false, 'errors'=>$result] : ['success'=>false];
76
+			}
74 77
 		} catch (\Exception $e) {
75 78
 			return neon()->debug ? ['success'=>false, 'errors'=>$e->getMessage()] : ['success'=>false];
76 79
 		}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * Update a static content widget
64 64
 	 * @return void
65 65
 	 */
66
-	public function actionUpdateContentWidget($content=null)
66
+	public function actionUpdateContentWidget($content = null)
67 67
 	{
68 68
 		$key = neon()->request->post('key');
69 69
 		$content = $content ? $content : neon()->request->postUnsafe('content');
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 		$params = neon()->request->post('params', []);
89 89
 		$renderer = new Renderer(new Page());
90 90
 		$formatParams = '';
91
-		foreach($params as $key => $value) {
91
+		foreach ($params as $key => $value) {
92 92
 			$formatParams .= $key.'="'.$value.'" ';
93 93
 		}
94
-		$out = $renderer->renderString('{'.$tag.' '.$formatParams .' }', false);
94
+		$out = $renderer->renderString('{'.$tag.' '.$formatParams.' }', false);
95 95
 		return $this->getView()->renderAjaxContent($out);
96 96
 	}
97 97
 
Please login to merge, or discard this patch.
neon/cms/migrations/m170106_131700_cms_page.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		$this->run('Generating Page UUIDs and nice_ids', function() {
45 45
 			// the soft delete column has not been added yet - so lets turn off this behaviour!
46 46
 			CmsPage::$softDelete = false;
47
-			foreach(CmsPage::find()->each(100) as $page) {
47
+			foreach (CmsPage::find()->each(100) as $page) {
48 48
 				$page->id = CmsPage::uuid64();
49 49
 				$page->nice_id = "page_{$page->old_id}";
50 50
 				$page->save();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			"UPDATE $cms_url INNER JOIN $cms_page ON $cms_page.nice_id = $cms_url.page_id SET `page_id` = $cms_page.old_id"
93 93
 		);
94 94
 		$this->execute("UPDATE $cms_page SET `id` = `old_id`");
95
-		$this->alterColumn($cms_page, 'id', $this->integer(11) . ' NOT NULL AUTO_INCREMENT');
95
+		$this->alterColumn($cms_page, 'id', $this->integer(11).' NOT NULL AUTO_INCREMENT');
96 96
 		$this->dropColumn($cms_page, 'old_id');
97 97
 		$this->dropColumn($cms_page, 'nice_id');
98 98
 		$this->alterColumn($cms_url, 'page_id', $this->integer(11)->comment('cms_page foreign key'));
Please login to merge, or discard this patch.
deprecatedMigrations/m170112_211700_change_dds_page_ids_to_uuid64.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 
8 8
 class m170112_211700_change_dds_page_ids_to_uuid64 extends Migration
9 9
 {
10
-    public function safeUp()
11
-    {
12
-    	$cms_page = CmsPage::tableName();
13
-    	// Step 1
10
+	public function safeUp()
11
+	{
12
+		$cms_page = CmsPage::tableName();
13
+		// Step 1
14 14
 		// ------
15
-    	// loop through all members in the DDS and find all members with a definition using
15
+		// loop through all members in the DDS and find all members with a definition using
16 16
 		// {class: neon\\cms\\form\\fields\\PageSelector}
17 17
 		// or where the definition uses a `dataMapKey` of `pages` and a `dataMapProvider` of `cms`
18 18
 		$members = neon()->db->query()->select('*')->from('dds_member')->where('definition LIKE \'{"class":"neon__cms__form__fields__PageSelector%\'')->all();
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 			}
48 48
 		}
49 49
 		$this->dropColumn($cms_page, 'old_id');
50
-    }
50
+	}
51 51
 
52
-    public function safeDown()
53
-    {
54
-    	echo "There is no coming back from this!\n";
55
-    }
52
+	public function safeDown()
53
+	{
54
+		echo "There is no coming back from this!\n";
55
+	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
 		// - note the `member_ref` as the $column in the ddt table  - this column will hold the previous integer based page id
28 28
 		//   which will match the cms_page.old_id column
29 29
 		foreach ($members as $member) {
30
-			$class_type =  $member['class_type'];
31
-			$ddt_table_name =  'ddt_' . $class_type;
30
+			$class_type = $member['class_type'];
31
+			$ddt_table_name = 'ddt_'.$class_type;
32 32
 			$column = $member['member_ref'];
33 33
 
34 34
 			// Step 3
35 35
 			// ------
36 36
 			// Alter the $column in $ddt_table_name to be a uuid64 (char(22))
37
-			$exists = $this->db->createCommand("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE `table_name` = '$ddt_table_name' AND `table_schema` = '". env('DB_NAME')."' AND column_name = '$column'")->queryScalar();
37
+			$exists = $this->db->createCommand("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE `table_name` = '$ddt_table_name' AND `table_schema` = '".env('DB_NAME')."' AND column_name = '$column'")->queryScalar();
38 38
 			if ($exists) {
39 39
 				$this->alterColumn($ddt_table_name, $column, $this->char(22)->comment("A uuid using base 64"));
40 40
 				// Update the $column value in every row in the $ddt_table_name by matching it to the cms_page.old_id
Please login to merge, or discard this patch.