diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2015-08-20 21:51:02 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2015-08-20 21:51:02 +0200 |
commit | 109d67dbb16478f927c3d6a46ab61ea9994aafae (patch) | |
tree | 0786b588729e3fd474a08b68ce288078e4354cfa /src/Wallabag/CoreBundle/Tools | |
parent | 4fcb7eaf139a4d2cbd0f54574e6c51a0fe852ef1 (diff) | |
parent | 6682139ec50e29308953a50dcbd088e6d8a07e81 (diff) | |
download | wallabag-109d67dbb16478f927c3d6a46ab61ea9994aafae.tar.gz wallabag-109d67dbb16478f927c3d6a46ab61ea9994aafae.tar.zst wallabag-109d67dbb16478f927c3d6a46ab61ea9994aafae.zip |
Merge pull request #1386 from wallabag/v2-refactor
WIP – Fixing things around :dash:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tools')
-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..a16baca9 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 | } |