Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/phoebe/services/adapters/common/models/PhoebeClassOverrides.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 	/**
122 122
 	 * @inheritdoc
123 123
 	 */
124
-	public function toArray(array $fields=[], array $expand=[], $recursive=true)
124
+	public function toArray(array $fields = [], array $expand = [], $recursive = true)
125 125
 	{
126 126
 		$data = parent::toArray($fields, $expand, $recursive);
127 127
 		unset($data['serialised_overrides']);
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/common/models/PhoebeClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
 		parent::afterFind();
104 104
 	}
105 105
 
106
-	public function toArray(array $fields=[], array $expand=[], $recursive=true)
106
+	public function toArray(array $fields = [], array $expand = [], $recursive = true)
107 107
 	{
108 108
 		$data = parent::toArray($fields, $expand, $recursive);
109 109
 		unset($data['serialised_definition']);
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/common/PhoebeClassBase.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			]
61 61
 		];
62 62
 		foreach ($additionalColumns as $column) {
63
-			switch($column) {
63
+			switch ($column) {
64 64
 				case 'data':
65 65
 					$definition['serialised_data'] = [
66 66
 						'class' => 'neon\core\grid\column\DefinitionColumn',
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		// if we are locking objects to versions then an increase in version needs to
97 97
 		// result in a new row in the phoebeClass relation regardless of changes
98 98
 		$hasChanges = false;
99
-		$newModel=false;
99
+		$newModel = false;
100 100
 		try {
101 101
 			if ($model->version_locked && isset($changes['version']) && $changes['version'] != $model->version) {
102 102
 				$newModel = true;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				$model->attributes = array_merge($oldAttrs, $changes);
105 105
 				$model->updated = date('Y-m-d H:i:s');
106 106
 				if (!$model->save())
107
-					throw new \RuntimeException('Save failed with the following errors '.print_r($model->errors,true));
107
+					throw new \RuntimeException('Save failed with the following errors '.print_r($model->errors, true));
108 108
 				$this->setModel($model);
109 109
 				$hasChanges = true;
110 110
 			} else {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				if ($hasChanges) {
119 119
 					$model->updated = date('Y-m-d H:i:s');
120 120
 					if (!$model->save()) {
121
-						throw new \RuntimeException('Save failed with the following errors: '.print_r($model->errors,true));
121
+						throw new \RuntimeException('Save failed with the following errors: '.print_r($model->errors, true));
122 122
 					}
123 123
 				}
124 124
 			}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	{
140 140
 		$model = $this->getModel();
141 141
 		$oldAttrs = $model->attributes;
142
-		if (($result=$this->modelDelete()) === true) {
142
+		if (($result = $this->modelDelete()) === true) {
143 143
 			$newAttrs = $model->attributes;
144 144
 			$this->createEditClassMigration($newAttrs, $oldAttrs, false);
145 145
 		}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		$model = $this->getModel();
155 155
 		$oldAttrs = $model->attributes;
156
-		if (($result=$this->modelUndelete()) === true) {
156
+		if (($result = $this->modelUndelete()) === true) {
157 157
 			$newAttrs = $model->attributes;
158 158
 			$this->createEditClassMigration($newAttrs, $oldAttrs, false);
159 159
 		}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * Set any overrides onto the class
200 200
 	 * @var array
201 201
 	 */
202
-	protected $_overrides=null;
202
+	protected $_overrides = null;
203 203
 
204 204
 	/**
205 205
 	 * @inheritdoc
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	/**
259 259
 	 * @inheritdoc
260 260
 	 */
261
-	public function findOverride($filters=[])
261
+	public function findOverride($filters = [])
262 262
 	{
263 263
 		return $this->findClassOverride($filters);
264 264
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * @inheritdoc
288 288
 	 */
289
-	public function addOverride($label, $selector='', $activeFrom=null, $activeTo=null, $isActive=true)
289
+	public function addOverride($label, $selector = '', $activeFrom = null, $activeTo = null, $isActive = true)
290 290
 	{
291 291
 		$uuid = Hash::uuid64();
292 292
 		$model = $this->getModel();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		);
321 321
 
322 322
 		// nothing to see here move along
323
-		if (count($changes)===0)
323
+		if (count($changes) === 0)
324 324
 			return true;
325 325
 		// ok now do the edit
326 326
 		$override = $this->getClassOverrideModel($uuid);
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/common/PhoebeTypeBase.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @inheritdoc
32 32
 	 */
33
-	public function listClasses(&$paginator=[], $filters=[], $orderBy=[], $includeDeleted=false)
33
+	public function listClasses(&$paginator = [], $filters = [], $orderBy = [], $includeDeleted = false)
34 34
 	{
35 35
 		// check the inputs
36 36
 		$paginator = $this->createPaginator($paginator);
37
-		$orderBy = count($orderBy)>0 ? $orderBy : 'label ASC';
38
-		$filters = array_intersect_key($filters, array_flip(['class_type','label','description','module']));
37
+		$orderBy = count($orderBy) > 0 ? $orderBy : 'label ASC';
38
+		$filters = array_intersect_key($filters, array_flip(['class_type', 'label', 'description', 'module']));
39 39
 		if (isset($filters['class_type']))
40 40
 			$filters['class_type'] = $this->canonicaliseRef($filters['class_type']);
41 41
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		$query->select($select);
64 64
 		foreach ($filters as $key=>$value)
65 65
 			$query->andWhere(['like', "p1.$key", $value]);
66
-		if ($paginator['start']==0)
66
+		if ($paginator['start'] == 0)
67 67
 			$paginator['total'] = $query->count();
68 68
 
69 69
 		// and get the results
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	/**
83 83
 	 * @inheritdoc
84 84
 	 */
85
-	public function addClass(&$classType, $module='')
85
+	public function addClass(&$classType, $module = '')
86 86
 	{
87 87
 		$classType = $this->canonicaliseRef($classType);
88 88
 		if (empty($classType))
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * @inheritdoc
108 108
 	 */
109
-	public function getClass($classType, $version=null, $classOverrideCriteria=[])
109
+	public function getClass($classType, $version = null, $classOverrideCriteria = [])
110 110
 	{
111 111
 		$classType = $this->canonicaliseRef($classType);
112 112
 		if (empty($classType))
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
 	/**
162 162
 	 * @inheritdoc
163 163
 	 */
164
-	public function listObjects($classType, &$paginator=[], $filters=[], $orderBy=[], $additionalFields=[])
164
+	public function listObjects($classType, &$paginator = [], $filters = [], $orderBy = [], $additionalFields = [])
165 165
 	{
166 166
 
167 167
 		// check the inputs
168 168
 		$classType = $this->canonicaliseRef($classType);
169 169
 		$paginator = $this->createPaginator($paginator);
170
-		$orderBy = count($orderBy)>0 ? $orderBy : 'created DESC';
171
-		$filters = array_intersect_key($filters, array_flip(['version','created','updated']));
170
+		$orderBy = count($orderBy) > 0 ? $orderBy : 'created DESC';
171
+		$filters = array_intersect_key($filters, array_flip(['version', 'created', 'updated']));
172 172
 
173 173
 		$query = ObjectModel::find()->where([
174 174
 			'phoebe_type' => $this->getPhoebeType(),
175 175
 			'class_type' => $classType
176 176
 		]);
177
-		$select = ['uuid','phoebe_type','class_type','version','created','updated'];
177
+		$select = ['uuid', 'phoebe_type', 'class_type', 'version', 'created', 'updated'];
178 178
 
179 179
 		if (in_array('data', $additionalFields))
180 180
 			$select[] = 'serialised_data';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
 		foreach ($filters as $key=>$value)
189 189
 			$query->andWhere(['=', $key, $value]);
190
-		if ($paginator['start']==0)
190
+		if ($paginator['start'] == 0)
191 191
 			$paginator['total'] = $query->count();
192 192
 		// and get the results
193 193
 		return $query->offset($paginator['start'])
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	/**
201 201
 	 * @inheritdoc
202 202
 	 */
203
-	public function addObject($classType, $classOverrideCriteria=[])
203
+	public function addObject($classType, $classOverrideCriteria = [])
204 204
 	{
205 205
 		$class = $this->getClassFromType($classType);
206 206
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *   created automatically or if false then it is left as null.
308 308
 	 * @return neon\phoebe\services\adapters\common\models\PhoebeObject
309 309
 	 */
310
-	protected function createPhoebeObjectModel($classType, $uuid=null)
310
+	protected function createPhoebeObjectModel($classType, $uuid = null)
311 311
 	{
312 312
 		// create a model for the class
313 313
 		$model = new ObjectModel();
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/common/PhoebeBase.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function toArray()
67 67
 	{
68
-		$model =  $this->getModel();
68
+		$model = $this->getModel();
69 69
 		return $model ? $model->toArray() : [];
70 70
 	}
71 71
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 	 *   'start', 'length', and 'total'
144 144
 	 * @return array
145 145
 	 */
146
-	protected function createPaginator($paginator=[])
146
+	protected function createPaginator($paginator = [])
147 147
 	{
148 148
 		return [
149
-			'start'=> (isset($paginator['start']) ? max(0, (int)$paginator['start']) : 0),
150
-			'length'=> (isset($paginator['length']) ? max(1,min(self::CLASS_LIST_LIMIT,(int)$paginator['length'])) : self::CLASS_LIST_LIMIT),
151
-			'total'=> (isset($paginator['total']) ? (int)$paginator['total'] : null)
149
+			'start'=> (isset($paginator['start']) ? max(0, (int) $paginator['start']) : 0),
150
+			'length'=> (isset($paginator['length']) ? max(1, min(self::CLASS_LIST_LIMIT, (int) $paginator['length'])) : self::CLASS_LIST_LIMIT),
151
+			'total'=> (isset($paginator['total']) ? (int) $paginator['total'] : null)
152 152
 		];
153 153
 	}
154 154
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @param string $version
223 223
 	 * @return \neon\phoebe\services\adapters\common\models\PhoebeClass
224 224
 	 */
225
-	protected function getClassModel($classType, $version=null)
225
+	protected function getClassModel($classType, $version = null)
226 226
 	{
227 227
 		$query = ClassModel::find()->where([
228 228
 			'phoebe_type'=>$this->getPhoebeType(),
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 		$fields = [];
297 297
 		$values = [];
298 298
 		foreach ($row as $f=>$v) {
299
-			$fields[]=$f;
299
+			$fields[] = $f;
300 300
 			$values[] = $this->pdoQuote($v);
301 301
 		}
302 302
 		if (count($fields))
303
-			return "REPLACE INTO `$table` (`".(implode('`,`',$fields)).'`) VALUES ('.(implode(",",$values)).");";
303
+			return "REPLACE INTO `$table` (`".(implode('`,`', $fields)).'`) VALUES ('.(implode(",", $values)).");";
304 304
 		return null;
305 305
 	}
306 306
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param array $fields  use these to select a subset of fields returned.
330 330
 	 * @return array  the override
331 331
 	 */
332
-	protected function findClassOverride($filters, $fields=[])
332
+	protected function findClassOverride($filters, $fields = [])
333 333
 	{
334 334
 		$selectFields = [
335 335
 			'uuid', 'label', 'selector', 'is_active', 'active_from', 'active_to', 'serialised_overrides'
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		// convert a request for overrides to serialised_overrides
338 338
 		if ($fields) {
339 339
 			if (in_array('overrides', $fields))
340
-				$fields[] ='serialised_overrides';
340
+				$fields[] = 'serialised_overrides';
341 341
 			$selectFields = array_intersect($selectFields, $fields);
342 342
 		}
343 343
 		$selector = !empty($filters['selector']) ? $filters['selector'] : '';
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/daedalus/PhoebeClass.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function editClass($changes)
56 56
 	{
57 57
 		if (!is_array($changes))
58
-			throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes,true));
58
+			throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes, true));
59 59
 
60 60
 		// make the appropriate changes to dds. Any unknown fields are ignored
61 61
 		$this->dds()->editClass($this->classType, $changes);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		foreach ($fields as $k => $f) {
74 74
 			// map some form to Phoebe differences
75
-			$f['link_class'] = (!empty($f['linkClass']) ? $f['linkClass'] : null);  // named differently
75
+			$f['link_class'] = (!empty($f['linkClass']) ? $f['linkClass'] : null); // named differently
76 76
 			// extract the definition for saving in phoebe
77 77
 			$definition = $f['definition'];
78 78
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 		// and save to phoebe - remove unallowed phoebe values for Daedalus tables
123 123
 		$changes = array_diff_key($changes, array_flip(['version', 'volatile', 'object_history', 'version_locked']));
124
-		if (count($changes)==0)
124
+		if (count($changes) == 0)
125 125
 			return;
126 126
 		$hasChanges = parent::editClass($changes);
127 127
 		return $hasChanges;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	/** --------------------------------------- **/
162 162
 	/** -------- Class Override Methods ------- **/
163 163
 
164
-	public function addOverride($label, $selector='', $activeFrom=null, $activeTo=null, $isActive=true)
164
+	public function addOverride($label, $selector = '', $activeFrom = null, $activeTo = null, $isActive = true)
165 165
 	{
166 166
 		throw new \RuntimeException("Overrides are not available for Daedalus tables");
167 167
 	}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *   reordering the form in the process
194 194
 	 * @return array
195 195
 	 */
196
-	protected function getDefinitionAsForm($excludeDeletedFields=true, array $restrictToFields=[])
196
+	protected function getDefinitionAsForm($excludeDeletedFields = true, array $restrictToFields = [])
197 197
 	{
198 198
 		$fields = [];
199 199
 		$definition = $this->definition;
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/daedalus/PhoebeType.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * Set this up as a daedalus type
48 48
 	 * @param array $config
49 49
 	 */
50
-	public function __construct($config=[])
50
+	public function __construct($config = [])
51 51
 	{
52 52
 		$path = '\neon\phoebe\services\adapters\daedalus';
53 53
 		$config['phoebeType'] = 'daedalus';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/** ------------ Class Methods ----------- **/
96 96
 
97
-	public function listClasses(&$paginator=[], $filters=[], $orderBy=[], $includeDeleted=false)
97
+	public function listClasses(&$paginator = [], $filters = [], $orderBy = [], $includeDeleted = false)
98 98
 	{
99 99
 		$classes = parent::listClasses($paginator, $filters, $orderBy, $includeDeleted);
100 100
 		$this->mergeDaedalusFields($classes);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * @inheritdoc
106 106
 	 */
107
-	public function addClass(&$classType, $module='')
107
+	public function addClass(&$classType, $module = '')
108 108
 	{
109 109
 		$classType = $this->canonicaliseRef($classType);
110 110
 		$class = parent::addClass($classType, $module);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * @inheritdoc
129 129
 	 */
130
-	public function listObjects($classType, &$paginator=[], $filters=[], $orderBy=[], $additionalFields=[])
130
+	public function listObjects($classType, &$paginator = [], $filters = [], $orderBy = [], $additionalFields = [])
131 131
 	{
132 132
 		$filters = null;
133 133
 		// get our data directly from daedalus - objects are not stored in phoebe
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	/**
150 150
 	 * @inheritdoc
151 151
 	 */
152
-	public function addObject($classType, $overrideCriteria=[])
152
+	public function addObject($classType, $overrideCriteria = [])
153 153
 	{
154 154
 		// Daedalus doesn't manage overrides currently
155 155
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				$classes[$ct]['count_current'] = 0;
210 210
 				$classTypes[] = $ct;
211 211
 			}
212
-			$query = "SELECT * FROM dds_class WHERE `class_type` IN ('".implode("','",$classTypes)."')";
212
+			$query = "SELECT * FROM dds_class WHERE `class_type` IN ('".implode("','", $classTypes)."')";
213 213
 			$counts = neon()->db->createCommand($query)->queryAll();
214 214
 			foreach ($counts as $c) {
215 215
 				$classes[$c['class_type']] = array_merge($classes[$c['class_type']], $c);
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/basic/PhoebeClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @inheritdoc
20 20
 	 */
21
-	public function getClassFormDefinition(array $fields=[])
21
+	public function getClassFormDefinition(array $fields = [])
22 22
 	{
23 23
 		return [];
24 24
 	}
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/basic/PhoebeType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 class PhoebeType extends PhoebeTypeBase
16 16
 {
17
-	public function __construct($config=[])
17
+	public function __construct($config = [])
18 18
 	{
19 19
 		$path = '\neon\phoebe\services\adapters\basic';
20 20
 		$config['phoebeType'] = 'basic';
Please login to merge, or discard this patch.