Skip to content

Commit

Permalink
Merge pull request #3 from zqhong/patch-1
Browse files Browse the repository at this point in the history
improve:避免函数重复定义的错误
  • Loading branch information
JanHuang authored Jun 29, 2017
2 parents 5dfa3c1 + 815f526 commit 2d082b8
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 2d082b8

Please sign in to comment.