added a contains() static method

This commit is contained in:
Andy Miller
2015-02-13 11:35:04 -07:00
parent aeb237633e
commit 17172f8920

View File

@@ -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.
*