diff -r 4a3899b6a7ed -r 766af1228b05 server/src/app/Libraries/Utils.php --- a/server/src/app/Libraries/Utils.php Sun Oct 16 22:23:31 2016 +0530 +++ b/server/src/app/Libraries/Utils.php Sun Oct 16 23:19:57 2016 +0530 @@ -134,4 +134,26 @@ return new Graph($graph1->getUri(), $merged, 'php'); } + /** + * From http://stackoverflow.com/a/834355 + */ + public static function startsWith($haystack, $needle) + { + $length = strlen($needle); + return (substr($haystack, 0, $length) === $needle); + } + + /** + * From http://stackoverflow.com/a/834355 + */ + public static function endsWith($haystack, $needle) + { + $length = strlen($needle); + if ($length == 0) { + return true; + } + + return (substr($haystack, -$length) === $needle); + } + }