@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | return true; |
| 42 | 42 | |
| 43 | 43 | // try to load from file |
| 44 | - $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
|
| 45 | - if (File::exist('/Private/Config/' . $configFile)) { |
|
| 46 | - $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true); |
|
| 44 | + $configFile = ucfirst(Str::lowerCase($configName)).'.php'; |
|
| 45 | + if (File::exist('/Private/Config/'.$configFile)) { |
|
| 46 | + $this->data[$configName] = File::inc('/Private/Config/'.$configFile, true); |
|
| 47 | 47 | return true; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function writeConfig(string $configFile, array $data): bool |
| 134 | 134 | { |
| 135 | - $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
|
| 135 | + $path = '/Private/Config/'.ucfirst(Str::lowerCase($configFile)).'.php'; |
|
| 136 | 136 | if (!File::exist($path) || !File::writable($path)) |
| 137 | 137 | return false; |
| 138 | 138 | |
| 139 | - $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
|
| 139 | + $saveData = '<?php return '.Arr::exportVar($data).';'; |
|
| 140 | 140 | File::write($path, $saveData); |
| 141 | 141 | // overload config values if changed |
| 142 | 142 | $this->load($configFile, true); |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct() |
| 26 | 26 | { |
| 27 | - if (!$this->load('default')) |
|
| 28 | - throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
| 27 | + if (!$this->load('default')) { |
|
| 28 | + throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
| 29 | + } |
|
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | /** |
@@ -37,8 +38,9 @@ discard block |
||
| 37 | 38 | private function load(string $configName, $overload = false): bool |
| 38 | 39 | { |
| 39 | 40 | // check if always loaded |
| 40 | - if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) |
|
| 41 | - return true; |
|
| 41 | + if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) { |
|
| 42 | + return true; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | // try to load from file |
| 44 | 46 | $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
@@ -61,12 +63,14 @@ discard block |
||
| 61 | 63 | { |
| 62 | 64 | $this->load($configFile); |
| 63 | 65 | // check if configs for this file is loaded |
| 64 | - if (!isset($this->data[$configFile])) |
|
| 65 | - return false; |
|
| 66 | + if (!isset($this->data[$configFile])) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 66 | 69 | |
| 67 | 70 | // check if config key is exist |
| 68 | - if (!isset($this->data[$configFile][$configKey])) |
|
| 69 | - return false; |
|
| 71 | + if (!isset($this->data[$configFile][$configKey])) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 70 | 74 | |
| 71 | 75 | $response = $this->data[$configFile][$configKey]; |
| 72 | 76 | |
@@ -100,8 +104,9 @@ discard block |
||
| 100 | 104 | public function getAll($configFile = 'default'): ?array |
| 101 | 105 | { |
| 102 | 106 | $this->load($configFile); |
| 103 | - if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) |
|
| 104 | - return null; |
|
| 107 | + if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) { |
|
| 108 | + return null; |
|
| 109 | + } |
|
| 105 | 110 | |
| 106 | 111 | return $this->data[$configFile]; |
| 107 | 112 | } |
@@ -116,8 +121,9 @@ discard block |
||
| 116 | 121 | public function updateConfig(string $configFile, array $newData, ?bool $mergeDeep = false): bool |
| 117 | 122 | { |
| 118 | 123 | $this->load($configFile); |
| 119 | - if (!isset($this->data[$configFile])) |
|
| 120 | - return false; |
|
| 124 | + if (!isset($this->data[$configFile])) { |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 121 | 127 | |
| 122 | 128 | $oldData = $this->data[$configFile]; |
| 123 | 129 | $saveData = ($mergeDeep ? Arr::mergeRecursive($oldData, $newData) : Arr::merge($oldData, $newData)); |
@@ -133,8 +139,9 @@ discard block |
||
| 133 | 139 | public function writeConfig(string $configFile, array $data): bool |
| 134 | 140 | { |
| 135 | 141 | $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
| 136 | - if (!File::exist($path) || !File::writable($path)) |
|
| 137 | - return false; |
|
| 142 | + if (!File::exist($path) || !File::writable($path)) { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 138 | 145 | |
| 139 | 146 | $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
| 140 | 147 | File::write($path, $saveData); |
@@ -41,11 +41,13 @@ discard block |
||
| 41 | 41 | public function getLocaled(string $attribute) |
| 42 | 42 | { |
| 43 | 43 | // if always decoded |
| 44 | - if (Any::isArray($this->{$attribute})) |
|
| 45 | - return $this->{$attribute}[App::$Request->getLanguage()]; |
|
| 44 | + if (Any::isArray($this->{$attribute})) { |
|
| 45 | + return $this->{$attribute}[App::$Request->getLanguage()]; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | - if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) |
|
| 48 | - return null; |
|
| 48 | + if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) { |
|
| 49 | + return null; |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | return Serialize::getDecodeLocale($this->{$attribute}); |
| 51 | 53 | } |
@@ -58,8 +60,9 @@ discard block |
||
| 58 | 60 | */ |
| 59 | 61 | public function setAttribute($key, $value) |
| 60 | 62 | { |
| 61 | - if ($value !== null && $this->isSerializeCastable($key)) |
|
| 62 | - $value = $this->asSerialize($value); |
|
| 63 | + if ($value !== null && $this->isSerializeCastable($key)) { |
|
| 64 | + $value = $this->asSerialize($value); |
|
| 65 | + } |
|
| 63 | 66 | |
| 64 | 67 | return parent::setAttribute($key, $value); |
| 65 | 68 | } |
@@ -72,11 +75,13 @@ discard block |
||
| 72 | 75 | */ |
| 73 | 76 | protected function castAttribute($key, $value) |
| 74 | 77 | { |
| 75 | - if ($value === null) |
|
| 76 | - return $value; |
|
| 78 | + if ($value === null) { |
|
| 79 | + return $value; |
|
| 80 | + } |
|
| 77 | 81 | |
| 78 | - if ($this->getCastType($key) === 'serialize') |
|
| 79 | - return $this->fromSerialize($value); |
|
| 82 | + if ($this->getCastType($key) === 'serialize') { |
|
| 83 | + return $this->fromSerialize($value); |
|
| 84 | + } |
|
| 80 | 85 | |
| 81 | 86 | return parent::castAttribute($key, $value); |
| 82 | 87 | } |
@@ -28,8 +28,9 @@ discard block |
||
| 28 | 28 | public static function convertToDatetime($rawDate, $format = 'd.m.Y') |
| 29 | 29 | { |
| 30 | 30 | // convert timestamp to date format |
| 31 | - if (Any::isInt($rawDate)) |
|
| 32 | - $rawDate = date(\DateTime::ATOM, $rawDate); |
|
| 31 | + if (Any::isInt($rawDate)) { |
|
| 32 | + $rawDate = date(\DateTime::ATOM, $rawDate); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | try { |
| 35 | 36 | $object = new \DateTime($rawDate); |
@@ -61,15 +62,17 @@ discard block |
||
| 61 | 62 | // convert to timestamp |
| 62 | 63 | $timestamp = $raw; |
| 63 | 64 | // raw can be instance of eloquent active record object, convert to str |
| 64 | - if (!Any::isInt($raw)) |
|
| 65 | - $timestamp = self::convertToTimestamp((string)$timestamp); |
|
| 65 | + if (!Any::isInt($raw)) { |
|
| 66 | + $timestamp = self::convertToTimestamp((string)$timestamp); |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | // calculate difference between tomorrow day midnight and passed date |
| 68 | 70 | $diff = time() - $timestamp; |
| 69 | 71 | |
| 70 | 72 | // date in future, lets return as is |
| 71 | - if ($diff < 0) |
|
| 72 | - return self::convertToDatetime($timestamp, static::FORMAT_TO_SECONDS); |
|
| 73 | + if ($diff < 0) { |
|
| 74 | + return self::convertToDatetime($timestamp, static::FORMAT_TO_SECONDS); |
|
| 75 | + } |
|
| 73 | 76 | |
| 74 | 77 | // calculate delta and make offset sub. Maybe usage instance of Datetime is better, but localization is sucks! |
| 75 | 78 | $deltaSec = $diff % 60; |
@@ -86,8 +89,9 @@ discard block |
||
| 86 | 89 | // sounds like more then 1 day's ago |
| 87 | 90 | if ($deltaDays > 1) { |
| 88 | 91 | // sounds like more then 2 week ago, just return as is |
| 89 | - if ($deltaDays > 14) |
|
| 90 | - return self::convertToDatetime($timestamp, static::FORMAT_TO_HOUR); |
|
| 92 | + if ($deltaDays > 14) { |
|
| 93 | + return self::convertToDatetime($timestamp, static::FORMAT_TO_HOUR); |
|
| 94 | + } |
|
| 91 | 95 | |
| 92 | 96 | return App::$Translate->get('DateHuman', '%days% days ago', ['days' => (int)$deltaDays]); |
| 93 | 97 | } |
@@ -42,8 +42,9 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public static function getDecoded($data, $key) |
| 44 | 44 | { |
| 45 | - if (!Any::isArray($data)) |
|
| 46 | - $data = self::decode($data); |
|
| 45 | + if (!Any::isArray($data)) { |
|
| 46 | + $data = self::decode($data); |
|
| 47 | + } |
|
| 47 | 48 | |
| 48 | 49 | return $data === false ? null : $data[$key]; |
| 49 | 50 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | // get options from properties |
| 42 | 42 | $options = $this->properties['options']; |
| 43 | 43 | if (!Any::isIterable($options)) |
| 44 | - throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 44 | + throw new SyntaxException('Radio field '.self::nohtml($this->name).' have no iterable options'); |
|
| 45 | 45 | |
| 46 | 46 | unset($this->properties['options'], $this->properties['value']); |
| 47 | 47 | |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | { |
| 41 | 41 | // get options from properties |
| 42 | 42 | $options = $this->properties['options']; |
| 43 | - if (!Any::isIterable($options)) |
|
| 44 | - throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 43 | + if (!Any::isIterable($options)) { |
|
| 44 | + throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | unset($this->properties['options'], $this->properties['value']); |
| 47 | 48 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $options = $this->properties['options']; |
| 37 | 37 | unset($this->properties['options']); |
| 38 | 38 | if (!Any::isIterable($options)) |
| 39 | - throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 39 | + throw new SyntaxException('Select field '.self::nohtml($this->name).' have no iterable options'); |
|
| 40 | 40 | // value is not used there |
| 41 | 41 | unset($this->properties['value']); |
| 42 | 42 | // options is defined as key->value array? |
@@ -35,8 +35,9 @@ |
||
| 35 | 35 | // get options from properties |
| 36 | 36 | $options = $this->properties['options']; |
| 37 | 37 | unset($this->properties['options']); |
| 38 | - if (!Any::isIterable($options)) |
|
| 39 | - throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 38 | + if (!Any::isIterable($options)) { |
|
| 39 | + throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 40 | + } |
|
| 40 | 41 | // value is not used there |
| 41 | 42 | unset($this->properties['value']); |
| 42 | 43 | // options is defined as key->value array? |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // set mobile collapse id for toggle |
| 37 | 37 | $mobCollapseId = $elements['collapseId']; |
| 38 | 38 | if (Any::isEmpty($mobCollapseId)) |
| 39 | - $mobCollapseId = Str::randomLatin(mt_rand(6,12)) . mt_rand(1, 99); |
|
| 39 | + $mobCollapseId = Str::randomLatin(mt_rand(6, 12)).mt_rand(1, 99); |
|
| 40 | 40 | |
| 41 | 41 | // set element id for toggle |
| 42 | 42 | $ulId = 1; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | // generate output dom of bootstrap navbar |
| 98 | 98 | $dom = new Dom(); |
| 99 | 99 | $body = $dom->div(function() use ($leftBuild, $rightBuild, $itemsStatic){ |
| 100 | - return $leftBuild . $itemsStatic . $rightBuild; |
|
| 100 | + return $leftBuild.$itemsStatic.$rightBuild; |
|
| 101 | 101 | }, ['class' => 'collapse navbar-collapse', 'id' => $mobCollapseId]); |
| 102 | 102 | |
| 103 | 103 | // drow <nav @properties>@next</nav> |
@@ -108,17 +108,17 @@ discard block |
||
| 108 | 108 | $header = $dom->div(function() use ($dom, $elements, $mobCollapseId){ |
| 109 | 109 | // drow <button @collapse>@next</button> |
| 110 | 110 | $collapseButton = $dom->button(function() use ($dom){ |
| 111 | - $toggleItem = $dom->span(function(){ |
|
| 111 | + $toggleItem = $dom->span(function() { |
|
| 112 | 112 | return 'Toggle menu'; |
| 113 | 113 | }, ['class' => 'sr-only']); |
| 114 | 114 | $toggleIcon = null; |
| 115 | 115 | for ($i = 0; $i < 3; $i++) { |
| 116 | - $toggleIcon .= $dom->span(function(){ |
|
| 116 | + $toggleIcon .= $dom->span(function() { |
|
| 117 | 117 | return null; |
| 118 | 118 | }, ['class' => 'icon-bar']); |
| 119 | 119 | } |
| 120 | - return $toggleItem . $toggleIcon; |
|
| 121 | - }, ['type' => 'button', 'class' => 'navbar-toggle collapsed', 'data-toggle' => 'collapse', 'data-target' => '#' . $mobCollapseId]); |
|
| 120 | + return $toggleItem.$toggleIcon; |
|
| 121 | + }, ['type' => 'button', 'class' => 'navbar-toggle collapsed', 'data-toggle' => 'collapse', 'data-target' => '#'.$mobCollapseId]); |
|
| 122 | 122 | // drow <div @brand>@brandtext<?div> |
| 123 | 123 | $brand = null; |
| 124 | 124 | if (isset($elements['brand'])) { |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | }, $elements['brand']['property']); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - return $collapseButton . $brand; |
|
| 136 | + return $collapseButton.$brand; |
|
| 137 | 137 | }, ['class' => 'navbar-header']); |
| 138 | 138 | // return header and body concat |
| 139 | - return $header . $body; |
|
| 139 | + return $header.$body; |
|
| 140 | 140 | }, $elements['container']); |
| 141 | 141 | }, $elements['nav']); |
| 142 | 142 | } |
@@ -24,19 +24,22 @@ |
||
| 24 | 24 | public static function display(array $elements): ?string |
| 25 | 25 | { |
| 26 | 26 | // check if elements passed well |
| 27 | - if (!isset($elements['items']) || count($elements['items']) < 1) |
|
| 28 | - return null; |
|
| 27 | + if (!isset($elements['items']) || count($elements['items']) < 1) { |
|
| 28 | + return null; |
|
| 29 | + } |
|
| 29 | 30 | |
| 30 | 31 | // set default bootstrap properties if not defined |
| 31 | 32 | $elements['property']['class'] = Str::concat(' ', 'nav', $elements['property']['class']); |
| 32 | 33 | $elements['nav']['class'] = Str::concat(' ', 'navbar', $elements['nav']['class']); |
| 33 | - if (!$elements['container']) |
|
| 34 | - $elements['container'] = 'container-fluid'; |
|
| 34 | + if (!$elements['container']) { |
|
| 35 | + $elements['container'] = 'container-fluid'; |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | // set mobile collapse id for toggle |
| 37 | 39 | $mobCollapseId = $elements['collapseId']; |
| 38 | - if (Any::isEmpty($mobCollapseId)) |
|
| 39 | - $mobCollapseId = Str::randomLatin(mt_rand(6,12)) . mt_rand(1, 99); |
|
| 40 | + if (Any::isEmpty($mobCollapseId)) { |
|
| 41 | + $mobCollapseId = Str::randomLatin(mt_rand(6,12)) . mt_rand(1, 99); |
|
| 42 | + } |
|
| 40 | 43 | |
| 41 | 44 | // set element id for toggle |
| 42 | 45 | $ulId = 1; |
@@ -17,12 +17,14 @@ discard block |
||
| 17 | 17 | public static function isEmpty($var = null): bool |
| 18 | 18 | { |
| 19 | 19 | // var is array type? |
| 20 | - if (is_array($var)) |
|
| 21 | - return count($var) < 1; |
|
| 20 | + if (is_array($var)) { |
|
| 21 | + return count($var) < 1; |
|
| 22 | + } |
|
| 22 | 23 | |
| 23 | 24 | // var seems to be object? |
| 24 | - if (is_object($var)) |
|
| 25 | - return count(get_object_vars($var)) < 1; |
|
| 25 | + if (is_object($var)) { |
|
| 26 | + return count(get_object_vars($var)) < 1; |
|
| 27 | + } |
|
| 26 | 28 | |
| 27 | 29 | // float,int,string,bool and null left. Check if not empty. Int and float will never equal to null. |
| 28 | 30 | return ($var === null || $var === '' || $var === false); |
@@ -123,14 +125,17 @@ discard block |
||
| 123 | 125 | public static function guessValueType($var = null) |
| 124 | 126 | { |
| 125 | 127 | // pass var by reference and guess var type |
| 126 | - if (self::isInt($var)) |
|
| 127 | - return $var; |
|
| 128 | + if (self::isInt($var)) { |
|
| 129 | + return $var; |
|
| 130 | + } |
|
| 128 | 131 | |
| 129 | - if (self::isFloat($var)) |
|
| 130 | - return $var; |
|
| 132 | + if (self::isFloat($var)) { |
|
| 133 | + return $var; |
|
| 134 | + } |
|
| 131 | 135 | |
| 132 | - if (self::isBool($var)) |
|
| 133 | - return $var; |
|
| 136 | + if (self::isBool($var)) { |
|
| 137 | + return $var; |
|
| 138 | + } |
|
| 134 | 139 | |
| 135 | 140 | |
| 136 | 141 | return $var; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public static function to($controller_action, $id = null, $add = null, array $params = null, $encode = true) |
| 26 | 26 | { |
| 27 | 27 | $pathway = self::buildPathway([$controller_action, $id, $add, $params], $encode); |
| 28 | - return App::$Alias->baseUrl . '/' . $pathway; |
|
| 28 | + return App::$Alias->baseUrl.'/'.$pathway; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $controller = Str::lastIn($controller, '\\', true); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $response = $controller . '/' . $action; |
|
| 64 | + $response = $controller.'/'.$action; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // check if controller and action is defined |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // id is defined? |
| 73 | 73 | if (isset($to[1]) && !Str::likeEmpty($to[1])) { |
| 74 | - $response .= '/' . self::safeUri($to[1], $encode); |
|
| 74 | + $response .= '/'.self::safeUri($to[1], $encode); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // add param is defined? |
| 78 | 78 | if (isset($to[2]) && !Str::likeEmpty($to[2])) { |
| 79 | - $response .= '/' . self::safeUri($to[2], $encode); |
|
| 79 | + $response .= '/'.self::safeUri($to[2], $encode); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // try to find static alias |
| 83 | - if (isset($routing['Alias'][env_name]) && Arr::in('/' . $response, $routing['Alias'][env_name])) { |
|
| 84 | - $pathAlias = array_search('/' . $response, $routing['Alias'][env_name]); |
|
| 83 | + if (isset($routing['Alias'][env_name]) && Arr::in('/'.$response, $routing['Alias'][env_name])) { |
|
| 84 | + $pathAlias = array_search('/'.$response, $routing['Alias'][env_name]); |
|
| 85 | 85 | if ($pathAlias !== false) { |
| 86 | 86 | $response = Str::lowerCase(trim($pathAlias, '/')); |
| 87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $queryString = http_build_query($to[3]); |
| 99 | 99 | if (Str::length($queryString) > 0) { |
| 100 | - $response .= '?' . http_build_query($to[3]); |
|
| 100 | + $response .= '?'.http_build_query($to[3]); |
|
| 101 | 101 | } |
| 102 | 102 | if ($anchor !== false) { |
| 103 | 103 | $response .= $anchor; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public static function buildPathwayFromRequest() |
| 120 | 120 | { |
| 121 | 121 | return self::buildPathway([ |
| 122 | - Str::lowerCase(App::$Request->getController()) . '/' . Str::lowerCase(App::$Request->getAction()), |
|
| 122 | + Str::lowerCase(App::$Request->getController()).'/'.Str::lowerCase(App::$Request->getAction()), |
|
| 123 | 123 | App::$Request->getID(), |
| 124 | 124 | App::$Request->getAdd(), |
| 125 | 125 | App::$Request->query->all() |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $to = [$to]; |
| 141 | 141 | |
| 142 | 142 | // call Url::to(args) |
| 143 | - $callbackTo = call_user_func_array([__NAMESPACE__ . '\Url', 'to'], $to); |
|
| 143 | + $callbackTo = call_user_func_array([__NAMESPACE__.'\Url', 'to'], $to); |
|
| 144 | 144 | |
| 145 | - return '<a href="' . $callbackTo . '"' . $compile_property . '>' . $name . '</a>'; |
|
| 145 | + return '<a href="'.$callbackTo.'"'.$compile_property.'>'.$name.'</a>'; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | /** @var array $configs */ |
| 157 | 157 | $configs = \App::$Properties->getAll('default'); |
| 158 | - $httpHost = $configs['baseProto'] . '://' . $configs['baseDomain']; |
|
| 158 | + $httpHost = $configs['baseProto'].'://'.$configs['baseDomain']; |
|
| 159 | 159 | if ($configs['basePath'] !== '/') { |
| 160 | - $httpHost .= $configs['basePath'] . '/'; |
|
| 160 | + $httpHost .= $configs['basePath'].'/'; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // check if is this is URI not URL |
| 164 | 164 | if (!Str::startsWith($httpHost, $uri)) { |
| 165 | 165 | // check if lang is defined in URI or define it |
| 166 | 166 | if ($lang !== null && $configs['multiLanguage'] && !Str::startsWith($lang, $uri)) { |
| 167 | - $uri = $lang . '/' . ltrim($uri, '/'); |
|
| 167 | + $uri = $lang.'/'.ltrim($uri, '/'); |
|
| 168 | 168 | } |
| 169 | 169 | // add basic httpHost data |
| 170 | - $uri = rtrim($httpHost, '/') . '/' . ltrim($uri, '/'); |
|
| 170 | + $uri = rtrim($httpHost, '/').'/'.ltrim($uri, '/'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $uri; |
@@ -136,8 +136,9 @@ |
||
| 136 | 136 | public static function link($to, $name, array $property = null) |
| 137 | 137 | { |
| 138 | 138 | $compile_property = self::applyProperty($property); |
| 139 | - if (!Any::isArray($to)) |
|
| 140 | - $to = [$to]; |
|
| 139 | + if (!Any::isArray($to)) { |
|
| 140 | + $to = [$to]; |
|
| 141 | + } |
|
| 141 | 142 | |
| 142 | 143 | // call Url::to(args) |
| 143 | 144 | $callbackTo = call_user_func_array([__NAMESPACE__ . '\Url', 'to'], $to); |