Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/core/Yii.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 
25 25
 spl_autoload_register(['Yii', 'autoload'], true, true);
26 26
 // Ability to replace any yii core class with an alternative
27
-Yii::$classMap = require YII2_PATH . '/classes.php';
27
+Yii::$classMap = require YII2_PATH.'/classes.php';
28 28
 Yii::$container = new yii\di\Container();
Please login to merge, or discard this patch.
neon/core/web/Request.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @throws \yii\base\InvalidConfigException
205 205
 	 * @throws HttpException - if validation fails
206 206
 	 */
207
-	public function validate($data, $rules, $errorCode=400)
207
+	public function validate($data, $rules, $errorCode = 400)
208 208
 	{
209 209
 		$model = $this->validateData($data, $rules);
210 210
 		if ($model->hasErrors()) {
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	 * // $req->hasErrors();
237 237
 	 * ```
238 238
 	 */
239
-	public function validateData($data, $rules, $type="get")
239
+	public function validateData($data, $rules, $type = "get")
240 240
 	{
241 241
 		$validate = [];
242
-		foreach($data as $key => $default)
242
+		foreach ($data as $key => $default)
243 243
 			$validate[$key] = $this->$type($key, $default);
244 244
 		return \yii\base\DynamicModel::validateData($validate, $rules);
245 245
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * used is the $pattern matches the current route
386 386
 	 * @return bool
387 387
 	 */
388
-	public function isRoute($pattern, $params=[])
388
+	public function isRoute($pattern, $params = [])
389 389
 	{
390 390
 		$route = neon()->controller->getRoute();
391 391
 		$match = Str::is(ltrim($pattern, '/'), $route);
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -152,10 +152,12 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function get($name = null, $defaultValue = null)
154 154
 	{
155
-		if ($this->_sanitisedQueryParams == null)
156
-			$this->sanitiseBodyQueryParams();
157
-		if ($name == null)
158
-			return $this->_sanitisedQueryParams;
155
+		if ($this->_sanitisedQueryParams == null) {
156
+					$this->sanitiseBodyQueryParams();
157
+		}
158
+		if ($name == null) {
159
+					return $this->_sanitisedQueryParams;
160
+		}
159 161
 		return isset($this->_sanitisedQueryParams[$name]) ? $this->_sanitisedQueryParams[$name] : $defaultValue;
160 162
 	}
161 163
 
@@ -239,8 +241,9 @@  discard block
 block discarded – undo
239 241
 	public function validateData($data, $rules, $type="get")
240 242
 	{
241 243
 		$validate = [];
242
-		foreach($data as $key => $default)
243
-			$validate[$key] = $this->$type($key, $default);
244
+		foreach($data as $key => $default) {
245
+					$validate[$key] = $this->$type($key, $default);
246
+		}
244 247
 		return \yii\base\DynamicModel::validateData($validate, $rules);
245 248
 	}
246 249
 
@@ -253,10 +256,12 @@  discard block
 block discarded – undo
253 256
 	 */
254 257
 	public function post($name = null, $defaultValue = null)
255 258
 	{
256
-		if ($this->_sanitisedBodyParams == null)
257
-			$this->sanitiseBodyQueryParams();
258
-		if ($name == null)
259
-			return $this->_sanitisedBodyParams;
259
+		if ($this->_sanitisedBodyParams == null) {
260
+					$this->sanitiseBodyQueryParams();
261
+		}
262
+		if ($name == null) {
263
+					return $this->_sanitisedBodyParams;
264
+		}
260 265
 		return isset($this->_sanitisedBodyParams[$name]) ? $this->_sanitisedBodyParams[$name] : $defaultValue;
261 266
 	}
262 267
 
@@ -390,10 +395,14 @@  discard block
 block discarded – undo
390 395
 		$route = neon()->controller->getRoute();
391 396
 		$match = Str::is(ltrim($pattern, '/'), $route);
392 397
 		// we can return imidiately if the route does not match the pattern
393
-		if (!$match) return false;
398
+		if (!$match) {
399
+			return false;
400
+		}
394 401
 
395 402
 		// if no param search specified then return the match
396
-		if (empty($params)) return $match;
403
+		if (empty($params)) {
404
+			return $match;
405
+		}
397 406
 
398 407
 		// Finally check if $params exist in request params
399 408
 		return Arr::isSubset($params, neon()->request->getQueryParams());
Please login to merge, or discard this patch.
neon/core/test/helpers.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use neon\core\helpers\File;
4 4
 
5
-if (! function_exists('neon_test_database_create')) {
5
+if (!function_exists('neon_test_database_create')) {
6 6
 	/**
7 7
 	 * Creates the test database and user
8 8
 	 * Note this does not run the neon installation and create the
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	function neon_test_database_create()
13 13
 	{
14
-		$installDb  = env('INSTALL_TEST_DB', true);
14
+		$installDb = env('INSTALL_TEST_DB', true);
15 15
 		if ($installDb) {
16 16
 			$db = env('DB_NAME');
17 17
 			$host = env('DB_HOST', 'localhost');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 }
54 54
 
55
-if (! function_exists('neon_test_db_cmd')) {
55
+if (!function_exists('neon_test_db_cmd')) {
56 56
 	function neon_test_db_cmd($cmd)
57 57
 	{
58 58
 		// A security risk here?  Mind you if you can run PHP your system is compromised anyway.
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		# use the following line to see any warnings and errors
65 65
 		#exec($c);
66 66
 		# or use this one to suppress them (inc the one about the password)
67
-		exec($c . " 2>/dev/null");
67
+		exec($c." 2>/dev/null");
68 68
 	}
69 69
 }
70 70
 
71
-if (! function_exists('neon_test_server_restart')) {
71
+if (!function_exists('neon_test_server_restart')) {
72 72
 	/**
73 73
 	 * Restart a test server
74 74
 	 * @param $name
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 	 * @param int $port
77 77
 	 * @throws Exception
78 78
 	 */
79
-	function neon_test_server_restart($name='test_server', $docRoot=DIR_TEST.'/_root/public', $port=8888)
79
+	function neon_test_server_restart($name = 'test_server', $docRoot = DIR_TEST.'/_root/public', $port = 8888)
80 80
 	{
81 81
 		neon_test_server_stop($name);
82 82
 		echo "\nRestarting test server...\n";
83 83
 		// clear the cache
84
-		File::removeDirectory(DIR_TEST . '/_root/var');
85
-		File::removeDirectory(DIR_TEST . '/_root/system');
84
+		File::removeDirectory(DIR_TEST.'/_root/var');
85
+		File::removeDirectory(DIR_TEST.'/_root/system');
86 86
 		neon_test_server_start($name, $docRoot, $port, true);
87 87
 	}
88 88
 }
89 89
 
90
-if (! function_exists('neon_test_server_start')) {
90
+if (!function_exists('neon_test_server_start')) {
91 91
 	/**
92 92
 	 * Spin up the test server to run the acceptance tests against
93 93
 	 * @param string $name
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return \Symfony\Component\Process\Process
97 97
 	 * @throws Exception
98 98
 	 */
99
-	function neon_test_server_start($name='test_server', $docRoot=DIR_TEST.'/_root/public', $port=8888, $silent=false)
99
+	function neon_test_server_start($name = 'test_server', $docRoot = DIR_TEST.'/_root/public', $port = 8888, $silent = false)
100 100
 	{
101 101
 		if (preg_match("/[^a-z0-9_]/", $name) !== 0) {
102 102
 			throw new \Exception('The name must contain only [a-z0-9_] characters');
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		 * Tests are run against this server
107 107
 		 */
108 108
 		$address = "localhost:$port";
109
-		$command = PHP_BINARY . " -S {$address} -t {$docRoot}";
109
+		$command = PHP_BINARY." -S {$address} -t {$docRoot}";
110 110
 		if (!$silent) {
111 111
 			echo "\n|======================================================";
112 112
 			echo "\n| Creating Test Server";
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 		$process = \neon\core\test\ProcessForker::run($name, $command);
125 125
 		try {
126
-			retry(10, function () use ($address) {
126
+			retry(10, function() use ($address) {
127 127
 				$client = new GuzzleHttp\Client();
128 128
 				$res = $client->request('GET', $address);
129
-				echo ' - Server running with code: ' . $res->getStatusCode() . "\n";
129
+				echo ' - Server running with code: '.$res->getStatusCode()."\n";
130 130
 			}, 1000);
131
-		} catch(GuzzleHttp\Exception\ConnectException $e) {
131
+		} catch (GuzzleHttp\Exception\ConnectException $e) {
132 132
 			throw new \Exception('Unable to connect to the local test server');
133 133
 		}
134 134
 		return $process;
135 135
 	}
136 136
 }
137 137
 
138
-if (! function_exists('retry')) {
138
+if (!function_exists('retry')) {
139 139
 	/**
140 140
 	 * Retry an operation a given number of times.
141 141
 	 *
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		try {
154 154
 			return $callback();
155 155
 		} catch (\Exception $e) {
156
-			if (! $times) {
156
+			if (!$times) {
157 157
 				throw $e;
158 158
 			}
159 159
 			$times--;
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	}
166 166
 }
167 167
 
168
-if (! function_exists('neon_test_server_stop')) {
168
+if (!function_exists('neon_test_server_stop')) {
169 169
 	/**
170 170
 	 * Spin up the test server to run the acceptance tests against
171 171
 	 * @param string $name
172 172
 	 * @throws \Exception if name is not formatted correctly
173 173
 	 */
174
-	function neon_test_server_stop($name='test_server')
174
+	function neon_test_server_stop($name = 'test_server')
175 175
 	{
176 176
 		if (preg_match("/[^a-z0-9_]/", $name) !== 0) {
177 177
 			throw new \Exception('The name must contain only [a-z0-9_] characters');
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 }
183 183
 
184
-if (! function_exists('test_url')) {
184
+if (!function_exists('test_url')) {
185 185
 	/**
186 186
 	 * Return the test url
187 187
 	 */
Please login to merge, or discard this patch.
neon/core/test/WebBrowserDriver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		parent::__construct($config, $options);
36 36
 		// Set default path for ChromeDriver
37 37
 		if (!isset($this->config['path'])) {
38
-			$this->config['path'] = __DIR__ . '/bin/'.$this->chromeVersion.'/chromedriver-' . $this->getDriverSuffix();
38
+			$this->config['path'] = __DIR__.'/bin/'.$this->chromeVersion.'/chromedriver-'.$this->getDriverSuffix();
39 39
 		}
40 40
 		// Set default WebDriver port
41 41
 		if (!isset($this->config['port'])) {
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 		}
82 82
 		$descriptorSpec = array(
83 83
 			array('pipe', 'r'),
84
-			array('file', $this->getLogDir() . 'ChromeDriver.output.txt', 'w'),
85
-			array('file', $this->getLogDir() . 'ChromeDriver.errors.txt', 'a')
84
+			array('file', $this->getLogDir().'ChromeDriver.output.txt', 'w'),
85
+			array('file', $this->getLogDir().'ChromeDriver.errors.txt', 'a')
86 86
 		);
87 87
 		$this->resource = proc_open($command, $descriptorSpec, $this->pipes, null, null, array('bypass_shell' => true));
88 88
 		if (!is_resource($this->resource) || !proc_get_status($this->resource)['running']) {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 					// Make sure the value is true/false and not 1/0
171 171
 					$configValue = ($configValue) ? 'true' : 'false';
172 172
 				}
173
-				$params[] = $mapping[$configKey] . '=' . $configValue;
173
+				$params[] = $mapping[$configKey].'='.$configValue;
174 174
 			}
175 175
 		}
176 176
 		return implode(' ', $params);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		// Prefix command with exec on non Windows systems to ensure that we receive the correct pid.
184 184
 		// See http://php.net/manual/en/function.proc-get-status.php#93382
185 185
 		$commandPrefix = $this->isWindows() ? '' : 'exec ';
186
-		return $commandPrefix . escapeshellarg(realpath($this->config['path'])) . ' ' . $this->getCommandParameters() . ' --url-base=/wd/hub';
186
+		return $commandPrefix.escapeshellarg(realpath($this->config['path'])).' '.$this->getCommandParameters().' --url-base=/wd/hub';
187 187
 	}
188 188
 	/**
189 189
 	 * Checks if the current machine is Windows.
Please login to merge, or discard this patch.
neon/core/db/Connection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	{
87 87
 		$currentVersion = neon()->getVersion();
88 88
 		$dbName = env('DB_NAME');
89
-		$filename = gmdate('ymd_His') . '_' . $dbName . '_' . $currentVersion . '.sql';
89
+		$filename = gmdate('ymd_His').'_'.$dbName.'_'.$currentVersion.'.sql';
90 90
 		return $this->getBackupDirectory()."/$filename";
91 91
 	}
92 92
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			'--dump-date',
110 110
 			'--no-autocommit',
111 111
 			'--routines',
112
-			'--default-character-set=' . $this->charset,
112
+			'--default-character-set='.$this->charset,
113 113
 			'--set-charset',
114 114
 			'--triggers',
115 115
 			'--host='.env('DB_HOST'),
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function restore($path)
137 137
 	{
138
-		$process = new Process('mysql ' . env('DB_NAME') . ' < "' . $path . '"');
138
+		$process = new Process('mysql '.env('DB_NAME').' < "'.$path.'"');
139 139
 		$result = $process->run();
140 140
 		if (!$process->isSuccessful()) {
141 141
 			throw new ProcessFailedException($process);
Please login to merge, or discard this patch.
neon/core/db/TreeRecord.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param int $depth
78 78
 	 * @return int
79 79
 	 */
80
-	public function rebuildTree($parent, $left, $depth=0)
80
+	public function rebuildTree($parent, $left, $depth = 0)
81 81
 	{
82 82
 		// the right value of this node is the left value + 1
83 83
 		$right = $left + 1;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @throws \Exception|\Throwable
118 118
 	 * @return TreeRecord the child added
119 119
 	 */
120
-	public function addChild(TreeRecord $node, callable $callable=null) : TreeRecord
120
+	public function addChild(TreeRecord $node, callable $callable = null) : TreeRecord
121 121
 	{
122 122
 		$result = static::addAsLastChildOf($this, $node);
123 123
 		if ($callable) $callable($node);
Please login to merge, or discard this patch.
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function makeRoot()
62 62
 	{
63
-		if (static::find()->root()->exists())
64
-			throw new \Exception('You can only create one root node');
63
+		if (static::find()->root()->exists()) {
64
+					throw new \Exception('You can only create one root node');
65
+		}
65 66
 		$this->tree_left = 1;
66 67
 		$this->tree_right = 2;
67 68
 		$this->tree_depth = 0;
@@ -120,7 +121,9 @@  discard block
 block discarded – undo
120 121
 	public function addChild(TreeRecord $node, callable $callable=null) : TreeRecord
121 122
 	{
122 123
 		$result = static::addAsLastChildOf($this, $node);
123
-		if ($callable) $callable($node);
124
+		if ($callable) {
125
+			$callable($node);
126
+		}
124 127
 		return $node;
125 128
 	}
126 129
 
@@ -155,8 +158,9 @@  discard block
 block discarded – undo
155 158
 	 */
156 159
 	public function moveAsFirstChildOf(TreeRecord $parent)
157 160
 	{
158
-		if ($parent === $this || $this->isAncestorOf($parent))
159
-			throw new \Excepton("Cannot move node as first child of itself or into a descendant");
161
+		if ($parent === $this || $this->isAncestorOf($parent)) {
162
+					throw new \Excepton("Cannot move node as first child of itself or into a descendant");
163
+		}
160 164
 		$oldDepth = $this->tree_depth;
161 165
 		$this->tree_left = $parent->tree_depth + 1;
162 166
 		$this->tree_parent = $parent->getPrimaryKey();
@@ -230,12 +234,15 @@  discard block
 block discarded – undo
230 234
 	public static function validateAdd(TreeRecord $parent, TreeRecord $node)
231 235
 	{
232 236
 		// cannot insert as child of itself
233
-		if ($parent === $node)
234
-			throw new \Exception("Cannot insert node as last child of itself");
235
-		if ($parent->getIsNewRecord())
236
-			throw new \Exception('The parent node must exist.');
237
-		if ($node->tree_depth === 0 && $parent->isRoot())
238
-			throw new \Exception('Can not put a root node inside another root node');
237
+		if ($parent === $node) {
238
+					throw new \Exception("Cannot insert node as last child of itself");
239
+		}
240
+		if ($parent->getIsNewRecord()) {
241
+					throw new \Exception('The parent node must exist.');
242
+		}
243
+		if ($node->tree_depth === 0 && $parent->isRoot()) {
244
+					throw new \Exception('Can not put a root node inside another root node');
245
+		}
239 246
 	}
240 247
 
241 248
 	/**
Please login to merge, or discard this patch.
neon/core/db/TreeQuery.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			$columns = ['tree_root' => SORT_ASC] + $columns;
40 40
 		}
41 41
 
42
-		$this->andWhere(['tree_right' => new Expression($db->quoteColumnName('tree_left') . ' + 1')])
42
+		$this->andWhere(['tree_right' => new Expression($db->quoteColumnName('tree_left').' + 1')])
43 43
 			->addOrderBy($columns);
44 44
 
45 45
 		return $this;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param null $parent
70 70
 	 * @param null $root
71 71
 	 */
72
-	public function getProperties(&$left=null, &$right=null, &$parent=null, &$root=null)
72
+	public function getProperties(&$left = null, &$right = null, &$parent = null, &$root = null)
73 73
 	{
74 74
 		$model = new $this->modelClass();
75 75
 		$model->getPropertes($left, $right, $parent, $root);
Please login to merge, or discard this patch.
neon/core/console/CacheController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 		$r = new Renderer();
46 46
 		$r->smarty->clearCompiledTemplate();
47 47
 		$r->smarty->clearAllCache();
48
-		foreach(neon()->view->renderers as $ext => $config) {
48
+		foreach (neon()->view->renderers as $ext => $config) {
49 49
 			$renderer = neon()->view->getRendererByExtension($ext);
50 50
 			if ($renderer instanceof ICanFlushTemplates) {
51 51
 				$renderer->flushTemplates();
Please login to merge, or discard this patch.
neon/daedalus/services/ddsManager/DdsCore.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$member = $storage[$memberRef];
112 112
 		// handle some storage differences
113 113
 		$columnCheck = substr($member['column'], 0, 4);
114
-		if ($columnCheck=='CHAR' || $columnCheck=='UUID') {
114
+		if ($columnCheck == 'CHAR' || $columnCheck == 'UUID') {
115 115
 			$size = (isset($member['definition']['size'])) ? $member['definition']['size'] : 150;
116 116
 			$member['column'] = str_replace($columnCheck, "CHAR($size)", $member['column']);
117 117
 		}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 * @return []  array of ['member_ref']=>['data_type_ref', 'column', 'index']
161 161
 	 *  where column is the db column type
162 162
 	 */
163
-	protected function getMemberStorage($classType, $memberRef=null)
163
+	protected function getMemberStorage($classType, $memberRef = null)
164 164
 	{
165 165
 		$boundValues = [];
166
-		$query =<<<EOQ
166
+		$query = <<<EOQ
167 167
 SELECT `m`.`member_ref`, `s`.`type`, d.`definition` FROM dds_member m
168 168
 JOIN `dds_data_type` d ON `m`.`data_type_ref`=d.`data_type_ref`
169 169
 JOIN `dds_storage` s ON `d`.`storage_ref`=s.`storage_ref`
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			$memberStorage[$r['member_ref']] = [
183 183
 				'column' => $this->getColumnType($r['type']),
184 184
 				'index' => $this->getIndexType($r['type']),
185
-				'definition' => empty($r['definition']) ? null : json_decode($r['definition'],true)
185
+				'definition' => empty($r['definition']) ? null : json_decode($r['definition'], true)
186 186
 			];
187 187
 		}
188 188
 		return $memberStorage;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			case 'BINARY_LONG': $type = "LONGBLOB"; break;
210 210
 			case 'CHAR': $type = "CHAR"; break;
211 211
 			case 'UUID': $type = "UUID"; break;
212
-			default: $type="UNKNOWN STORAGE TYPE $storageType"; break;
212
+			default: $type = "UNKNOWN STORAGE TYPE $storageType"; break;
213 213
 		}
214 214
 		$collation = $this->getCollation($storageType);
215 215
 		if ($collation)
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @throws \InvalidArgumentException if class not found and $throwException is true
285 285
 	 * @return boolean  whether or not found
286 286
 	 */
287
-	protected function findClass($classType, &$class=null, $throwException=false)
287
+	protected function findClass($classType, &$class = null, $throwException = false)
288 288
 	{
289 289
 		$ct = $this->canonicaliseRef($classType);
290 290
 		if (empty(self::$_classCache[$ct])) {
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
 	/**
334 334
 	 * @see IDdsClassManagement::listMembers
335 335
 	 */
336
-	protected function listMembersForClass($classType, $includeDeleted=false, $keyBy='member_ref')
336
+	protected function listMembersForClass($classType, $includeDeleted = false, $keyBy = 'member_ref')
337 337
 	{
338 338
 		if (!is_string($classType))
339 339
 			throw new \InvalidArgumentException('The class type $classType parameter should be a string');
340 340
 		$select = ['member_ref', 'label', 'data_type_ref', 'description', 'choices', 'map_field', 'link_class'];
341 341
 		if (!empty($keyBy) && !in_array($keyBy, $select))
342
-			throw new \InvalidArgumentException("Parameter keyBy must be empty or one of ".print_r($select,true));
342
+			throw new \InvalidArgumentException("Parameter keyBy must be empty or one of ".print_r($select, true));
343 343
 
344 344
 		// see if we have a cached version or getting from the database
345 345
 		if (empty(static::$_classMembersCache[$classType][$includeDeleted])) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	protected function setClassMapMemberCache($classType, $member)
392 392
 	{
393
-		static::$_classMemberMapCache[$classType]=$member;
393
+		static::$_classMemberMapCache[$classType] = $member;
394 394
 	}
395 395
 
396 396
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 * @param \neon\daedalus\services\ddsManager\models\DdsDataType &$dataType
400 400
 	 * @return boolean  whether or not found
401 401
 	 */
402
-	protected function findDataType($dataTypeRef, &$dataType=null)
402
+	protected function findDataType($dataTypeRef, &$dataType = null)
403 403
 	{
404 404
 		$dataType = DdsDataType::findOne(['data_type_ref'=>$dataTypeRef]);
405 405
 		return ($dataType !== null);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param char $separator  the single character separator to split the string into its parts
454 454
 	 * @return string  the canonicalised result
455 455
 	 */
456
-	protected function canonicaliseRefByParts($ref, $separator=".")
456
+	protected function canonicaliseRefByParts($ref, $separator = ".")
457 457
 	{
458 458
 		$parts = explode($separator, $ref);
459 459
 		$canons = [];
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @param $ref
468 468
 	 * @return string
469 469
 	 */
470
-	protected function quoteField($ref, $ddsObjectAlias='o')
470
+	protected function quoteField($ref, $ddsObjectAlias = 'o')
471 471
 	{
472 472
 		if (in_array($ref, ['_uuid', '_created', '_updated', '_class_ref'])) {
473 473
 			return "`$ddsObjectAlias`.`$ref`";
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		try {
488 488
 			$this->canonicaliseFiltersRecursive($filters);
489 489
 		} catch (\InvalidArgumentException $ex) {
490
-			throw new \InvalidArgumentException($ex->getMessage()." Filters passed in: ".print_r($filters,true));
490
+			throw new \InvalidArgumentException($ex->getMessage()." Filters passed in: ".print_r($filters, true));
491 491
 		}
492 492
 		return $filters;
493 493
 	}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	protected function canonicaliseFiltersRecursive(&$filters)
503 503
 	{
504 504
 		// is this a filter clause or set of filter clauses??
505
-		if (!is_array($filters) || count($filters)==0)
505
+		if (!is_array($filters) || count($filters) == 0)
506 506
 			return;
507 507
 
508 508
 		// recursively descend until one finds a filter clause
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 		}
514 514
 		// so canonicalise a filter clause
515 515
 		if (array_key_exists(0, $filters))
516
-			$this->canonicaliseFilter($filters[0],0);
516
+			$this->canonicaliseFilter($filters[0], 0);
517 517
 		if (array_key_exists(1, $filters))
518
-			$this->canonicaliseFilter($filters[1],1);
518
+			$this->canonicaliseFilter($filters[1], 1);
519 519
 
520 520
 		// Handle nulls passed as values
521 521
 		// ['field', '=', null] and ['field', '!=', null]
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		}
545 545
 		if ($key === 1) {
546 546
 			// accept only these operators
547
-			switch(strtolower($item)) {
547
+			switch (strtolower($item)) {
548 548
 				case '=': case '!=':
549 549
 				case '<': case '<=':
550 550
 				case '>': case '>=':
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	{
580 580
 		// check there are no integer keys as this means not all keys are in the logic
581 581
 		foreach ($keys as $k) {
582
-			if ((int)$k === $k) {
582
+			if ((int) $k === $k) {
583 583
 				throw new \InvalidArgumentException("Daedalus: You have provided a logic string to the query, but it looks like not all filter clauses have a logic name added to them. All filter clauses need to represented in the logic statement.");
584 584
 			}
585 585
 		}
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 			['AND', 'and', 'NOT', 'not', 'OR', 'or', ' ', ')', '('],
591 591
 			'', $subLogic
592 592
 		);
593
-		if (strlen($subLogic)>0)
594
-			throw new \InvalidArgumentException("Daedalus: Invalid logic operator provided. Maybe you haven't defined all keys or have other logic than 'AND', 'OR', 'NOT' and '(',')' characters in your logic? You have defined the keys as ".print_r($keys, true)." for a logic statement of ".print_r($logic,true)." The remaining characters are ".print_r($subLogic,true));
593
+		if (strlen($subLogic) > 0)
594
+			throw new \InvalidArgumentException("Daedalus: Invalid logic operator provided. Maybe you haven't defined all keys or have other logic than 'AND', 'OR', 'NOT' and '(',')' characters in your logic? You have defined the keys as ".print_r($keys, true)." for a logic statement of ".print_r($logic, true)." The remaining characters are ".print_r($subLogic, true));
595 595
 		return $logic;
596 596
 	}
597 597
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 				switch ($drn) {
628 628
 					case 'ASC': case 'DESC':
629 629
 						// allow -ve key starts for nulls last in MySql
630
-						if (strpos($k,'-') === 0)
630
+						if (strpos($k, '-') === 0)
631 631
 							$canon['-'.$this->quoteField($k)] = $drn;
632 632
 						else
633 633
 							$canon[$this->quoteField($k)] = $drn;
@@ -651,10 +651,10 @@  discard block
 block discarded – undo
651 651
 	protected function canonicaliseLimit($limit, &$total, &$calculateTotal)
652 652
 	{
653 653
 		$canon = [];
654
-		$total=null;
654
+		$total = null;
655 655
 		$calculateTotal = false;
656 656
 		if (is_array($limit)) {
657
-			$canon = ['start'=>0,'length'=>self::MAX_LENGTH];
657
+			$canon = ['start'=>0, 'length'=>self::MAX_LENGTH];
658 658
 			foreach ($limit as $k=>$v) {
659 659
 				$key = strtolower($k);
660 660
 				switch ($key) {
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 					case 'total':
668 668
 						// $v can be truthy or the previous integer
669 669
 						$total = is_numeric($v) ? (int) $v : null;
670
-						$calculateTotal = ($v===true || $v==='true');
670
+						$calculateTotal = ($v === true || $v === 'true');
671 671
 					break;
672 672
 				}
673 673
 			}
@@ -682,14 +682,14 @@  discard block
 block discarded – undo
682 682
 	 * @param [] $row  the row of data to be converted
683 683
 	 * @param string $classTypeKey the key in the data that will give the class type
684 684
 	 */
685
-	protected function convertFromDBToPHP(&$row, $links=[], $classTypeKey='_class_type')
685
+	protected function convertFromDBToPHP(&$row, $links = [], $classTypeKey = '_class_type')
686 686
 	{
687 687
 		$classType = $row[$classTypeKey];
688 688
 		$members = $this->getClassMembers($classType);
689 689
 		// now process only the member defined fields:
690 690
 		foreach ($row as $key => &$value) {
691 691
 			if (isset($members[$key])) {
692
-				$memberLinks = isset($links[$key])?$links[$key]:[];
692
+				$memberLinks = isset($links[$key]) ? $links[$key] : [];
693 693
 				$this->doConversionFromDBToPHP($members[$key], $value, $memberLinks);
694 694
 			}
695 695
 		}
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 	 * @param string $dataType the data type ref of the value
702 702
 	 * @param mixed $value  the value returned by the database
703 703
 	 */
704
-	protected function doConversionFromDBToPHP($member, &$value, $memberLinks=[])
704
+	protected function doConversionFromDBToPHP($member, &$value, $memberLinks = [])
705 705
 	{
706
-		switch($member['data_type_ref']) {
706
+		switch ($member['data_type_ref']) {
707 707
 			case 'choice':
708 708
 				// silently ignore deleted old choice as no longer valid
709 709
 				if (is_array($member['choices']) && isset($member['choices'][$value])) {
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	protected function doConversionFromPHPToDB($member, &$value, &$links)
767 767
 	{
768 768
 		$links = null;
769
-		switch($member['data_type_ref']) {
769
+		switch ($member['data_type_ref']) {
770 770
 			case 'choice':
771 771
 				// convert from the value array to the key if the array
772 772
 				// the array was returned
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	 * @param array $dataTypes  add to restrict members to certain types
803 803
 	 * @return array the members
804 804
 	 */
805
-	protected function getClassMembers($classType, array $dataTypes=[])
805
+	protected function getClassMembers($classType, array $dataTypes = [])
806 806
 	{
807 807
 		static $_classMembers = [];
808 808
 		if (!array_key_exists($classType, $_classMembers)) {
@@ -881,11 +881,11 @@  discard block
 block discarded – undo
881 881
 		$fields = [];
882 882
 		$values = [];
883 883
 		foreach ($row as $f=>$v) {
884
-			$fields[]=$f;
884
+			$fields[] = $f;
885 885
 			$values[] = $this->pdoQuote($v);
886 886
 		}
887 887
 		if (count($fields))
888
-			return "REPLACE INTO `$table` (`".(implode('`,`',$fields)).'`) VALUES ('.(implode(",",$values)).");";
888
+			return "REPLACE INTO `$table` (`".(implode('`,`', $fields)).'`) VALUES ('.(implode(",", $values)).");";
889 889
 		return null;
890 890
 	}
891 891
 
Please login to merge, or discard this patch.
Braces   +94 added lines, -64 removed lines patch added patch discarded remove patch
@@ -99,8 +99,9 @@  discard block
 block discarded – undo
99 99
 		$tableName = $this->getTableFromClassType($classType);
100 100
 		$upSql = $this->getDropTableSql($classType);
101 101
 		$downSql = $this->getCreateTableSql($tableName);
102
-		foreach ($upSql as $up)
103
-			neon()->db->createCommand($up)->execute();
102
+		foreach ($upSql as $up) {
103
+					neon()->db->createCommand($up)->execute();
104
+		}
104 105
 		$this->storeMigration($upSql, $downSql);
105 106
 	}
106 107
 
@@ -212,8 +213,9 @@  discard block
 block discarded – undo
212 213
 			default: $type="UNKNOWN STORAGE TYPE $storageType"; break;
213 214
 		}
214 215
 		$collation = $this->getCollation($storageType);
215
-		if ($collation)
216
-			return "$type $collation DEFAULT NULL ";
216
+		if ($collation) {
217
+					return "$type $collation DEFAULT NULL ";
218
+		}
217 219
 		return "$type DEFAULT NULL ";
218 220
 	}
219 221
 
@@ -291,8 +293,9 @@  discard block
 block discarded – undo
291 293
 			self::$_classCache[$ct] = DdsClass::findOne(['class_type' => $ct]);
292 294
 		}
293 295
 		$class = self::$_classCache[$ct];
294
-		if (!$class && $throwException)
295
-			throw new \InvalidArgumentException('Unknown class type "'.$ct.'"');
296
+		if (!$class && $throwException) {
297
+					throw new \InvalidArgumentException('Unknown class type "'.$ct.'"');
298
+		}
296 299
 		return ($class !== null);
297 300
 	}
298 301
 
@@ -335,32 +338,38 @@  discard block
 block discarded – undo
335 338
 	 */
336 339
 	protected function listMembersForClass($classType, $includeDeleted=false, $keyBy='member_ref')
337 340
 	{
338
-		if (!is_string($classType))
339
-			throw new \InvalidArgumentException('The class type $classType parameter should be a string');
341
+		if (!is_string($classType)) {
342
+					throw new \InvalidArgumentException('The class type $classType parameter should be a string');
343
+		}
340 344
 		$select = ['member_ref', 'label', 'data_type_ref', 'description', 'choices', 'map_field', 'link_class'];
341
-		if (!empty($keyBy) && !in_array($keyBy, $select))
342
-			throw new \InvalidArgumentException("Parameter keyBy must be empty or one of ".print_r($select,true));
345
+		if (!empty($keyBy) && !in_array($keyBy, $select)) {
346
+					throw new \InvalidArgumentException("Parameter keyBy must be empty or one of ".print_r($select,true));
347
+		}
343 348
 
344 349
 		// see if we have a cached version or getting from the database
345 350
 		if (empty(static::$_classMembersCache[$classType][$includeDeleted])) {
346 351
 			$query = DdsMember::find()->where(['class_type' => $classType]);
347
-			if ($includeDeleted)
348
-				$select[] = 'deleted';
349
-			else
350
-				$query->andWhere(['deleted' => 0]);
352
+			if ($includeDeleted) {
353
+							$select[] = 'deleted';
354
+			} else {
355
+							$query->andWhere(['deleted' => 0]);
356
+			}
351 357
 			$rows = $query->select($select)->orderBy('created')->asArray()->all();
352
-			foreach ($rows as $k=>$r)
353
-				$rows[$k]['choices'] = json_decode($r['choices'], true);
358
+			foreach ($rows as $k=>$r) {
359
+							$rows[$k]['choices'] = json_decode($r['choices'], true);
360
+			}
354 361
 			static::$_classMembersCache[$classType][$includeDeleted] = $rows;
355 362
 		}
356 363
 
357
-		if (empty($keyBy))
358
-			return static::$_classMembersCache[$classType][$includeDeleted];
364
+		if (empty($keyBy)) {
365
+					return static::$_classMembersCache[$classType][$includeDeleted];
366
+		}
359 367
 
360 368
 		// key by a particular ref
361 369
 		$results = [];
362
-		foreach (static::$_classMembersCache[$classType][$includeDeleted] as $r)
363
-			$results[$r[$keyBy]] = $r;
370
+		foreach (static::$_classMembersCache[$classType][$includeDeleted] as $r) {
371
+					$results[$r[$keyBy]] = $r;
372
+		}
364 373
 
365 374
 		return $results;
366 375
 	}
@@ -457,8 +466,9 @@  discard block
 block discarded – undo
457 466
 	{
458 467
 		$parts = explode($separator, $ref);
459 468
 		$canons = [];
460
-		foreach ($parts as $p)
461
-			$canons[] = $this->canonicaliseRef($p);
469
+		foreach ($parts as $p) {
470
+					$canons[] = $this->canonicaliseRef($p);
471
+		}
462 472
 		return implode($separator, $canons);
463 473
 	}
464 474
 
@@ -482,8 +492,9 @@  discard block
 block discarded – undo
482 492
 	 */
483 493
 	protected function canonicaliseFilters($filters)
484 494
 	{
485
-		if (!is_array($filters))
486
-			return [];
495
+		if (!is_array($filters)) {
496
+					return [];
497
+		}
487 498
 		try {
488 499
 			$this->canonicaliseFiltersRecursive($filters);
489 500
 		} catch (\InvalidArgumentException $ex) {
@@ -502,20 +513,24 @@  discard block
 block discarded – undo
502 513
 	protected function canonicaliseFiltersRecursive(&$filters)
503 514
 	{
504 515
 		// is this a filter clause or set of filter clauses??
505
-		if (!is_array($filters) || count($filters)==0)
506
-			return;
516
+		if (!is_array($filters) || count($filters)==0) {
517
+					return;
518
+		}
507 519
 
508 520
 		// recursively descend until one finds a filter clause
509 521
 		if (is_array($filters[0])) {
510
-			foreach ($filters as &$f)
511
-				$this->canonicaliseFiltersRecursive($f);
522
+			foreach ($filters as &$f) {
523
+							$this->canonicaliseFiltersRecursive($f);
524
+			}
512 525
 			return;
513 526
 		}
514 527
 		// so canonicalise a filter clause
515
-		if (array_key_exists(0, $filters))
516
-			$this->canonicaliseFilter($filters[0],0);
517
-		if (array_key_exists(1, $filters))
518
-			$this->canonicaliseFilter($filters[1],1);
528
+		if (array_key_exists(0, $filters)) {
529
+					$this->canonicaliseFilter($filters[0],0);
530
+		}
531
+		if (array_key_exists(1, $filters)) {
532
+					$this->canonicaliseFilter($filters[1],1);
533
+		}
519 534
 
520 535
 		// Handle nulls passed as values
521 536
 		// ['field', '=', null] and ['field', '!=', null]
@@ -590,8 +605,9 @@  discard block
 block discarded – undo
590 605
 			['AND', 'and', 'NOT', 'not', 'OR', 'or', ' ', ')', '('],
591 606
 			'', $subLogic
592 607
 		);
593
-		if (strlen($subLogic)>0)
594
-			throw new \InvalidArgumentException("Daedalus: Invalid logic operator provided. Maybe you haven't defined all keys or have other logic than 'AND', 'OR', 'NOT' and '(',')' characters in your logic? You have defined the keys as ".print_r($keys, true)." for a logic statement of ".print_r($logic,true)." The remaining characters are ".print_r($subLogic,true));
608
+		if (strlen($subLogic)>0) {
609
+					throw new \InvalidArgumentException("Daedalus: Invalid logic operator provided. Maybe you haven't defined all keys or have other logic than 'AND', 'OR', 'NOT' and '(',')' characters in your logic? You have defined the keys as ".print_r($keys, true)." for a logic statement of ".print_r($logic,true)." The remaining characters are ".print_r($subLogic,true));
610
+		}
595 611
 		return $logic;
596 612
 	}
597 613
 
@@ -627,10 +643,11 @@  discard block
 block discarded – undo
627 643
 				switch ($drn) {
628 644
 					case 'ASC': case 'DESC':
629 645
 						// allow -ve key starts for nulls last in MySql
630
-						if (strpos($k,'-') === 0)
631
-							$canon['-'.$this->quoteField($k)] = $drn;
632
-						else
633
-							$canon[$this->quoteField($k)] = $drn;
646
+						if (strpos($k,'-') === 0) {
647
+													$canon['-'.$this->quoteField($k)] = $drn;
648
+						} else {
649
+													$canon[$this->quoteField($k)] = $drn;
650
+						}
634 651
 					break;
635 652
 					case 'RAND':
636 653
 						$canon['RAND'] = 'RAND';
@@ -718,14 +735,16 @@  discard block
 block discarded – undo
718 735
 				if (!empty($choices) && is_array($choices)) {
719 736
 					foreach ($choices as $choice) {
720 737
 						// silently ignore deleted old choice as no longer valid
721
-						if (isset($member['choices'][$choice]))
722
-							$value[] = ['key'=>$choice, 'value'=>$member['choices'][$choice]];
738
+						if (isset($member['choices'][$choice])) {
739
+													$value[] = ['key'=>$choice, 'value'=>$member['choices'][$choice]];
740
+						}
723 741
 					}
724 742
 				}
725 743
 			break;
726 744
 			case 'boolean':
727
-				if ($value === NULL)
728
-					return;
745
+				if ($value === NULL) {
746
+									return;
747
+				}
729 748
 				$value = !!$value;
730 749
 			break;
731 750
 			case 'json': $value = json_decode($value, true); break;
@@ -750,8 +769,9 @@  discard block
 block discarded – undo
750 769
 			$itemLinks = null;
751 770
 			if (isset($members[$key])) {
752 771
 				$this->doConversionFromPHPToDB($members[$key], $value, $itemLinks);
753
-				if ($itemLinks !== null)
754
-					$links[$key] = $itemLinks;
772
+				if ($itemLinks !== null) {
773
+									$links[$key] = $itemLinks;
774
+				}
755 775
 			}
756 776
 		}
757 777
 	}
@@ -770,16 +790,18 @@  discard block
 block discarded – undo
770 790
 			case 'choice':
771 791
 				// convert from the value array to the key if the array
772 792
 				// the array was returned
773
-				if (is_array($value) && isset($value['key']))
774
-					$value = $value['key'];
793
+				if (is_array($value) && isset($value['key'])) {
794
+									$value = $value['key'];
795
+				}
775 796
 			break;
776 797
 			case 'choice_multiple':
777 798
 				$value = json_encode($value);
778 799
 			break;
779 800
 			case 'boolean':
780 801
 				// check for null values
781
-				if ($value === null)
782
-					return;
802
+				if ($value === null) {
803
+									return;
804
+				}
783 805
 				// convert from truthy to database 1 or 0
784 806
 				$value = $value ? 1 : 0;
785 807
 			break;
@@ -811,19 +833,22 @@  discard block
 block discarded – undo
811 833
 				// make sure model afterFind has been run
812 834
 				$members = DdsMember::find()->where(['class_type'=>$classType])->all();
813 835
 				$membersByRef = [];
814
-				foreach ($members as $member)
815
-					$membersByRef[$member['member_ref']] = $member->attributes;
836
+				foreach ($members as $member) {
837
+									$membersByRef[$member['member_ref']] = $member->attributes;
838
+				}
816 839
 				$_classMembers[$classType] = $membersByRef;
817 840
 			} catch (\Exception $e) {
818 841
 				throw new \InvalidArgumentException("Error attempting to get members for $classType.");
819 842
 			}
820 843
 		}
821
-		if (empty($dataTypes))
822
-			return $_classMembers[$classType];
844
+		if (empty($dataTypes)) {
845
+					return $_classMembers[$classType];
846
+		}
823 847
 		$dataMembers = [];
824 848
 		foreach ($_classMembers[$classType] as $k=>$m) {
825
-			if (in_array($m['data_type_ref'], $dataTypes))
826
-				$dataMembers[$k] = $m;
849
+			if (in_array($m['data_type_ref'], $dataTypes)) {
850
+							$dataMembers[$k] = $m;
851
+			}
827 852
 		}
828 853
 		return $dataMembers;
829 854
 	}
@@ -876,16 +901,18 @@  discard block
 block discarded – undo
876 901
 	 */
877 902
 	protected function getTableRowReplaceSql($table, $row)
878 903
 	{
879
-		if (!is_array($row))
880
-			$row = $row->toArray();
904
+		if (!is_array($row)) {
905
+					$row = $row->toArray();
906
+		}
881 907
 		$fields = [];
882 908
 		$values = [];
883 909
 		foreach ($row as $f=>$v) {
884 910
 			$fields[]=$f;
885 911
 			$values[] = $this->pdoQuote($v);
886 912
 		}
887
-		if (count($fields))
888
-			return "REPLACE INTO `$table` (`".(implode('`,`',$fields)).'`) VALUES ('.(implode(",",$values)).");";
913
+		if (count($fields)) {
914
+					return "REPLACE INTO `$table` (`".(implode('`,`',$fields)).'`) VALUES ('.(implode(",",$values)).");";
915
+		}
889 916
 		return null;
890 917
 	}
891 918
 
@@ -896,10 +923,12 @@  discard block
 block discarded – undo
896 923
 	 */
897 924
 	private function pdoQuote($value)
898 925
 	{
899
-		if (is_array($value))
900
-			$value = json_encode($value);
901
-		if (is_null($value))
902
-			return 'null';
926
+		if (is_array($value)) {
927
+					$value = json_encode($value);
928
+		}
929
+		if (is_null($value)) {
930
+					return 'null';
931
+		}
903 932
 		return neon()->db->pdo->quote($value);
904 933
 	}
905 934
 
@@ -934,8 +963,9 @@  discard block
 block discarded – undo
934 963
 	protected function areUUIDs(array $candidates)
935 964
 	{
936 965
 		foreach ($candidates as $candidate) {
937
-			if (!$this->isUUID($candidate))
938
-				return false;
966
+			if (!$this->isUUID($candidate)) {
967
+							return false;
968
+			}
939 969
 		}
940 970
 		return true;
941 971
 	}
Please login to merge, or discard this patch.