From d6fa00bb1cc28923c6729da2c0ea3c71977532a9 Mon Sep 17 00:00:00 2001 From: "Daniel St. Jules" Date: Wed, 7 Jan 2015 09:09:07 -0800 Subject: [PATCH] Conditionally load Stringy\create --- src/Create.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Create.php b/src/Create.php index 8ba5f96..c6a2f44 100644 --- a/src/Create.php +++ b/src/Create.php @@ -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); + } }