1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-13 08:44:01 +02:00

Conditionally load Stringy\create

This commit is contained in:
Daniel St. Jules
2015-01-07 09:09:07 -08:00
parent d1452263bd
commit d6fa00bb1c

View File

@@ -2,16 +2,18 @@
namespace Stringy;
/**
* Creates a Stringy object and returns it on success.
*
* @param mixed $str Value to modify, after being cast to string
* @param string $encoding The character encoding
* @return Stringy A Stringy object
* @throws \InvalidArgumentException if an array or object without a
* __toString method is passed as the first argument
*/
function create($str, $encoding = null)
{
return new Stringy($str, $encoding);
if (!function_exists('Stringy\create')) {
/**
* Creates a Stringy object and returns it on success.
*
* @param mixed $str Value to modify, after being cast to string
* @param string $encoding The character encoding
* @return Stringy A Stringy object
* @throws \InvalidArgumentException if an array or object without a
* __toString method is passed as the first argument
*/
function create($str, $encoding = null)
{
return new Stringy($str, $encoding);
}
}