1st draft for Pocket import via API

This commit is contained in:
Nicolas Lœuillet
2015-10-20 13:58:13 +02:00
committed by Jeremy Benoist
parent 10b40f85d6
commit 1f4408de9e
9 changed files with 219 additions and 34 deletions

View File

@ -26,6 +26,15 @@ class Utils
return str_replace(array('+', '/'), '', $token);
}
/**
* @param $words
* @return float
*/
public static function convertWordsToMinutes($words)
{
return floor($words / 200);
}
/**
* For a given text, we calculate reading time for an article
* based on 200 words per minute.
@ -36,6 +45,6 @@ class Utils
*/
public static function getReadingTime($text)
{
return floor(str_word_count(strip_tags($text)) / 200);
return self::convertWordsToMinutes(str_word_count(strip_tags($text)));
}
}