- public static function getReadingTime($text) {
- $word = str_word_count(strip_tags($text));
- $minutes = floor($word / 200);
- $seconds = floor($word % 200 / (200 / 60));
- $time = array('minutes' => $minutes, 'seconds' => $seconds);
-
- return $minutes;
- }
-
- public static function getDocLanguage($userlanguage) {
- $lang = explode('.', $userlanguage);
- return str_replace('_', '-', $lang[0]);
+ /**
+ * For a given text, we calculate reading time for an article
+ *
+ * @param $text
+ * @return float
+ */
+ public static function getReadingTime($text)
+ {
+ return floor(str_word_count(strip_tags($text)) / 200);