From 17172f8920794c8002eeacfbbbba6c96ab18387d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 13 Feb 2015 11:35:04 -0700 Subject: [PATCH] added a contains() static method --- system/src/Grav/Common/Utils.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index ac4f95f0f..538656a7e 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -28,6 +28,16 @@ abstract class Utils return $needle === '' || substr($haystack, -strlen($needle)) === $needle; } + /** + * @param string $haystack + * @param string $needle + * @return bool + */ + public static function contains($haystack, $needle) + { + return $needle === '' || strpos($haystack, $needle) !== false; + } + /** * Merge two objects into one. *