3 namespace Wallabag\CoreBundle\Tools
;
8 * Generate a token used for RSS.
10 * @param int $length Length of the token
14 public static function generateToken($length = 15)
16 $token = substr(base64_encode(random_bytes($length)), 0, $length);
18 // remove character which can broken the url
19 return str_replace(['+', '/'], '', $token);
23 * For a given text, we calculate reading time for an article
24 * based on 200 words per minute.
30 public static function getReadingTime($text)
32 return floor(str_word_count(strip_tags($text)) / 200);