Passed
Push — develop ( 7bdbd7...e398eb )
by Neill
33:33 queued 15s
created
neon/core/helpers/Url.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@
 block discarded – undo
106 106
 	public static function isUrl(...$urls)
107 107
 	{
108 108
 		// if an array is passed in it will get nested one level because of the spread operator
109
-		if (is_array($urls[0])) $urls = $urls[0];
109
+		if (is_array($urls[0])) {
110
+			$urls = $urls[0];
111
+		}
110 112
 		$currentUrl = neon()->request->getPathInfo();
111 113
 		foreach($urls as $url) {
112 114
 			$url = str_replace(Url::base(), '', $url);
Please login to merge, or discard this patch.
neon/core/helpers/Html.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -154,8 +154,9 @@  discard block
 block discarded – undo
154 154
 			self::processTags($allowableTags, $tagsProcessed);
155 155
 		}
156 156
 		if (is_array($value)) {
157
-			foreach ($value as $k => $v)
158
-				$value[$k] = static::sanitise($v, $allowableTags);
157
+			foreach ($value as $k => $v) {
158
+							$value[$k] = static::sanitise($v, $allowableTags);
159
+			}
159 160
 		} else {
160 161
 			if (!is_null($value)) {
161 162
 				if (isset($tagsProcessed[$allowableTags])) {
@@ -189,14 +190,16 @@  discard block
 block discarded – undo
189 190
 	{
190 191
 		profile_begin('Html::purify', 'html');
191 192
 		if (is_array($value)) {
192
-			foreach ($value as $k => $v)
193
-				$value[$k] = static::purify($v, $allowedTags);
193
+			foreach ($value as $k => $v) {
194
+							$value[$k] = static::purify($v, $allowedTags);
195
+			}
194 196
 		} else {
195 197
 			if (!is_null($value)) {
196
-				if ($allowedTags === false)
197
-					$value = trim(HtmlPurifier::process($value));
198
-				else
199
-					$value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags)));
198
+				if ($allowedTags === false) {
199
+									$value = trim(HtmlPurifier::process($value));
200
+				} else {
201
+									$value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags)));
202
+				}
200 203
 			}
201 204
 		}
202 205
 		profile_end('Html::purify', 'html');
@@ -214,8 +217,9 @@  discard block
 block discarded – undo
214 217
 	public static function encodeEntities($value, $entities = ENT_QUOTES)
215 218
 	{
216 219
 		if (is_array($value)) {
217
-			foreach ($value as $k => $v)
218
-				$value[$k] = static::encodeEntities($v, $entities);
220
+			foreach ($value as $k => $v) {
221
+							$value[$k] = static::encodeEntities($v, $entities);
222
+			}
219 223
 		} else {
220 224
 			$value = htmlentities($value, $entities);
221 225
 		}
@@ -251,15 +255,18 @@  discard block
 block discarded – undo
251 255
 	 */
252 256
 	public static function highlight($search, $html, $empty='')
253 257
 	{
254
-		if ($html === null)
255
-			return neon()->formatter->nullDisplay;
256
-		if ($html === '')
257
-			return $empty;
258
+		if ($html === null) {
259
+					return neon()->formatter->nullDisplay;
260
+		}
261
+		if ($html === '') {
262
+					return $empty;
263
+		}
258 264
 		profile_begin('Html::Highlight');
259 265
 		// escape search and html entities as otherwise the loadHTML or appendXML
260 266
 		// can blow up if there are < & > in the data
261
-		if (!is_array($search))
262
-			$search = [$search];
267
+		if (!is_array($search)) {
268
+					$search = [$search];
269
+		}
263 270
 		try {
264 271
 			foreach ($search as $s) {
265 272
 				// now search and rebuild the data
Please login to merge, or discard this patch.
neon/core/helpers/Converter.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,10 +47,12 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function convertDateFormatToJui($format)
49 49
 	{
50
-		if (strncmp($format, 'php:', 4) === 0)
51
-			return self::convertDatePhpToJui(substr($format, 4));
52
-		if (strncmp($format, 'icu:', 4) === 0)
53
-			return self::convertDateIcuToJui(substr($format, 4));
50
+		if (strncmp($format, 'php:', 4) === 0) {
51
+					return self::convertDatePhpToJui(substr($format, 4));
52
+		}
53
+		if (strncmp($format, 'icu:', 4) === 0) {
54
+					return self::convertDateIcuToJui(substr($format, 4));
55
+		}
54 56
 		return self::convertDateIcuToJui($format);
55 57
 	}
56 58
 
@@ -65,10 +67,12 @@  discard block
 block discarded – undo
65 67
 	 */
66 68
 	public static function convertDateFormatToPhp($format, $type='date')
67 69
 	{
68
-		if (strncmp($format, 'php:', 4) === 0)
69
-			return substr($format, 4);
70
-		if (strncmp($format, 'icu:', 4) === 0)
71
-			return self::convertDateIcuToPhp(substr($format, 4), $type);
70
+		if (strncmp($format, 'php:', 4) === 0) {
71
+					return substr($format, 4);
72
+		}
73
+		if (strncmp($format, 'icu:', 4) === 0) {
74
+					return self::convertDateIcuToPhp(substr($format, 4), $type);
75
+		}
72 76
 		// assume icu format by default - this is the default used by neon()->formatter->dateFormat
73 77
 		return self::convertDateIcuToPhp($format, $type);
74 78
 	}
Please login to merge, or discard this patch.
neon/core/helpers/Str.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -540,8 +540,12 @@
 block discarded – undo
540 540
 	 */
541 541
 	public static function validateNumericWithUnits($value, $allowedUnits=[])
542 542
 	{
543
-		if (!$allowedUnits) return is_numeric($value);
544
-		if (is_string($allowedUnits)) $allowedUnits=[$allowedUnits];
543
+		if (!$allowedUnits) {
544
+			return is_numeric($value);
545
+		}
546
+		if (is_string($allowedUnits)) {
547
+			$allowedUnits=[$allowedUnits];
548
+		}
545 549
 		foreach ($allowedUnits as $unit) {
546 550
 			$checkNumber = substr($value,0, -strlen($unit));
547 551
 			$checkUnit = substr($value, -strlen($unit));
Please login to merge, or discard this patch.
neon/core/helpers/Css.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
47 47
 		$content = preg_replace_callback('/url\(([^)]*)\)/', function ($matches) use ($publishedCssFilePath) {
48 48
 			$url = trim($matches[1], '\'"');
49 49
 			// ignore non url (urls e.g. data:image url paths) and absolute urls
50
-			if (Url::isAbsolute($url))
51
-				return $matches[0];
50
+			if (Url::isAbsolute($url)) {
51
+							return $matches[0];
52
+			}
52 53
 			return 'url("' . dirname($publishedCssFilePath) . '/' . $url . '")';
53 54
 		}, $cssContent);
54 55
 		return $content;
Please login to merge, or discard this patch.
neon/core/helpers/Hash.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public static function uuid2uuid64($uuid)
55 55
 	{
56
-		if (strlen($uuid)==22)
57
-			return $uuid;
56
+		if (strlen($uuid)==22) {
57
+					return $uuid;
58
+		}
58 59
 
59 60
 		// remove any hyphens
60 61
 		$uuid = str_replace('-','',$uuid);
@@ -94,8 +95,9 @@  discard block
 block discarded – undo
94 95
 		// get public properties of child class
95 96
 		$data = \Neon::getObjectVars($object);
96 97
 		$data['class'] = get_class($object);
97
-		if (method_exists($object, 'toArray'))
98
-			$data = array_merge($data, $object->toArray(['objectToken']));
98
+		if (method_exists($object, 'toArray')) {
99
+					$data = array_merge($data, $object->toArray(['objectToken']));
100
+		}
99 101
 		$token = sha1(serialize($data) . env('NEON_SECRET'));
100 102
 		neon()->cache->set($token, $data, $duration); // 24 hour
101 103
 		return neon()->security->maskToken($token);
@@ -112,17 +114,20 @@  discard block
 block discarded – undo
112 114
 	public static function getObjectFromToken($token, $expectClass=null)
113 115
 	{
114 116
 		$data = neon()->cache->get(neon()->security->unmaskToken($token));
115
-		if ($data === null)
116
-			throw new NotFoundHttpException('Does not exist or has timed out');
117
+		if ($data === null) {
118
+					throw new NotFoundHttpException('Does not exist or has timed out');
119
+		}
117 120
 
118
-		if (!isset($data['class']) || !class_exists($data['class']))
119
-			throw new BadRequestHttpException('Not a valid class');
121
+		if (!isset($data['class']) || !class_exists($data['class'])) {
122
+					throw new BadRequestHttpException('Not a valid class');
123
+		}
120 124
 
121 125
 		// instantiate the class
122 126
 		$class = Arr::remove($data, 'class');
123 127
 		$object = new $class($data);
124
-		if ($expectClass !== null && !$object instanceof $expectClass)
125
-			throw new BadRequestHttpException('Not a valid class');
128
+		if ($expectClass !== null && !$object instanceof $expectClass) {
129
+					throw new BadRequestHttpException('Not a valid class');
130
+		}
126 131
 
127 132
 		return $object;
128 133
 	}
Please login to merge, or discard this patch.
neon/core/console/PublishController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@
 block discarded – undo
102 102
 		$versions = [];
103 103
 		foreach($gitVersions as $v) {
104 104
 			$v = substr($v, strrpos($v, "/")+1);
105
-			if ($v == '') continue;
105
+			if ($v == '') {
106
+				continue;
107
+			}
106 108
 			$versions[] = $v ;
107 109
 		}
108 110
 		dp($versions);
Please login to merge, or discard this patch.
neon/core/console/MigrateController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
 	 */
55 55
 	public function getMigrator()
56 56
 	{
57
-		if ($this->_migrator === null)
58
-			$this->_migrator = new Migrator;
57
+		if ($this->_migrator === null) {
58
+					$this->_migrator = new Migrator;
59
+		}
59 60
 		return $this->_migrator;
60 61
 	}
61 62
 
Please login to merge, or discard this patch.
neon/core/console/TestController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@
 block discarded – undo
44 44
 	{
45 45
 		$options = $this->failFast ? ' --fail-fast' : '';
46 46
 
47
-		if ($this->run)
48
-			$tests = $this->run;
47
+		if ($this->run) {
48
+					$tests = $this->run;
49
+		}
49 50
 
50 51
 		$options .= " $tests";
51 52
 
Please login to merge, or discard this patch.