diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/Tools.php')
-rwxr-xr-x | src/Wallabag/CoreBundle/Helper/Tools.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/Tools.php b/src/Wallabag/CoreBundle/Helper/Tools.php index be29ab99..d368ee71 100755 --- a/src/Wallabag/CoreBundle/Helper/Tools.php +++ b/src/Wallabag/CoreBundle/Helper/Tools.php | |||
@@ -118,4 +118,16 @@ final class Tools | |||
118 | 118 | ||
119 | return str_replace('+', '', $token); | 119 | return str_replace('+', '', $token); |
120 | } | 120 | } |
121 | |||
122 | /** | ||
123 | * For a given text, we calculate reading time for an article. | ||
124 | * | ||
125 | * @param $text | ||
126 | * | ||
127 | * @return float | ||
128 | */ | ||
129 | public static function getReadingTime($text) | ||
130 | { | ||
131 | return floor(str_word_count(strip_tags($text)) / 200); | ||
132 | } | ||
121 | } | 133 | } |