@@ -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); |
@@ -175,9 +175,9 @@ |
||
| 175 | 175 | ]); |
| 176 | 176 | } |
| 177 | 177 | if ($userItems) { |
| 178 | - $out .= \yii\widgets\Menu::widget([ |
|
| 179 | - // this is the old code to use the yii/bootstrap extension |
|
| 180 | - // it becomes very hard to remove bootstrap if we use these. |
|
| 178 | + $out .= \yii\widgets\Menu::widget([ |
|
| 179 | + // this is the old code to use the yii/bootstrap extension |
|
| 180 | + // it becomes very hard to remove bootstrap if we use these. |
|
| 181 | 181 | 'options'=> ['class' => 'navbar-nav navbar-right nav'], |
| 182 | 182 | 'items'=> $userItems['items'] |
| 183 | 183 | ]); |
@@ -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; |
@@ -20,18 +20,18 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class ServeController extends YiiServeController |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var int port to serve on. |
|
| 25 | - */ |
|
| 26 | - public $port = 8080; |
|
| 27 | - /** |
|
| 28 | - * @var string path or path alias to directory to serve |
|
| 29 | - */ |
|
| 30 | - public $docroot = '@root/public'; |
|
| 31 | - /** |
|
| 32 | - * @var string path to router script. |
|
| 33 | - * See https://secure.php.net/manual/en/features.commandline.webserver.php |
|
| 34 | - */ |
|
| 35 | - public $router; |
|
| 23 | + /** |
|
| 24 | + * @var int port to serve on. |
|
| 25 | + */ |
|
| 26 | + public $port = 8080; |
|
| 27 | + /** |
|
| 28 | + * @var string path or path alias to directory to serve |
|
| 29 | + */ |
|
| 30 | + public $docroot = '@root/public'; |
|
| 31 | + /** |
|
| 32 | + * @var string path to router script. |
|
| 33 | + * See https://secure.php.net/manual/en/features.commandline.webserver.php |
|
| 34 | + */ |
|
| 35 | + public $router; |
|
| 36 | 36 | |
| 37 | 37 | } |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class MigrateController extends \yii\console\controllers\MigrateController |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @inheritdoc |
|
| 28 | - */ |
|
| 29 | - public $templateFile = '@neon/core/views/migration.php'; |
|
| 26 | + /** |
|
| 27 | + * @inheritdoc |
|
| 28 | + */ |
|
| 29 | + public $templateFile = '@neon/core/views/migration.php'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @var string Define the app that is responsible for this migration. |
@@ -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;; |