diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tools/Utils.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tools/Utils.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index 7e2968e7..a4fbcffd 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php | |||
@@ -25,4 +25,17 @@ class Utils | |||
25 | // remove character which can broken the url | 25 | // remove character which can broken the url |
26 | return str_replace(array('+', '/'), '', $token); | 26 | return str_replace(array('+', '/'), '', $token); |
27 | } | 27 | } |
28 | |||
29 | /** | ||
30 | * For a given text, we calculate reading time for an article | ||
31 | * based on 200 words per minute | ||
32 | * | ||
33 | * @param $text | ||
34 | * | ||
35 | * @return float | ||
36 | */ | ||
37 | public static function getReadingTime($text) | ||
38 | { | ||
39 | return floor(str_word_count(strip_tags($text)) / 200); | ||
40 | } | ||
28 | } | 41 | } |