{"action":"created","comment":{"url":"https://api.github.com/repos/phpro/grumphp/pulls/comments/80410148","id":80410148,"diff_hunk":"@@ -0,0 +1,106 @@\n+<?php\n+\n+namespace GrumPHP\\Formatter;\n+\n+use GrumPHP\\IO\\IOInterface;\n+use Symfony\\Component\\Process\\Process;\n+\n+/**\n+ * Class GitBlacklistFormatter\n+ *\n+ * @package GrumPHP\\Formatter\n+ */\n+class GitBlacklistFormatter implements ProcessFormatterInterface\n+{\n+    /**\n+     * @var IOInterface\n+     */\n+    private $IO;\n+\n+    /**\n+     * GitBlacklistFormatter constructor.\n+     * @param IOInterface $IO\n+     */\n+    public function __construct(IOInterface $IO)\n+    {\n+        $this->IO = $IO;\n+    }\n+\n+    /**\n+     * @param Process $process\n+     *\n+     * @return string\n+     */\n+    public function format(Process $process)\n+    {\n+        $output = $process->getOutput();\n+        if (!$output) {\n+            return $process->getErrorOutput();\n+        }\n+        if (!$this->IO->isDecorated()) {\n+            return $output;\n+        }\n+        return $this->formatOutput($output);\n+    }\n+\n+    /**\n+     * @param string $output\n+     * @return string\n+     */\n+    private function formatOutput($output)\n+    {\n+        $result = \"\\033[m\";\n+        foreach (array_filter(explode(PHP_EOL, $output)) as $lineNumber => $line) {\n+            if (preg_match('/^[0-9]+/', $line)) {\n+                $result .= $this->trimOutputLine($line, $lineNumber) . PHP_EOL;\n+            } else {\n+                $result .= $line . PHP_EOL;\n+            }\n+        }\n+        return trim($result);\n+    }\n+\n+    private function trimOutputLine($line, $lineNumber)\n+    {\n+        $wordColor = \"\\033[1;31\";","path":"src/GrumPHP/Formatter/GitBlacklistFormatter.php","position":65,"original_position":65,"commit_id":"798f6ced7589d98deecdb47ae3c7bdcd0efeedc4","original_commit_id":"798f6ced7589d98deecdb47ae3c7bdcd0efeedc4","user":{"login":"veewee","id":1618158,"avatar_url":"https://avatars.githubusercontent.com/u/1618158?v=3","gravatar_id":"","url":"https://api.github.com/users/veewee","html_url":"https://github.com/veewee","followers_url":"https://api.github.com/users/veewee/followers","following_url":"https://api.github.com/users/veewee/following{/other_user}","gists_url":"https://api.github.com/users/veewee/gists{/gist_id}","starred_url":"https://api.github.com/users/veewee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veewee/subscriptions","organizations_url":"https://api.github.com/users/veewee/orgs","repos_url":"https://api.github.com/users/veewee/repos","events_url":"https://api.github.com/users/veewee/events{/privacy}","received_events_url":"https://api.github.com/users/veewee/received_events","type":"User","site_admin":false},"body":"Maybe these colors should be class constants.","created_at":"2016-09-26T05:39:24Z","updated_at":"2016-09-26T05:39:24Z","html_url":"https://github.com/phpro/grumphp/pull/186#discussion_r80410148","pull_request_url":"https://api.github.com/repos/phpro/grumphp/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/comments/80410148"},"html":{"href":"https://github.com/phpro/grumphp/pull/186#discussion_r80410148"},"pull_request":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/phpro/grumphp/pulls/186","id":85962397,"html_url":"https://github.com/phpro/grumphp/pull/186","diff_url":"https://github.com/phpro/grumphp/pull/186.diff","patch_url":"https://github.com/phpro/grumphp/pull/186.patch","issue_url":"https://api.github.com/repos/phpro/grumphp/issues/186","number":186,"state":"open","locked":false,"title":"[FEATURE] Git blacklist formatter","user":{"login":"Kanti","id":471387,"avatar_url":"https://avatars.githubusercontent.com/u/471387?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanti","html_url":"https://github.com/Kanti","followers_url":"https://api.github.com/users/Kanti/followers","following_url":"https://api.github.com/users/Kanti/following{/other_user}","gists_url":"https://api.github.com/users/Kanti/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanti/subscriptions","organizations_url":"https://api.github.com/users/Kanti/orgs","repos_url":"https://api.github.com/users/Kanti/repos","events_url":"https://api.github.com/users/Kanti/events{/privacy}","received_events_url":"https://api.github.com/users/Kanti/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch        | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Documented?   | -\r\n| Fixed tickets | -\r\n\r\nNicer Git Blacklist Task message for very long lines.\r\nExample:\r\n![image](https://cloud.githubusercontent.com/assets/471387/18669462/7a5088b4-7f3b-11e6-917a-e4bdd807e6c4.png)\r\n","created_at":"2016-09-20T12:09:36Z","updated_at":"2016-09-26T05:49:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bae69fd1cfece4d7f230778677aad90dcc020969","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/phpro/grumphp/milestones/6","html_url":"https://github.com/phpro/grumphp/milestones/Version%200.9.5","labels_url":"https://api.github.com/repos/phpro/grumphp/milestones/6/labels","id":2018281,"number":6,"title":"Version 0.9.5","description":"","creator":{"login":"veewee","id":1618158,"avatar_url":"https://avatars.githubusercontent.com/u/1618158?v=3","gravatar_id":"","url":"https://api.github.com/users/veewee","html_url":"https://github.com/veewee","followers_url":"https://api.github.com/users/veewee/followers","following_url":"https://api.github.com/users/veewee/following{/other_user}","gists_url":"https://api.github.com/users/veewee/gists{/gist_id}","starred_url":"https://api.github.com/users/veewee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veewee/subscriptions","organizations_url":"https://api.github.com/users/veewee/orgs","repos_url":"https://api.github.com/users/veewee/repos","events_url":"https://api.github.com/users/veewee/events{/privacy}","received_events_url":"https://api.github.com/users/veewee/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":1,"state":"open","created_at":"2016-09-21T06:27:23Z","updated_at":"2016-09-26T05:37:22Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/phpro/grumphp/pulls/186/commits","review_comments_url":"https://api.github.com/repos/phpro/grumphp/pulls/186/comments","review_comment_url":"https://api.github.com/repos/phpro/grumphp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phpro/grumphp/issues/186/comments","statuses_url":"https://api.github.com/repos/phpro/grumphp/statuses/798f6ced7589d98deecdb47ae3c7bdcd0efeedc4","head":{"label":"Kanti:git-blacklist-formatter","ref":"git-blacklist-formatter","sha":"798f6ced7589d98deecdb47ae3c7bdcd0efeedc4","user":{"login":"Kanti","id":471387,"avatar_url":"https://avatars.githubusercontent.com/u/471387?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanti","html_url":"https://github.com/Kanti","followers_url":"https://api.github.com/users/Kanti/followers","following_url":"https://api.github.com/users/Kanti/following{/other_user}","gists_url":"https://api.github.com/users/Kanti/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanti/subscriptions","organizations_url":"https://api.github.com/users/Kanti/orgs","repos_url":"https://api.github.com/users/Kanti/repos","events_url":"https://api.github.com/users/Kanti/events{/privacy}","received_events_url":"https://api.github.com/users/Kanti/received_events","type":"User","site_admin":false},"repo":{"id":64584368,"name":"grumphp","full_name":"Kanti/grumphp","owner":{"login":"Kanti","id":471387,"avatar_url":"https://avatars.githubusercontent.com/u/471387?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanti","html_url":"https://github.com/Kanti","followers_url":"https://api.github.com/users/Kanti/followers","following_url":"https://api.github.com/users/Kanti/following{/other_user}","gists_url":"https://api.github.com/users/Kanti/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanti/subscriptions","organizations_url":"https://api.github.com/users/Kanti/orgs","repos_url":"https://api.github.com/users/Kanti/repos","events_url":"https://api.github.com/users/Kanti/events{/privacy}","received_events_url":"https://api.github.com/users/Kanti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kanti/grumphp","description":"A PHP code-quality tool","fork":true,"url":"https://api.github.com/repos/Kanti/grumphp","forks_url":"https://api.github.com/repos/Kanti/grumphp/forks","keys_url":"https://api.github.com/repos/Kanti/grumphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kanti/grumphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kanti/grumphp/teams","hooks_url":"https://api.github.com/repos/Kanti/grumphp/hooks","issue_events_url":"https://api.github.com/repos/Kanti/grumphp/issues/events{/number}","events_url":"https://api.github.com/repos/Kanti/grumphp/events","assignees_url":"https://api.github.com/repos/Kanti/grumphp/assignees{/user}","branches_url":"https://api.github.com/repos/Kanti/grumphp/branches{/branch}","tags_url":"https://api.github.com/repos/Kanti/grumphp/tags","blobs_url":"https://api.github.com/repos/Kanti/grumphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kanti/grumphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kanti/grumphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kanti/grumphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kanti/grumphp/statuses/{sha}","languages_url":"https://api.github.com/repos/Kanti/grumphp/languages","stargazers_url":"https://api.github.com/repos/Kanti/grumphp/stargazers","contributors_url":"https://api.github.com/repos/Kanti/grumphp/contributors","subscribers_url":"https://api.github.com/repos/Kanti/grumphp/subscribers","subscription_url":"https://api.github.com/repos/Kanti/grumphp/subscription","commits_url":"https://api.github.com/repos/Kanti/grumphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kanti/grumphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kanti/grumphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kanti/grumphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kanti/grumphp/contents/{+path}","compare_url":"https://api.github.com/repos/Kanti/grumphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kanti/grumphp/merges","archive_url":"https://api.github.com/repos/Kanti/grumphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kanti/grumphp/downloads","issues_url":"https://api.github.com/repos/Kanti/grumphp/issues{/number}","pulls_url":"https://api.github.com/repos/Kanti/grumphp/pulls{/number}","milestones_url":"https://api.github.com/repos/Kanti/grumphp/milestones{/number}","notifications_url":"https://api.github.com/repos/Kanti/grumphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kanti/grumphp/labels{/name}","releases_url":"https://api.github.com/repos/Kanti/grumphp/releases{/id}","deployments_url":"https://api.github.com/repos/Kanti/grumphp/deployments","created_at":"2016-07-31T08:28:18Z","updated_at":"2016-09-20T10:21:07Z","pushed_at":"2016-09-21T10:14:46Z","git_url":"git://github.com/Kanti/grumphp.git","ssh_url":"git@github.com:Kanti/grumphp.git","clone_url":"https://github.com/Kanti/grumphp.git","svn_url":"https://github.com/Kanti/grumphp","homepage":null,"size":960,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"phpro:master","ref":"master","sha":"eee10f9958f8c902989b98d1067cae9a80491ff7","user":{"login":"phpro","id":6286150,"avatar_url":"https://avatars.githubusercontent.com/u/6286150?v=3","gravatar_id":"","url":"https://api.github.com/users/phpro","html_url":"https://github.com/phpro","followers_url":"https://api.github.com/users/phpro/followers","following_url":"https://api.github.com/users/phpro/following{/other_user}","gists_url":"https://api.github.com/users/phpro/gists{/gist_id}","starred_url":"https://api.github.com/users/phpro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpro/subscriptions","organizations_url":"https://api.github.com/users/phpro/orgs","repos_url":"https://api.github.com/users/phpro/repos","events_url":"https://api.github.com/users/phpro/events{/privacy}","received_events_url":"https://api.github.com/users/phpro/received_events","type":"Organization","site_admin":false},"repo":{"id":32482750,"name":"grumphp","full_name":"phpro/grumphp","owner":{"login":"phpro","id":6286150,"avatar_url":"https://avatars.githubusercontent.com/u/6286150?v=3","gravatar_id":"","url":"https://api.github.com/users/phpro","html_url":"https://github.com/phpro","followers_url":"https://api.github.com/users/phpro/followers","following_url":"https://api.github.com/users/phpro/following{/other_user}","gists_url":"https://api.github.com/users/phpro/gists{/gist_id}","starred_url":"https://api.github.com/users/phpro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpro/subscriptions","organizations_url":"https://api.github.com/users/phpro/orgs","repos_url":"https://api.github.com/users/phpro/repos","events_url":"https://api.github.com/users/phpro/events{/privacy}","received_events_url":"https://api.github.com/users/phpro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phpro/grumphp","description":"A PHP code-quality tool","fork":false,"url":"https://api.github.com/repos/phpro/grumphp","forks_url":"https://api.github.com/repos/phpro/grumphp/forks","keys_url":"https://api.github.com/repos/phpro/grumphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phpro/grumphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phpro/grumphp/teams","hooks_url":"https://api.github.com/repos/phpro/grumphp/hooks","issue_events_url":"https://api.github.com/repos/phpro/grumphp/issues/events{/number}","events_url":"https://api.github.com/repos/phpro/grumphp/events","assignees_url":"https://api.github.com/repos/phpro/grumphp/assignees{/user}","branches_url":"https://api.github.com/repos/phpro/grumphp/branches{/branch}","tags_url":"https://api.github.com/repos/phpro/grumphp/tags","blobs_url":"https://api.github.com/repos/phpro/grumphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phpro/grumphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phpro/grumphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/phpro/grumphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phpro/grumphp/statuses/{sha}","languages_url":"https://api.github.com/repos/phpro/grumphp/languages","stargazers_url":"https://api.github.com/repos/phpro/grumphp/stargazers","contributors_url":"https://api.github.com/repos/phpro/grumphp/contributors","subscribers_url":"https://api.github.com/repos/phpro/grumphp/subscribers","subscription_url":"https://api.github.com/repos/phpro/grumphp/subscription","commits_url":"https://api.github.com/repos/phpro/grumphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/phpro/grumphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/phpro/grumphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/phpro/grumphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/phpro/grumphp/contents/{+path}","compare_url":"https://api.github.com/repos/phpro/grumphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phpro/grumphp/merges","archive_url":"https://api.github.com/repos/phpro/grumphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phpro/grumphp/downloads","issues_url":"https://api.github.com/repos/phpro/grumphp/issues{/number}","pulls_url":"https://api.github.com/repos/phpro/grumphp/pulls{/number}","milestones_url":"https://api.github.com/repos/phpro/grumphp/milestones{/number}","notifications_url":"https://api.github.com/repos/phpro/grumphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phpro/grumphp/labels{/name}","releases_url":"https://api.github.com/repos/phpro/grumphp/releases{/id}","deployments_url":"https://api.github.com/repos/phpro/grumphp/deployments","created_at":"2015-03-18T20:34:36Z","updated_at":"2016-09-24T06:37:59Z","pushed_at":"2016-09-25T14:39:41Z","git_url":"git://github.com/phpro/grumphp.git","ssh_url":"git@github.com:phpro/grumphp.git","clone_url":"https://github.com/phpro/grumphp.git","svn_url":"https://github.com/phpro/grumphp","homepage":null,"size":1094,"stargazers_count":1213,"watchers_count":1213,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"open_issues_count":16,"forks":81,"open_issues":16,"watchers":1213,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/186"},"html":{"href":"https://github.com/phpro/grumphp/pull/186"},"issue":{"href":"https://api.github.com/repos/phpro/grumphp/issues/186"},"comments":{"href":"https://api.github.com/repos/phpro/grumphp/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phpro/grumphp/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/phpro/grumphp/statuses/798f6ced7589d98deecdb47ae3c7bdcd0efeedc4"}}}}
{"actor":{"display_login":"veewee"}}