]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tools/Utils.php
1st draft for Pocket import via API
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tools / Utils.php
index a4fbcffdac4197cfcce262b6345ffe58101d61e6..b146d98b9c360dfd64a7da1057f9fc3f5d065219 100644 (file)
@@ -26,9 +26,18 @@ class Utils
         return str_replace(array('+', '/'), '', $token);
     }
 
+    /**
+     * @param $words
+     * @return float
+     */
+    public static function convertWordsToMinutes($words)
+    {
+        return floor($words / 200);
+    }
+
     /**
      * For a given text, we calculate reading time for an article
-     * based on 200 words per minute
+     * based on 200 words per minute.
      *
      * @param $text
      *
@@ -36,6 +45,6 @@ class Utils
      */
     public static function getReadingTime($text)
     {
-        return floor(str_word_count(strip_tags($text)) / 200);
+        return self::convertWordsToMinutes(str_word_count(strip_tags($text)));
     }
 }