{"action":"created","comment":{"url":"https://api.github.com/repos/phpspec/phpspec/pulls/comments/22580546","id":22580546,"diff_hunk":"@@ -81,24 +81,19 @@ function ($count) use ($total) {\n     }\n \n     /**\n-     * @param $percents\n+     * @param array $counts\n      * @return array\n      */\n-    private function getBarLengths($percents)\n+    private function getBarLengths($counts)\n     {\n         $stats = $this->getStatisticsCollector();\n-        $specProgress = ($stats->getTotalSpecs()+1)/$stats->getTotalSpecsCount();\n-\n-        $barLengths = array_map(\n-            function ($percent) use ($specProgress) {\n-                $length = $percent / 2;\n-                $res = $length == 0 || $length > 1 ? floor($length * $specProgress) : 1;\n+        $specProgress = ($stats->getTotalSpecsCount() == 0) ? 1 : ($stats->getTotalSpecs())/$stats->getTotalSpecsCount();\n+        $targetWidth = ceil($this->getIO()->getBlockWidth() * $specProgress);\n+        asort($counts);\n \n-                return $res;\n-            },\n-            $percents\n-        );\n-        asort($barLengths);\n+        $barLengths = array_map(function($count) use ($targetWidth, $counts) {","path":"src/PhpSpec/Formatter/ProgressFormatter.php","position":43,"original_position":43,"commit_id":"a4c2ac89126ac8c431e3b953aa70f62f92d199a3","original_commit_id":"a4c2ac89126ac8c431e3b953aa70f62f92d199a3","user":{"login":"jon-acker","id":956800,"avatar_url":"https://avatars.githubusercontent.com/u/956800?v=3","gravatar_id":"","url":"https://api.github.com/users/jon-acker","html_url":"https://github.com/jon-acker","followers_url":"https://api.github.com/users/jon-acker/followers","following_url":"https://api.github.com/users/jon-acker/following{/other_user}","gists_url":"https://api.github.com/users/jon-acker/gists{/gist_id}","starred_url":"https://api.github.com/users/jon-acker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jon-acker/subscriptions","organizations_url":"https://api.github.com/users/jon-acker/orgs","repos_url":"https://api.github.com/users/jon-acker/repos","events_url":"https://api.github.com/users/jon-acker/events{/privacy}","received_events_url":"https://api.github.com/users/jon-acker/received_events","type":"User","site_admin":false},"body":"Is this assignment necessary, (i.e. return directly)?","created_at":"2015-01-07T10:53:07Z","updated_at":"2015-01-07T10:53:07Z","html_url":"https://github.com/phpspec/phpspec/pull/570#discussion_r22580546","pull_request_url":"https://api.github.com/repos/phpspec/phpspec/pulls/570","_links":{"self":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/comments/22580546"},"html":{"href":"https://github.com/phpspec/phpspec/pull/570#discussion_r22580546"},"pull_request":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/570"}}},"pull_request":{"url":"https://api.github.com/repos/phpspec/phpspec/pulls/570","id":25224320,"html_url":"https://github.com/phpspec/phpspec/pull/570","diff_url":"https://github.com/phpspec/phpspec/pull/570.diff","patch_url":"https://github.com/phpspec/phpspec/pull/570.patch","issue_url":"https://api.github.com/repos/phpspec/phpspec/issues/570","number":570,"state":"open","locked":false,"title":"Fix wrapping inside CLI prompts","user":{"login":"ciaranmcnulty","id":237866,"avatar_url":"https://avatars.githubusercontent.com/u/237866?v=3","gravatar_id":"","url":"https://api.github.com/users/ciaranmcnulty","html_url":"https://github.com/ciaranmcnulty","followers_url":"https://api.github.com/users/ciaranmcnulty/followers","following_url":"https://api.github.com/users/ciaranmcnulty/following{/other_user}","gists_url":"https://api.github.com/users/ciaranmcnulty/gists{/gist_id}","starred_url":"https://api.github.com/users/ciaranmcnulty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciaranmcnulty/subscriptions","organizations_url":"https://api.github.com/users/ciaranmcnulty/orgs","repos_url":"https://api.github.com/users/ciaranmcnulty/repos","events_url":"https://api.github.com/users/ciaranmcnulty/events{/privacy}","received_events_url":"https://api.github.com/users/ciaranmcnulty/received_events","type":"User","site_admin":false},"body":"* Fixes long class names causing wrapping issues\r\n* Normalises the length of progress bar blocks to match question blocks\r\n* Adds terminal width detection so block width is dynamic\r\n* Normalises when and where linebreaks are output\r\n\r\nBefore:\r\n![before](https://cloud.githubusercontent.com/assets/237866/5605742/4404eaac-9405-11e4-85a7-6880cb116a63.gif)\r\n\r\nAfter:\r\n![after](https://cloud.githubusercontent.com/assets/237866/5605744/4dfa1dc0-9405-11e4-9718-a4152795570a.gif)\r\n","created_at":"2014-11-29T15:59:40Z","updated_at":"2015-01-07T10:53:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff7f4bf81de3acf9365dc30e2aa1b12ddcef70c2","assignee":null,"milestone":{"url":"https://api.github.com/repos/phpspec/phpspec/milestones/6","labels_url":"https://api.github.com/repos/phpspec/phpspec/milestones/6/labels","id":859834,"number":6,"title":"2.2","description":null,"creator":{"login":"ciaranmcnulty","id":237866,"avatar_url":"https://avatars.githubusercontent.com/u/237866?v=3","gravatar_id":"","url":"https://api.github.com/users/ciaranmcnulty","html_url":"https://github.com/ciaranmcnulty","followers_url":"https://api.github.com/users/ciaranmcnulty/followers","following_url":"https://api.github.com/users/ciaranmcnulty/following{/other_user}","gists_url":"https://api.github.com/users/ciaranmcnulty/gists{/gist_id}","starred_url":"https://api.github.com/users/ciaranmcnulty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciaranmcnulty/subscriptions","organizations_url":"https://api.github.com/users/ciaranmcnulty/orgs","repos_url":"https://api.github.com/users/ciaranmcnulty/repos","events_url":"https://api.github.com/users/ciaranmcnulty/events{/privacy}","received_events_url":"https://api.github.com/users/ciaranmcnulty/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":4,"state":"open","created_at":"2014-11-10T09:26:49Z","updated_at":"2014-12-26T17:00:57Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/phpspec/phpspec/pulls/570/commits","review_comments_url":"https://api.github.com/repos/phpspec/phpspec/pulls/570/comments","review_comment_url":"https://api.github.com/repos/phpspec/phpspec/pulls/comments/{number}","comments_url":"https://api.github.com/repos/phpspec/phpspec/issues/570/comments","statuses_url":"https://api.github.com/repos/phpspec/phpspec/statuses/a4c2ac89126ac8c431e3b953aa70f62f92d199a3","head":{"label":"ciaranmcnulty:refactor/output-wrapping","ref":"refactor/output-wrapping","sha":"a4c2ac89126ac8c431e3b953aa70f62f92d199a3","user":{"login":"ciaranmcnulty","id":237866,"avatar_url":"https://avatars.githubusercontent.com/u/237866?v=3","gravatar_id":"","url":"https://api.github.com/users/ciaranmcnulty","html_url":"https://github.com/ciaranmcnulty","followers_url":"https://api.github.com/users/ciaranmcnulty/followers","following_url":"https://api.github.com/users/ciaranmcnulty/following{/other_user}","gists_url":"https://api.github.com/users/ciaranmcnulty/gists{/gist_id}","starred_url":"https://api.github.com/users/ciaranmcnulty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciaranmcnulty/subscriptions","organizations_url":"https://api.github.com/users/ciaranmcnulty/orgs","repos_url":"https://api.github.com/users/ciaranmcnulty/repos","events_url":"https://api.github.com/users/ciaranmcnulty/events{/privacy}","received_events_url":"https://api.github.com/users/ciaranmcnulty/received_events","type":"User","site_admin":false},"repo":{"id":12401524,"name":"phpspec","full_name":"ciaranmcnulty/phpspec","owner":{"login":"ciaranmcnulty","id":237866,"avatar_url":"https://avatars.githubusercontent.com/u/237866?v=3","gravatar_id":"","url":"https://api.github.com/users/ciaranmcnulty","html_url":"https://github.com/ciaranmcnulty","followers_url":"https://api.github.com/users/ciaranmcnulty/followers","following_url":"https://api.github.com/users/ciaranmcnulty/following{/other_user}","gists_url":"https://api.github.com/users/ciaranmcnulty/gists{/gist_id}","starred_url":"https://api.github.com/users/ciaranmcnulty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciaranmcnulty/subscriptions","organizations_url":"https://api.github.com/users/ciaranmcnulty/orgs","repos_url":"https://api.github.com/users/ciaranmcnulty/repos","events_url":"https://api.github.com/users/ciaranmcnulty/events{/privacy}","received_events_url":"https://api.github.com/users/ciaranmcnulty/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ciaranmcnulty/phpspec","description":"SpecBDD Framework for PHP","fork":true,"url":"https://api.github.com/repos/ciaranmcnulty/phpspec","forks_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/forks","keys_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/teams","hooks_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/hooks","issue_events_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/issues/events{/number}","events_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/events","assignees_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/assignees{/user}","branches_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/branches{/branch}","tags_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/tags","blobs_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/git/refs{/sha}","trees_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/statuses/{sha}","languages_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/languages","stargazers_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/stargazers","contributors_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/contributors","subscribers_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/subscribers","subscription_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/subscription","commits_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/commits{/sha}","git_commits_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/git/commits{/sha}","comments_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/comments{/number}","issue_comment_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/issues/comments/{number}","contents_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/contents/{+path}","compare_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/merges","archive_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/downloads","issues_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/issues{/number}","pulls_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/pulls{/number}","milestones_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/milestones{/number}","notifications_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/labels{/name}","releases_url":"https://api.github.com/repos/ciaranmcnulty/phpspec/releases{/id}","created_at":"2013-08-27T08:58:32Z","updated_at":"2015-01-04T08:36:23Z","pushed_at":"2015-01-07T09:36:12Z","git_url":"git://github.com/ciaranmcnulty/phpspec.git","ssh_url":"git@github.com:ciaranmcnulty/phpspec.git","clone_url":"https://github.com/ciaranmcnulty/phpspec.git","svn_url":"https://github.com/ciaranmcnulty/phpspec","homepage":"http://www.phpspec.net","size":4069,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"phpspec:master","ref":"master","sha":"6f68645b0708906389bedc6d6047b458ab55e81c","user":{"login":"phpspec","id":416702,"avatar_url":"https://avatars.githubusercontent.com/u/416702?v=3","gravatar_id":"","url":"https://api.github.com/users/phpspec","html_url":"https://github.com/phpspec","followers_url":"https://api.github.com/users/phpspec/followers","following_url":"https://api.github.com/users/phpspec/following{/other_user}","gists_url":"https://api.github.com/users/phpspec/gists{/gist_id}","starred_url":"https://api.github.com/users/phpspec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpspec/subscriptions","organizations_url":"https://api.github.com/users/phpspec/orgs","repos_url":"https://api.github.com/users/phpspec/repos","events_url":"https://api.github.com/users/phpspec/events{/privacy}","received_events_url":"https://api.github.com/users/phpspec/received_events","type":"Organization","site_admin":false},"repo":{"id":1582219,"name":"phpspec","full_name":"phpspec/phpspec","owner":{"login":"phpspec","id":416702,"avatar_url":"https://avatars.githubusercontent.com/u/416702?v=3","gravatar_id":"","url":"https://api.github.com/users/phpspec","html_url":"https://github.com/phpspec","followers_url":"https://api.github.com/users/phpspec/followers","following_url":"https://api.github.com/users/phpspec/following{/other_user}","gists_url":"https://api.github.com/users/phpspec/gists{/gist_id}","starred_url":"https://api.github.com/users/phpspec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpspec/subscriptions","organizations_url":"https://api.github.com/users/phpspec/orgs","repos_url":"https://api.github.com/users/phpspec/repos","events_url":"https://api.github.com/users/phpspec/events{/privacy}","received_events_url":"https://api.github.com/users/phpspec/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phpspec/phpspec","description":"SpecBDD Framework for PHP","fork":false,"url":"https://api.github.com/repos/phpspec/phpspec","forks_url":"https://api.github.com/repos/phpspec/phpspec/forks","keys_url":"https://api.github.com/repos/phpspec/phpspec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phpspec/phpspec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phpspec/phpspec/teams","hooks_url":"https://api.github.com/repos/phpspec/phpspec/hooks","issue_events_url":"https://api.github.com/repos/phpspec/phpspec/issues/events{/number}","events_url":"https://api.github.com/repos/phpspec/phpspec/events","assignees_url":"https://api.github.com/repos/phpspec/phpspec/assignees{/user}","branches_url":"https://api.github.com/repos/phpspec/phpspec/branches{/branch}","tags_url":"https://api.github.com/repos/phpspec/phpspec/tags","blobs_url":"https://api.github.com/repos/phpspec/phpspec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phpspec/phpspec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phpspec/phpspec/git/refs{/sha}","trees_url":"https://api.github.com/repos/phpspec/phpspec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phpspec/phpspec/statuses/{sha}","languages_url":"https://api.github.com/repos/phpspec/phpspec/languages","stargazers_url":"https://api.github.com/repos/phpspec/phpspec/stargazers","contributors_url":"https://api.github.com/repos/phpspec/phpspec/contributors","subscribers_url":"https://api.github.com/repos/phpspec/phpspec/subscribers","subscription_url":"https://api.github.com/repos/phpspec/phpspec/subscription","commits_url":"https://api.github.com/repos/phpspec/phpspec/commits{/sha}","git_commits_url":"https://api.github.com/repos/phpspec/phpspec/git/commits{/sha}","comments_url":"https://api.github.com/repos/phpspec/phpspec/comments{/number}","issue_comment_url":"https://api.github.com/repos/phpspec/phpspec/issues/comments/{number}","contents_url":"https://api.github.com/repos/phpspec/phpspec/contents/{+path}","compare_url":"https://api.github.com/repos/phpspec/phpspec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phpspec/phpspec/merges","archive_url":"https://api.github.com/repos/phpspec/phpspec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phpspec/phpspec/downloads","issues_url":"https://api.github.com/repos/phpspec/phpspec/issues{/number}","pulls_url":"https://api.github.com/repos/phpspec/phpspec/pulls{/number}","milestones_url":"https://api.github.com/repos/phpspec/phpspec/milestones{/number}","notifications_url":"https://api.github.com/repos/phpspec/phpspec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phpspec/phpspec/labels{/name}","releases_url":"https://api.github.com/repos/phpspec/phpspec/releases{/id}","created_at":"2011-04-07T12:48:08Z","updated_at":"2015-01-07T10:04:45Z","pushed_at":"2015-01-07T10:04:45Z","git_url":"git://github.com/phpspec/phpspec.git","ssh_url":"git@github.com:phpspec/phpspec.git","clone_url":"https://github.com/phpspec/phpspec.git","svn_url":"https://github.com/phpspec/phpspec","homepage":"http://www.phpspec.net","size":5731,"stargazers_count":670,"watchers_count":670,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":49,"forks":132,"open_issues":49,"watchers":670,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/570"},"html":{"href":"https://github.com/phpspec/phpspec/pull/570"},"issue":{"href":"https://api.github.com/repos/phpspec/phpspec/issues/570"},"comments":{"href":"https://api.github.com/repos/phpspec/phpspec/issues/570/comments"},"review_comments":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/570/comments"},"review_comment":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/phpspec/phpspec/pulls/570/commits"},"statuses":{"href":"https://api.github.com/repos/phpspec/phpspec/statuses/a4c2ac89126ac8c431e3b953aa70f62f92d199a3"}}}}