]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Adds ConfigJson which handle the configuration in JSON format.
[github/shaarli/Shaarli.git] / application / Utils.php
index 5b8ca508576a94b0bafd0a6ee957a99fd3a7588e..9a8ca6d1000c10eb586a3738fde49f464f7fa53f 100644 (file)
@@ -41,8 +41,14 @@ function smallHash($text)
 
 /**
  * Tells if a string start with a substring
+ *
+ * @param string $haystack Given string.
+ * @param string $needle   String to search at the beginning of $haystack.
+ * @param bool   $case     Case sensitive.
+ *
+ * @return bool True if $haystack starts with $needle.
  */
-function startsWith($haystack, $needle, $case=true)
+function startsWith($haystack, $needle, $case = true)
 {
     if ($case) {
         return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
@@ -52,8 +58,14 @@ function startsWith($haystack, $needle, $case=true)
 
 /**
  * Tells if a string ends with a substring
+ *
+ * @param string $haystack Given string.
+ * @param string $needle   String to search at the end of $haystack.
+ * @param bool   $case     Case sensitive.
+ *
+ * @return bool True if $haystack ends with $needle.
  */
-function endsWith($haystack, $needle, $case=true)
+function endsWith($haystack, $needle, $case = true)
 {
     if ($case) {
         return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
@@ -261,4 +273,4 @@ function autoLocale($headerLocale)
         }
     }
     setlocale(LC_ALL, $attempts);
-}
\ No newline at end of file
+}