X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTools%2FUtils.php;h=b146d98b9c360dfd64a7da1057f9fc3f5d065219;hb=1f4408de9ed08f3b0fda45a93f1585c80feeb21d;hp=a16baca97e0a09e27e7c35e7ecafdfdf0131416e;hpb=10b40f85d664da2b3ebcfd24d6e7145c9cd90d64;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index a16baca9..b146d98b 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -26,6 +26,15 @@ 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. @@ -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))); } }