{"action":"created","comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/comments/173759937","pull_request_review_id":102999068,"id":173759937,"diff_hunk":"@@ -756,6 +764,31 @@ public function getDate()\n         return !empty($this->PublishDate) ? $this->PublishDate : null;\n     }\n \n+    /**\n+     * Provides a rough estimate of how long this post will take to read based on wikipedias answer to \"How fast can a\n+     * human read\" of 200wpm. Source https://en.wikipedia.org/wiki/Speed_reading\n+     *\n+     * @param null|integer $wpm\n+     *\n+     * @return string\n+     */\n+    public function MinutesToRead($wpm = null)\n+    {\n+        $wpm = $wpm ?: $this->config()->get('minutes_to_read_wpm');\n+\n+        if (!is_numeric($wpm)) {\n+            throw new \\InvalidArgumentException(sprintf(\"Expecting integer but got %s instead\", gettype($wpm)));\n+        }\n+\n+        $wordCount = count(array_filter(explode(\" \", strip_tags($this->Content))));","path":"src/Model/BlogPost.php","position":35,"original_position":35,"commit_id":"d725ccb0906681969d10d6cf5ec7013ed51c4dd3","original_commit_id":"d725ccb0906681969d10d6cf5ec7013ed51c4dd3","user":{"login":"dhensby","id":563596,"avatar_url":"https://avatars1.githubusercontent.com/u/563596?v=4","gravatar_id":"","url":"https://api.github.com/users/dhensby","html_url":"https://github.com/dhensby","followers_url":"https://api.github.com/users/dhensby/followers","following_url":"https://api.github.com/users/dhensby/following{/other_user}","gists_url":"https://api.github.com/users/dhensby/gists{/gist_id}","starred_url":"https://api.github.com/users/dhensby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhensby/subscriptions","organizations_url":"https://api.github.com/users/dhensby/orgs","repos_url":"https://api.github.com/users/dhensby/repos","events_url":"https://api.github.com/users/dhensby/events{/privacy}","received_events_url":"https://api.github.com/users/dhensby/received_events","type":"User","site_admin":false},"body":"Can we use `str_word_count`?\r\n\r\nAlso, $this->Content won't have short codes parsed and `strip_tags` (probably) won't remove them? Do we think this is important or can we live with it?","created_at":"2018-03-12T11:07:09Z","updated_at":"2018-03-12T11:07:12Z","html_url":"https://github.com/silverstripe/silverstripe-blog/pull/512#discussion_r173759937","pull_request_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/comments/173759937"},"html":{"href":"https://github.com/silverstripe/silverstripe-blog/pull/512#discussion_r173759937"},"pull_request":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512"}}},"pull_request":{"url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512","id":172710523,"html_url":"https://github.com/silverstripe/silverstripe-blog/pull/512","diff_url":"https://github.com/silverstripe/silverstripe-blog/pull/512.diff","patch_url":"https://github.com/silverstripe/silverstripe-blog/pull/512.patch","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/512","number":512,"state":"open","locked":false,"title":"ENHANCEMENT added getMinutesToRead()","user":{"login":"zanderwar","id":13566916,"avatar_url":"https://avatars1.githubusercontent.com/u/13566916?v=4","gravatar_id":"","url":"https://api.github.com/users/zanderwar","html_url":"https://github.com/zanderwar","followers_url":"https://api.github.com/users/zanderwar/followers","following_url":"https://api.github.com/users/zanderwar/following{/other_user}","gists_url":"https://api.github.com/users/zanderwar/gists{/gist_id}","starred_url":"https://api.github.com/users/zanderwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanderwar/subscriptions","organizations_url":"https://api.github.com/users/zanderwar/orgs","repos_url":"https://api.github.com/users/zanderwar/repos","events_url":"https://api.github.com/users/zanderwar/events{/privacy}","received_events_url":"https://api.github.com/users/zanderwar/received_events","type":"User","site_admin":false},"body":"This PR wishes to introduce a method `getMinutesToRead` which returns an `integer` of how long an article will take to read.\r\n\r\nBased on wikipedias answer to \"How fast can a human read\" of 200wpm.\r\n\r\n> Source https://en.wikipedia.org/wiki/Speed_reading\r\n\r\nI needed this for a client, and had achieved it with an extension but might go nicely in core\r\n\r\n```twig\r\n<div>$MinutesToRead Minute<% if $MinutesToRead > 1 %>s<% end_if %> Read</div>\r\n```","created_at":"2018-03-04T09:25:12Z","updated_at":"2018-03-12T11:07:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e6a926d85e5da391c9c0f55e2159663f29557d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512/commits","review_comments_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512/comments","review_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/512/comments","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/statuses/d725ccb0906681969d10d6cf5ec7013ed51c4dd3","head":{"label":"zanderwar:pulls/enhancement/minutes-to-read","ref":"pulls/enhancement/minutes-to-read","sha":"d725ccb0906681969d10d6cf5ec7013ed51c4dd3","user":{"login":"zanderwar","id":13566916,"avatar_url":"https://avatars1.githubusercontent.com/u/13566916?v=4","gravatar_id":"","url":"https://api.github.com/users/zanderwar","html_url":"https://github.com/zanderwar","followers_url":"https://api.github.com/users/zanderwar/followers","following_url":"https://api.github.com/users/zanderwar/following{/other_user}","gists_url":"https://api.github.com/users/zanderwar/gists{/gist_id}","starred_url":"https://api.github.com/users/zanderwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanderwar/subscriptions","organizations_url":"https://api.github.com/users/zanderwar/orgs","repos_url":"https://api.github.com/users/zanderwar/repos","events_url":"https://api.github.com/users/zanderwar/events{/privacy}","received_events_url":"https://api.github.com/users/zanderwar/received_events","type":"User","site_admin":false},"repo":{"id":123773578,"name":"silverstripe-blog","full_name":"zanderwar/silverstripe-blog","owner":{"login":"zanderwar","id":13566916,"avatar_url":"https://avatars1.githubusercontent.com/u/13566916?v=4","gravatar_id":"","url":"https://api.github.com/users/zanderwar","html_url":"https://github.com/zanderwar","followers_url":"https://api.github.com/users/zanderwar/followers","following_url":"https://api.github.com/users/zanderwar/following{/other_user}","gists_url":"https://api.github.com/users/zanderwar/gists{/gist_id}","starred_url":"https://api.github.com/users/zanderwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanderwar/subscriptions","organizations_url":"https://api.github.com/users/zanderwar/orgs","repos_url":"https://api.github.com/users/zanderwar/repos","events_url":"https://api.github.com/users/zanderwar/events{/privacy}","received_events_url":"https://api.github.com/users/zanderwar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zanderwar/silverstripe-blog","description":"Blog module for SilverStripe CMS","fork":true,"url":"https://api.github.com/repos/zanderwar/silverstripe-blog","forks_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/forks","keys_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/teams","hooks_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/hooks","issue_events_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/issues/events{/number}","events_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/events","assignees_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/assignees{/user}","branches_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/branches{/branch}","tags_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/tags","blobs_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/statuses/{sha}","languages_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/languages","stargazers_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/stargazers","contributors_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/contributors","subscribers_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/subscribers","subscription_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/subscription","commits_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/contents/{+path}","compare_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/merges","archive_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/downloads","issues_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/issues{/number}","pulls_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/pulls{/number}","milestones_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/milestones{/number}","notifications_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/labels{/name}","releases_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/releases{/id}","deployments_url":"https://api.github.com/repos/zanderwar/silverstripe-blog/deployments","created_at":"2018-03-04T09:18:46Z","updated_at":"2018-03-04T09:18:48Z","pushed_at":"2018-03-11T19:00:09Z","git_url":"git://github.com/zanderwar/silverstripe-blog.git","ssh_url":"git@github.com:zanderwar/silverstripe-blog.git","clone_url":"https://github.com/zanderwar/silverstripe-blog.git","svn_url":"https://github.com/zanderwar/silverstripe-blog","homepage":"http://silverstripe.org/blog-module","size":4174,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silverstripe:master","ref":"master","sha":"9cc98c3e19510bbdc8dfd1af2ff8215ca8e37a37","user":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars0.githubusercontent.com/u/379348?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"repo":{"id":1236910,"name":"silverstripe-blog","full_name":"silverstripe/silverstripe-blog","owner":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars0.githubusercontent.com/u/379348?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe/silverstripe-blog","description":"Blog module for SilverStripe CMS","fork":false,"url":"https://api.github.com/repos/silverstripe/silverstripe-blog","forks_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/forks","keys_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/teams","hooks_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/hooks","issue_events_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/events","assignees_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/tags","blobs_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/languages","stargazers_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/stargazers","contributors_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/contributors","subscribers_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/subscribers","subscription_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/subscription","commits_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/merges","archive_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/downloads","issues_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/releases{/id}","deployments_url":"https://api.github.com/repos/silverstripe/silverstripe-blog/deployments","created_at":"2011-01-10T04:19:54Z","updated_at":"2018-01-29T18:54:03Z","pushed_at":"2018-03-11T19:00:11Z","git_url":"git://github.com/silverstripe/silverstripe-blog.git","ssh_url":"git@github.com:silverstripe/silverstripe-blog.git","clone_url":"https://github.com/silverstripe/silverstripe-blog.git","svn_url":"https://github.com/silverstripe/silverstripe-blog","homepage":"http://silverstripe.org/blog-module","size":4169,"stargazers_count":107,"watchers_count":107,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":142,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":142,"open_issues":11,"watchers":107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512"},"html":{"href":"https://github.com/silverstripe/silverstripe-blog/pull/512"},"issue":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/512"},"comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/issues/512/comments"},"review_comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512/comments"},"review_comment":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/pulls/512/commits"},"statuses":{"href":"https://api.github.com/repos/silverstripe/silverstripe-blog/statuses/d725ccb0906681969d10d6cf5ec7013ed51c4dd3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dhensby"}}