@@ -462,8 +462,8 @@ |
||
462 | 462 | * 获取环境变量 |
463 | 463 | * |
464 | 464 | * @param string $key |
465 | - * @param mixed $default |
|
466 | - * @return mixed |
|
465 | + * @param string|false $default |
|
466 | + * @return string |
|
467 | 467 | */ |
468 | 468 | function env($key, $default = null) |
469 | 469 | { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | // 过滤查询特殊字符 |
410 | 410 | if (preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) { |
411 | - $value .= ' '; |
|
411 | + $value.=' '; |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 | /** |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | * |
417 | 417 | * @return string|null |
418 | 418 | */ |
419 | -function config($name=null,$value=null,$default=null){ |
|
419 | +function config($name=null, $value=null, $default=null) { |
|
420 | 420 | $config=\puck\Conf::load(); |
421 | - if ($name===null){ |
|
421 | + if ($name === null) { |
|
422 | 422 | return $config->all(); |
423 | 423 | } |
424 | - if ($value===null){ |
|
425 | - return $config->get($name,$default); |
|
424 | + if ($value === null) { |
|
425 | + return $config->get($name, $default); |
|
426 | 426 | } |
427 | - $config->set($name,$value); |
|
427 | + $config->set($name, $value); |
|
428 | 428 | } |
429 | 429 | /** |
430 | 430 | * 字符串命名风格转换 |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | -if (! function_exists('app')) { |
|
444 | +if (!function_exists('app')) { |
|
445 | 445 | /** |
446 | 446 | * 获取容器实例 |
447 | 447 | * |
448 | 448 | * @param string $make |
449 | 449 | * @return mixed|\puck\App |
450 | 450 | */ |
451 | - function app($make = null) |
|
451 | + function app($make=null) |
|
452 | 452 | { |
453 | 453 | if (is_null($make)) { |
454 | 454 | return Container::getInstance(); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | -if (! function_exists('env')) { |
|
460 | +if (!function_exists('env')) { |
|
461 | 461 | /** |
462 | 462 | * 获取环境变量 |
463 | 463 | * |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | * @param mixed $default |
466 | 466 | * @return mixed |
467 | 467 | */ |
468 | - function env($key, $default = null) |
|
468 | + function env($key, $default=null) |
|
469 | 469 | { |
470 | - $value = getenv($key); |
|
470 | + $value=getenv($key); |
|
471 | 471 | if ($value === false) { |
472 | 472 | return value($default); |
473 | 473 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | $this->initContainer(); |
24 | 24 | } |
25 | 25 | |
26 | - private function initEnv(){ |
|
27 | - $dotEnv = new Dotenv($this->basePath); |
|
26 | + private function initEnv() { |
|
27 | + $dotEnv=new Dotenv($this->basePath); |
|
28 | 28 | $dotEnv->load(); |
29 | 29 | date_default_timezone_set(env('APP_TIMEZONE', 'Asia/Shanghai')); |
30 | 30 | define('IS_CLI', php_sapi_name() == 'cli'); |
31 | - if (env('DEBUG',false)) { |
|
31 | + if (env('DEBUG', false)) { |
|
32 | 32 | error_reporting(E_ALL); |
33 | 33 | @ini_set('display_errors', 'On'); |
34 | 34 | //@ob_start(); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | private function initContainer() { |
47 | 47 | static::setInstance($this); |
48 | - $this->instance('app',$this); |
|
49 | - $this->bind('pinyin','\puck\helpers\PinYin'); |
|
48 | + $this->instance('app', $this); |
|
49 | + $this->bind('pinyin', '\puck\helpers\PinYin'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
53 | 53 | \ No newline at end of file |