diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-08-12 09:05:21 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-08-12 09:05:21 +0200 |
commit | 930334cd6d486843b536412391a549815efd038e (patch) | |
tree | 485eeecc3bd3db3613d47de25662d5c9163e4afe /src/Wallabag/CoreBundle/Helper | |
parent | fedaf005377e6d62ff0986f7f54afef3287a6451 (diff) | |
parent | 2686457448372543fdf4f1fc54c4fd20f0f02c2c (diff) | |
download | wallabag-930334cd6d486843b536412391a549815efd038e.tar.gz wallabag-930334cd6d486843b536412391a549815efd038e.tar.zst wallabag-930334cd6d486843b536412391a549815efd038e.zip |
Merge pull request #1297 from wallabag/v2-estimated-time
store estimated reading time in database (#393)
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-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 | } |