From 815f52601fab8da77237f8c8807ca8e0110fda66 Mon Sep 17 00:00:00 2001 From: zqhong Date: Thu, 29 Jun 2017 17:02:03 +0800 Subject: [PATCH] =?UTF-8?q?improve=EF=BC=9A=E9=81=BF=E5=85=8D=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E9=87=8D=E5=A4=8D=E5=AE=9A=E4=B9=89=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers.php | 55 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/helpers.php b/helpers.php index 419f1a9..5152a94 100644 --- a/helpers.php +++ b/helpers.php @@ -7,34 +7,41 @@ * @link http://www.fast-d.cn/ */ -/** - * @param $string - * @return \FastD\Utils\StringObject - */ -function stringObject($string = '') -{ - return new \FastD\Utils\StringObject($string); +if (!function_exists('stringObject')) { + /** + * @param $string + * @return \FastD\Utils\StringObject + */ + function stringObject($string = '') + { + return new \FastD\Utils\StringObject($string); + } } -/** - * @param array $array - * @return \FastD\Utils\ArrayObject - */ -function arrayObject(array $array = []) -{ - return new \FastD\Utils\ArrayObject($array); +if (!function_exists('arrayObject')) { + /** + * @param array $array + * @return \FastD\Utils\ArrayObject + */ + function arrayObject(array $array = []) + { + return new \FastD\Utils\ArrayObject($array); + } } -/** - * @param $name - * @param null $value - * @return mixed - */ -function env($name, $value = null) -{ - if (null === $value) { - return getenv($name); +if (!function_exists('env')) { + /** + * @param $name + * @param null $value + * @return mixed + */ + function env($name, $value = null) + { + if (null === $value) { + return getenv($name); + } + + return putenv(sprintf('%s=%s', $name, $value)); } - return putenv(sprintf('%s=%s', $name, $value)); }