]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tools/Utils.php
Remove unsed things
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tools / Utils.php
index 7e2968e77f45153fc55178fd9bac190450a7bb5a..a4fbcffdac4197cfcce262b6345ffe58101d61e6 100644 (file)
@@ -25,4 +25,17 @@ class Utils
         // remove character which can broken the url
         return str_replace(array('+', '/'), '', $token);
     }
+
+    /**
+     * For a given text, we calculate reading time for an article
+     * based on 200 words per minute
+     *
+     * @param $text
+     *
+     * @return float
+     */
+    public static function getReadingTime($text)
+    {
+        return floor(str_word_count(strip_tags($text)) / 200);
+    }
 }