aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tools/Utils.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tools/Utils.php')
-rw-r--r--src/Wallabag/CoreBundle/Tools/Utils.php11
1 files changed, 10 insertions, 1 deletions
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
@@ -27,6 +27,15 @@ class Utils
27 } 27 }
28 28
29 /** 29 /**
30 * @param $words
31 * @return float
32 */
33 public static function convertWordsToMinutes($words)
34 {
35 return floor($words / 200);
36 }
37
38 /**
30 * For a given text, we calculate reading time for an article 39 * For a given text, we calculate reading time for an article
31 * based on 200 words per minute. 40 * based on 200 words per minute.
32 * 41 *
@@ -36,6 +45,6 @@ class Utils
36 */ 45 */
37 public static function getReadingTime($text) 46 public static function getReadingTime($text)
38 { 47 {
39 return floor(str_word_count(strip_tags($text)) / 200); 48 return self::convertWordsToMinutes(str_word_count(strip_tags($text)));
40 } 49 }
41} 50}