{"action":"created","comment":{"url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/comments/74209193","id":74209193,"diff_hunk":"@@ -0,0 +1,105 @@\n+<?php\n+\n+namespace PsrLinter;\n+\n+/**\n+ * @param string : path-to-file||path-to-dir\n+ * @throws \\PsrLinter\\PsrLinterException\n+ * @return array: array of paths\n+ */\n+function getFilePaths(string $path)\n+{\n+    if (!file_exists($path)) {\n+        throw new PsrLinterException(implode('', ['По указанному пути ни одного файла не обнаружено', PHP_EOL]));\n+    }\n+    $filePaths = [];\n+    if (is_dir($path)) {\n+        $object = new \\RecursiveIteratorIterator(\n+            new \\RecursiveDirectoryIterator($path, \\FilesystemIterator::SKIP_DOTS)\n+        );\n+        foreach ($object as $property) {\n+            $filePaths[] = $property->__toString();\n+        }\n+    } else {\n+        $filePaths[] = $path;\n+    }\n+    return $filePaths;\n+}\n+\n+/**\n+ * @param array : array of paths\n+ * @throws \\PsrLinter\\PsrLinterException\n+ * @return array: path-to-file => file code\n+ */\n+function getFileCode(array $filePaths)\n+{\n+    $codeFiles = array_map(function ($value) {\n+        if (!$code = file_get_contents($value)) {\n+            throw new PsrLinterException(implode('', ['Ошибка чтения файла ', $value, PHP_EOL]));\n+        }\n+        $matches = [];\n+        preg_match_all(\"~<?php~\", $code, $matches);\n+        if (!empty($matches[0])) {\n+            return $code;\n+        }\n+        return null;\n+    }, $filePaths);\n+    return array_combine($filePaths, $codeFiles);\n+}\n+\n+/**\n+ * @param array : path-to-file => all names\n+ * @return array : shape report\n+ */\n+function shapeReport(array $result)\n+{\n+    $report = [implode(' ', [date('[G:i]'), 'Результат проверки'])];\n+    array_map(function ($value, $key) use (&$report) {\n+        $report[] = implode(' ', ['Файл', $key]);\n+        array_walk($value, function (string $str) use (&$report) {\n+            $report[] = $str;\n+        });\n+    }, $result, array_keys($result));\n+    $report[] = '';\n+    return $report;\n+}\n+\n+/**\n+ * @param array : report of checking\n+ */\n+function addLog(array $report)\n+{\n+    try {\n+        if (!file_exists('../report')) {\n+            mkdir('../report');\n+        }\n+        file_put_contents('../report/results_of_checking', implode(PHP_EOL, $report), FILE_APPEND);\n+    } catch (PsrLinterException $e) {\n+        echo implode(' ', ['Ошибка записи в лог', $e->getMessage()]);","path":"src/Functions.php","position":78,"original_position":78,"commit_id":"98d631a3050d8a0237b0f4139cf2f914d3ae464b","original_commit_id":"98d631a3050d8a0237b0f4139cf2f914d3ae464b","user":{"login":"pldin601","id":8050895,"avatar_url":"https://avatars.githubusercontent.com/u/8050895?v=3","gravatar_id":"","url":"https://api.github.com/users/pldin601","html_url":"https://github.com/pldin601","followers_url":"https://api.github.com/users/pldin601/followers","following_url":"https://api.github.com/users/pldin601/following{/other_user}","gists_url":"https://api.github.com/users/pldin601/gists{/gist_id}","starred_url":"https://api.github.com/users/pldin601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pldin601/subscriptions","organizations_url":"https://api.github.com/users/pldin601/orgs","repos_url":"https://api.github.com/users/pldin601/repos","events_url":"https://api.github.com/users/pldin601/events{/privacy}","received_events_url":"https://api.github.com/users/pldin601/received_events","type":"User","site_admin":false},"body":"Сайд эффект.","created_at":"2016-08-10T09:02:32Z","updated_at":"2016-08-10T09:02:32Z","html_url":"https://github.com/amlagoda/hexlet-psr-linter/pull/4#discussion_r74209193","pull_request_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/comments/74209193"},"html":{"href":"https://github.com/amlagoda/hexlet-psr-linter/pull/4#discussion_r74209193"},"pull_request":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4","id":80593783,"html_url":"https://github.com/amlagoda/hexlet-psr-linter/pull/4","diff_url":"https://github.com/amlagoda/hexlet-psr-linter/pull/4.diff","patch_url":"https://github.com/amlagoda/hexlet-psr-linter/pull/4.patch","issue_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/4","number":4,"state":"open","locked":false,"title":"Step 2 3 4 9","user":{"login":"amlagoda","id":13574012,"avatar_url":"https://avatars.githubusercontent.com/u/13574012?v=3","gravatar_id":"","url":"https://api.github.com/users/amlagoda","html_url":"https://github.com/amlagoda","followers_url":"https://api.github.com/users/amlagoda/followers","following_url":"https://api.github.com/users/amlagoda/following{/other_user}","gists_url":"https://api.github.com/users/amlagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/amlagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlagoda/subscriptions","organizations_url":"https://api.github.com/users/amlagoda/orgs","repos_url":"https://api.github.com/users/amlagoda/repos","events_url":"https://api.github.com/users/amlagoda/events{/privacy}","received_events_url":"https://api.github.com/users/amlagoda/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-09T10:07:04Z","updated_at":"2016-08-10T09:02:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4d79fe4e2c843268d5c2d24465afce78b3dc63e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4/commits","review_comments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4/comments","review_comment_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/4/comments","statuses_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/statuses/98d631a3050d8a0237b0f4139cf2f914d3ae464b","head":{"label":"amlagoda:step-2-3-4-9","ref":"step-2-3-4-9","sha":"98d631a3050d8a0237b0f4139cf2f914d3ae464b","user":{"login":"amlagoda","id":13574012,"avatar_url":"https://avatars.githubusercontent.com/u/13574012?v=3","gravatar_id":"","url":"https://api.github.com/users/amlagoda","html_url":"https://github.com/amlagoda","followers_url":"https://api.github.com/users/amlagoda/followers","following_url":"https://api.github.com/users/amlagoda/following{/other_user}","gists_url":"https://api.github.com/users/amlagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/amlagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlagoda/subscriptions","organizations_url":"https://api.github.com/users/amlagoda/orgs","repos_url":"https://api.github.com/users/amlagoda/repos","events_url":"https://api.github.com/users/amlagoda/events{/privacy}","received_events_url":"https://api.github.com/users/amlagoda/received_events","type":"User","site_admin":false},"repo":{"id":64566244,"name":"hexlet-psr-linter","full_name":"amlagoda/hexlet-psr-linter","owner":{"login":"amlagoda","id":13574012,"avatar_url":"https://avatars.githubusercontent.com/u/13574012?v=3","gravatar_id":"","url":"https://api.github.com/users/amlagoda","html_url":"https://github.com/amlagoda","followers_url":"https://api.github.com/users/amlagoda/followers","following_url":"https://api.github.com/users/amlagoda/following{/other_user}","gists_url":"https://api.github.com/users/amlagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/amlagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlagoda/subscriptions","organizations_url":"https://api.github.com/users/amlagoda/orgs","repos_url":"https://api.github.com/users/amlagoda/repos","events_url":"https://api.github.com/users/amlagoda/events{/privacy}","received_events_url":"https://api.github.com/users/amlagoda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amlagoda/hexlet-psr-linter","description":null,"fork":false,"url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter","forks_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/forks","keys_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/teams","hooks_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/hooks","issue_events_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/events{/number}","events_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/events","assignees_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/assignees{/user}","branches_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/branches{/branch}","tags_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/tags","blobs_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/refs{/sha}","trees_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/statuses/{sha}","languages_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/languages","stargazers_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/stargazers","contributors_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/contributors","subscribers_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/subscribers","subscription_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/subscription","commits_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/commits{/sha}","git_commits_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/commits{/sha}","comments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/comments{/number}","issue_comment_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/comments{/number}","contents_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/contents/{+path}","compare_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/merges","archive_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/downloads","issues_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues{/number}","pulls_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls{/number}","milestones_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/milestones{/number}","notifications_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/labels{/name}","releases_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/releases{/id}","deployments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/deployments","created_at":"2016-07-30T22:15:24Z","updated_at":"2016-08-01T07:10:16Z","pushed_at":"2016-08-09T10:07:04Z","git_url":"git://github.com/amlagoda/hexlet-psr-linter.git","ssh_url":"git@github.com:amlagoda/hexlet-psr-linter.git","clone_url":"https://github.com/amlagoda/hexlet-psr-linter.git","svn_url":"https://github.com/amlagoda/hexlet-psr-linter","homepage":null,"size":40,"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":"amlagoda:master","ref":"master","sha":"160d929d055e964d8524eaec90facd1fcc88c9f8","user":{"login":"amlagoda","id":13574012,"avatar_url":"https://avatars.githubusercontent.com/u/13574012?v=3","gravatar_id":"","url":"https://api.github.com/users/amlagoda","html_url":"https://github.com/amlagoda","followers_url":"https://api.github.com/users/amlagoda/followers","following_url":"https://api.github.com/users/amlagoda/following{/other_user}","gists_url":"https://api.github.com/users/amlagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/amlagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlagoda/subscriptions","organizations_url":"https://api.github.com/users/amlagoda/orgs","repos_url":"https://api.github.com/users/amlagoda/repos","events_url":"https://api.github.com/users/amlagoda/events{/privacy}","received_events_url":"https://api.github.com/users/amlagoda/received_events","type":"User","site_admin":false},"repo":{"id":64566244,"name":"hexlet-psr-linter","full_name":"amlagoda/hexlet-psr-linter","owner":{"login":"amlagoda","id":13574012,"avatar_url":"https://avatars.githubusercontent.com/u/13574012?v=3","gravatar_id":"","url":"https://api.github.com/users/amlagoda","html_url":"https://github.com/amlagoda","followers_url":"https://api.github.com/users/amlagoda/followers","following_url":"https://api.github.com/users/amlagoda/following{/other_user}","gists_url":"https://api.github.com/users/amlagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/amlagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amlagoda/subscriptions","organizations_url":"https://api.github.com/users/amlagoda/orgs","repos_url":"https://api.github.com/users/amlagoda/repos","events_url":"https://api.github.com/users/amlagoda/events{/privacy}","received_events_url":"https://api.github.com/users/amlagoda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amlagoda/hexlet-psr-linter","description":null,"fork":false,"url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter","forks_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/forks","keys_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/teams","hooks_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/hooks","issue_events_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/events{/number}","events_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/events","assignees_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/assignees{/user}","branches_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/branches{/branch}","tags_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/tags","blobs_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/refs{/sha}","trees_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/statuses/{sha}","languages_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/languages","stargazers_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/stargazers","contributors_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/contributors","subscribers_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/subscribers","subscription_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/subscription","commits_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/commits{/sha}","git_commits_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/git/commits{/sha}","comments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/comments{/number}","issue_comment_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/comments{/number}","contents_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/contents/{+path}","compare_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/merges","archive_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/downloads","issues_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues{/number}","pulls_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls{/number}","milestones_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/milestones{/number}","notifications_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/labels{/name}","releases_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/releases{/id}","deployments_url":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/deployments","created_at":"2016-07-30T22:15:24Z","updated_at":"2016-08-01T07:10:16Z","pushed_at":"2016-08-09T10:07:04Z","git_url":"git://github.com/amlagoda/hexlet-psr-linter.git","ssh_url":"git@github.com:amlagoda/hexlet-psr-linter.git","clone_url":"https://github.com/amlagoda/hexlet-psr-linter.git","svn_url":"https://github.com/amlagoda/hexlet-psr-linter","homepage":null,"size":40,"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"}},"_links":{"self":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4"},"html":{"href":"https://github.com/amlagoda/hexlet-psr-linter/pull/4"},"issue":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/4"},"comments":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/amlagoda/hexlet-psr-linter/statuses/98d631a3050d8a0237b0f4139cf2f914d3ae464b"}}}}
{"actor":{"display_login":"pldin601"}}