@@ -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; |
@@ -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;; |
@@ -171,8 +171,9 @@ |
||
| 171 | 171 | public static function endProfile($token=null, $category = 'application') |
| 172 | 172 | { |
| 173 | 173 | if (neon()->debug) { |
| 174 | - if ($token === null) |
|
| 175 | - list($token, $category) = array_pop(self::$_logStack); |
|
| 174 | + if ($token === null) { |
|
| 175 | + list($token, $category) = array_pop(self::$_logStack); |
|
| 176 | + } |
|
| 176 | 177 | parent::endProfile($token, $category); |
| 177 | 178 | } |
| 178 | 179 | } |
@@ -102,8 +102,9 @@ |
||
| 102 | 102 | public function init() |
| 103 | 103 | { |
| 104 | 104 | parent::init(); |
| 105 | - if ($this->isInstalled() && neon()->dev) |
|
| 106 | - neon()->dev->debugBootstrap(); |
|
| 105 | + if ($this->isInstalled() && neon()->dev) { |
|
| 106 | + neon()->dev->debugBootstrap(); |
|
| 107 | + } |
|
| 107 | 108 | } |
| 108 | 109 | |
| 109 | 110 | /** |