@@ -106,7 +106,9 @@ |
||
| 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); |
@@ -47,10 +47,12 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -540,8 +540,12 @@ |
||
| 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)); |
@@ -47,8 +47,9 @@ |
||
| 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; |
@@ -53,8 +53,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -102,7 +102,9 @@ |
||
| 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); |
@@ -54,8 +54,9 @@ |
||
| 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 | |
@@ -44,8 +44,9 @@ |
||
| 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 | |
@@ -82,12 +82,14 @@ |
||
| 82 | 82 | $root = neon()->getAlias("@root").DIRECTORY_SEPARATOR; |
| 83 | 83 | |
| 84 | 84 | // 1. Check that Babel is installed and if not install it |
| 85 | - if (($result = $this->checkBabel())!=0) |
|
| 86 | - return $result; |
|
| 85 | + if (($result = $this->checkBabel())!=0) { |
|
| 86 | + return $result; |
|
| 87 | + } |
|
| 87 | 88 | |
| 88 | 89 | // 2. Create the babel config file |
| 89 | - if (($result = $this->checkBabelConfig($root)) != 0) |
|
| 90 | - return $result; |
|
| 90 | + if (($result = $this->checkBabelConfig($root)) != 0) { |
|
| 91 | + return $result; |
|
| 92 | + } |
|
| 91 | 93 | |
| 92 | 94 | // 3. Run babel over the project |
| 93 | 95 | $sourceDirectory = $root.$path;; |