X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTools%2FUtils.php;h=a16baca97e0a09e27e7c35e7ecafdfdf0131416e;hb=abd454c45633e335d9d63bcd250e760b968f8138;hp=7e2968e77f45153fc55178fd9bac190450a7bb5a;hpb=2878416f8b4d94fb5e64c2fa61861526a7654d3d;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index 7e2968e7..a16baca9 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -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); + } }