@@ -105,7 +105,7 @@ |
||
| 105 | 105 | */ |
| 106 | 106 | public function pull($key, $default = null) |
| 107 | 107 | { |
| 108 | - return take($this->get($key, $default), function () use ($key) { |
|
| 108 | + return take($this->get($key, $default), function() use ($key) { |
|
| 109 | 109 | $this->delete($key); |
| 110 | 110 | }); |
| 111 | 111 | } |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $testTime = $this->getConvertedUTC($time, $timezone); |
| 47 | 47 | $ourTime = $this->toDateTime() |
| 48 | - ->setTimezone(new DateTimeZone('UTC')) |
|
| 49 | - ->format('Y-m-d H:i:s'); |
|
| 48 | + ->setTimezone(new DateTimeZone('UTC')) |
|
| 49 | + ->format('Y-m-d H:i:s'); |
|
| 50 | 50 | |
| 51 | 51 | return $testTime->format('Y-m-d H:i:s') === $ourTime; |
| 52 | 52 | } |
@@ -68,15 +68,15 @@ discard block |
||
| 68 | 68 | return $testTime < $ourTime; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Determines if the current instance's time is after test time, |
|
| 73 | - * after converting to UTC. |
|
| 74 | - * |
|
| 75 | - * @param \DateTime|string $time |
|
| 76 | - * @param \DatetimeZone|string|null $timezone |
|
| 77 | - * |
|
| 78 | - * @return bool |
|
| 79 | - */ |
|
| 71 | + /** |
|
| 72 | + * Determines if the current instance's time is after test time, |
|
| 73 | + * after converting to UTC. |
|
| 74 | + * |
|
| 75 | + * @param \DateTime|string $time |
|
| 76 | + * @param \DatetimeZone|string|null $timezone |
|
| 77 | + * |
|
| 78 | + * @return bool |
|
| 79 | + */ |
|
| 80 | 80 | public function isAfter($time, string $timezone = null) |
| 81 | 81 | { |
| 82 | 82 | $testTime = $this->getConvertedUTC($time, $timezone)->getTimestamp(); |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | use Difference; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Used to check time string to determine if it is relative time or not. |
|
| 56 | - * |
|
| 57 | - * @var string $relativePattern |
|
| 58 | - */ |
|
| 55 | + * Used to check time string to determine if it is relative time or not. |
|
| 56 | + * |
|
| 57 | + * @var string $relativePattern |
|
| 58 | + */ |
|
| 59 | 59 | protected static $relativePattern = '/this|next|last|tomorrow|yesterday|midnight|today|[+-]|first|last|ago/i'; |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Returns boolean whether the passed timezone is the same as |
| 121 | - * the local timezone. |
|
| 121 | + * the local timezone. |
|
| 122 | 122 | * |
| 123 | 123 | * @return bool |
| 124 | 124 | */ |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | return $this->toLocalizedFormatter('yyyy-MM-dd'); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Returns a localized version of the time in nicer date format. |
|
| 224 | - * |
|
| 225 | - * i.e. 10:20:33 |
|
| 226 | - * |
|
| 227 | - * @return string |
|
| 228 | - */ |
|
| 222 | + /** |
|
| 223 | + * Returns a localized version of the time in nicer date format. |
|
| 224 | + * |
|
| 225 | + * i.e. 10:20:33 |
|
| 226 | + * |
|
| 227 | + * @return string |
|
| 228 | + */ |
|
| 229 | 229 | public function toTimeString() |
| 230 | 230 | { |
| 231 | 231 | return $this->toLocalizedFormatter('HH:mm:ss'); |
@@ -206,7 +206,9 @@ |
||
| 206 | 206 | */ |
| 207 | 207 | public static function limit($value, $limit, $end = '...') |
| 208 | 208 | { |
| 209 | - if (static::length($value) <= $limit) return $value; |
|
| 209 | + if (static::length($value) <= $limit) { |
|
| 210 | + return $value; |
|
| 211 | + } |
|
| 210 | 212 | |
| 211 | 213 | return rtrim(mb_substr($value, 0, $limit, 'UTF-8')).$end; |
| 212 | 214 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if ( ! function_exists('str_underscore')) |
| 178 | 178 | { |
| 179 | - /** |
|
| 179 | + /** |
|
| 180 | 180 | * Replace in the string the spaces by low dashes. |
| 181 | 181 | * |
| 182 | 182 | * @param string $string |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ( ! function_exists('studly_caps')) |
| 195 | 195 | { |
| 196 | - /** |
|
| 196 | + /** |
|
| 197 | 197 | * Convert the string with spaces or underscore in StudlyCaps. |
| 198 | 198 | * |
| 199 | 199 | * @param string $string |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | function dd() |
| 71 | 71 | { |
| 72 | - array_map(function ($x) { |
|
| 72 | + array_map(function($x) { |
|
| 73 | 73 | var_dump($x); |
| 74 | 74 | }, func_get_args()); |
| 75 | 75 | |
@@ -173,53 +173,53 @@ |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * Magic method. Searches for the given variable and returns its value. |
|
| 177 | - * |
|
| 178 | - * @param string $key Variable name |
|
| 179 | - * |
|
| 180 | - * @return mixed |
|
| 181 | - */ |
|
| 182 | - public function __get($key) |
|
| 183 | - { |
|
| 184 | - return $this->get($key); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Magic method. Calls [$this->set] with the same parameters. |
|
| 189 | - * |
|
| 190 | - * @param string $key Variable name |
|
| 191 | - * @param mixed $value Value |
|
| 192 | - * |
|
| 193 | - * @return void |
|
| 194 | - */ |
|
| 195 | - public function __set($key, $value) |
|
| 196 | - { |
|
| 197 | - $this->offsetSet($key, $value); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Magic method. Determines if a variable is set. |
|
| 202 | - * |
|
| 203 | - * @param string $key variable name |
|
| 204 | - * |
|
| 205 | - * @return boolean |
|
| 206 | - */ |
|
| 207 | - public function __isset($key) |
|
| 208 | - { |
|
| 209 | - return $this->offsetExists($key); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Magic method. Unsets a given variable. |
|
| 214 | - * |
|
| 215 | - * @param string $key Variable name |
|
| 216 | - * |
|
| 217 | - * @return void |
|
| 218 | - */ |
|
| 219 | - public function __unset($key) |
|
| 220 | - { |
|
| 221 | - $this->offsetUnset($$key); |
|
| 222 | - } |
|
| 176 | + * Magic method. Searches for the given variable and returns its value. |
|
| 177 | + * |
|
| 178 | + * @param string $key Variable name |
|
| 179 | + * |
|
| 180 | + * @return mixed |
|
| 181 | + */ |
|
| 182 | + public function __get($key) |
|
| 183 | + { |
|
| 184 | + return $this->get($key); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Magic method. Calls [$this->set] with the same parameters. |
|
| 189 | + * |
|
| 190 | + * @param string $key Variable name |
|
| 191 | + * @param mixed $value Value |
|
| 192 | + * |
|
| 193 | + * @return void |
|
| 194 | + */ |
|
| 195 | + public function __set($key, $value) |
|
| 196 | + { |
|
| 197 | + $this->offsetSet($key, $value); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Magic method. Determines if a variable is set. |
|
| 202 | + * |
|
| 203 | + * @param string $key variable name |
|
| 204 | + * |
|
| 205 | + * @return boolean |
|
| 206 | + */ |
|
| 207 | + public function __isset($key) |
|
| 208 | + { |
|
| 209 | + return $this->offsetExists($key); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Magic method. Unsets a given variable. |
|
| 214 | + * |
|
| 215 | + * @param string $key Variable name |
|
| 216 | + * |
|
| 217 | + * @return void |
|
| 218 | + */ |
|
| 219 | + public function __unset($key) |
|
| 220 | + { |
|
| 221 | + $this->offsetUnset($$key); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * Handle dynamic calls to the container to set attributes. |
@@ -39,13 +39,13 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function register() |
| 41 | 41 | { |
| 42 | - $this->app->singleton('redis', function ($app) { |
|
| 42 | + $this->app->singleton('redis', function($app) { |
|
| 43 | 43 | $config = $app['config']->get('database.redis', []); |
| 44 | 44 | |
| 45 | 45 | return new RedisManager($config); |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - $this->app->bind('redis.connection', function ($app) { |
|
| 48 | + $this->app->bind('redis.connection', function($app) { |
|
| 49 | 49 | return $app['redis']->connection(); |
| 50 | 50 | }); |
| 51 | 51 | } |
@@ -88,6 +88,6 @@ |
||
| 88 | 88 | public static function longVersion() |
| 89 | 89 | { |
| 90 | 90 | return self::COPY.' '.self::YEAR.' '.self::COPYRIGHT.' - '.self::PRODUCT.' ' .self::RELEASE. ' '. |
| 91 | - self::STATUS.' [ '.self::CODENAME.' ] '.self::RELEASEDATE; |
|
| 91 | + self::STATUS.' [ '.self::CODENAME.' ] '.self::RELEASEDATE; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | \ No newline at end of file |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | */ |
| 88 | 88 | public static function longVersion() |
| 89 | 89 | { |
| 90 | - return self::COPY.' '.self::YEAR.' '.self::COPYRIGHT.' - '.self::PRODUCT.' ' .self::RELEASE. ' '. |
|
| 90 | + return self::COPY.' '.self::YEAR.' '.self::COPYRIGHT.' - '.self::PRODUCT.' '.self::RELEASE.' '. |
|
| 91 | 91 | self::STATUS.' [ '.self::CODENAME.' ] '.self::RELEASEDATE; |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | \ No newline at end of file |
@@ -22,11 +22,21 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | // Define the absolute paths for configured directories |
| 25 | -if ( ! defined('APP_PATH')) define('APP_PATH', realpath($paths['path.app']).DIRECTORY_SEPARATOR); |
|
| 26 | -if ( ! defined('BST_PATH')) define('BST_PATH', realpath($paths['path.bootstrap']).DIRECTORY_SEPARATOR); |
|
| 27 | -if ( ! defined('CON_PATH')) define('CON_PATH', realpath($paths['path.config']).DIRECTORY_SEPARATOR); |
|
| 28 | -if ( ! defined('RES_PATH')) define('RES_PATH', realpath($paths['path.resources']).DIRECTORY_SEPARATOR); |
|
| 29 | -if ( ! defined('SYS_PATH')) define('SYS_PATH', realpath($paths['path.sys']).DIRECTORY_SEPARATOR); |
|
| 25 | +if ( ! defined('APP_PATH')) { |
|
| 26 | + define('APP_PATH', realpath($paths['path.app']).DIRECTORY_SEPARATOR); |
|
| 27 | +} |
|
| 28 | +if ( ! defined('BST_PATH')) { |
|
| 29 | + define('BST_PATH', realpath($paths['path.bootstrap']).DIRECTORY_SEPARATOR); |
|
| 30 | +} |
|
| 31 | +if ( ! defined('CON_PATH')) { |
|
| 32 | + define('CON_PATH', realpath($paths['path.config']).DIRECTORY_SEPARATOR); |
|
| 33 | +} |
|
| 34 | +if ( ! defined('RES_PATH')) { |
|
| 35 | + define('RES_PATH', realpath($paths['path.resources']).DIRECTORY_SEPARATOR); |
|
| 36 | +} |
|
| 37 | +if ( ! defined('SYS_PATH')) { |
|
| 38 | + define('SYS_PATH', realpath($paths['path.sys']).DIRECTORY_SEPARATOR); |
|
| 39 | +} |
|
| 30 | 40 | |
| 31 | 41 | // Call the file constants |
| 32 | 42 | require CON_PATH.'constants.php'; |