GitHub PullRequestReviewCommentEvent at 2014-03-12 15:08:56
Repository: yii2
Actor: nineinchnick
Payload: {"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/10521463","id":10521463,"diff_hunk":"@@ -455,4 +455,65 @@ public function asSize($value, $verbose = false)\n \t\t\t\treturn $verbose ? Yii::t('yii', '{n, plural, =1{# petabyte} other{# petabytes}}', $params) : Yii::t('yii', '{n} PB', $params);\n \t\t}\n \t}\n+\n+\t/**\n+\t * Formats the value as the time elapsed since then in human readable form.\n+\t * @param integer|string|DateTime|DateInterval $value the value to be formatted. The following\n+\t * types of value are supported:\n+\t *\n+\t * - an integer representing a UNIX timestamp\n+\t * - a string that can be parsed into a UNIX timestamp via `strtotime()`\n+\t * - a PHP DateTime object\n+\t * - a PHP DateInterval object\n+\t *\n+\t * @return string the formatted result\n+\t */\n+\tpublic function asElapsedTime($value)\n+\t{\n+\t\tif ($value === null) {\n+\t\t\treturn $this->nullDisplay;\n+\t\t}\n+\n+\t\tif ($value instanceof \\DateInterval) {","path":"framework/base/Formatter.php","position":23,"original_position":23,"commit_id":"b7cf6183481c4749165344c639aa0025714cbed3","original_commit_id":"b7cf6183481c4749165344c639aa0025714cbed3","user":{"login":"nineinchnick","id":795177,"avatar_url":"https://gravatar.com/avatar/79b8f5152d13724aad2133600086a53d?d=https%3A%2F%2Fidenticons.github.com%2Fbc3bda527d5e02b3a9558856df3f62f6.png&r=x","gravatar_id":"79b8f5152d13724aad2133600086a53d","url":"https://api.github.com/users/nineinchnick","html_url":"https://github.com/nineinchnick","followers_url":"https://api.github.com/users/nineinchnick/followers","following_url":"https://api.github.com/users/nineinchnick/following{/other_user}","gists_url":"https://api.github.com/users/nineinchnick/gists{/gist_id}","starred_url":"https://api.github.com/users/nineinchnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nineinchnick/subscriptions","organizations_url":"https://api.github.com/users/nineinchnick/orgs","repos_url":"https://api.github.com/users/nineinchnick/repos","events_url":"https://api.github.com/users/nineinchnick/events{/privacy}","received_events_url":"https://api.github.com/users/nineinchnick/received_events","type":"User","site_admin":false},"body":"Now I wonder if it could detect an interval as a string (ex. P1M) and create the object if required. You'd have to check if `normalizeDatetimeValue` returns false, then try to create a DateInterval object catching an exception. I don't know if that's not a bit too much here.","created_at":"2014-03-12T15:08:56Z","updated_at":"2014-03-12T15:08:56Z","html_url":"https://github.com/yiisoft/yii2/pull/2714#discussion_r10521463","pull_request_url":"https://api.github.com/repos/yiisoft/yii2/pulls/2714","_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/10521463"},"html":{"href":"https://github.com/yiisoft/yii2/pull/2714#discussion_r10521463"},"pull_request":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/2714"}}}}