diff --git a/laravel/helpers.php b/laravel/helpers.php index f050d152..87c3394f 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -366,6 +366,17 @@ function str_finish($value, $cap) return rtrim($value, $cap).$cap; } +/** + * Determine if the given object has a toString method. + * + * @param object $value + * @return bool + */ +function str_object($value) +{ + return is_object($value) and method_exists($value, '__toString'); +} + /** * Get the root namespace of a given class. *