{"action":"created","comment":{"url":"https://api.github.com/repos/pers1307/Blog/pulls/comments/44635501","id":44635501,"diff_hunk":"@@ -0,0 +1,77 @@\n+<?php\n+/**\n+ * Users.php\n+ *\n+ * @author      Pereskokov Yurii\n+ * @copyright   2015 Pereskokov Yurii\n+ * @license     The MIT License (MIT) http://opensource.org/licenses/mit-license.php\n+ * @link        https://github.com/pers1307/Blog_v_2.0\n+ */\n+\n+namespace pers1307\\blog\\models;\n+\n+use pers1307\\blog\\db;\n+use KoKoKo\\assert\\Assert;\n+\n+class Users\n+{\n+    /**\n+     * @return Array\n+     */\n+    public function findAll()\n+    {\n+        $connection = (new db\\MySqlConnection())->getConnection();\n+        $sql = 'SELECT * FROM users';\n+        $sth = $connection->prepare($sql);\n+        $sth->execute();\n+        $allUsers = $sth->fetchAll();\n+\n+        $resultArray = [];\n+        foreach ($allUsers as $row) {\n+            $user = $this->setUserFromRowQuery($row);\n+            $resultArray[] = $user;\n+        }\n+\n+        return $resultArray;\n+    }\n+\n+    /**\n+     * @param string $login\n+     *\n+     * @return null|User\n+     * @throws \\InvalidArgumentException\n+     */\n+    public function findByCreditionals($login)\n+    {\n+        Assert::assert($login, 'login')->notEmpty()->string();\n+\n+        $connection = (new db\\MySqlConnection())->getConnection();\n+        $stmt = $connection->prepare('SELECT * FROM users WHERE Login = :login');\n+        $stmt->execute(['login' => $login]);\n+\n+        $row = $stmt->fetch();\n+        if ($row !== null) {\n+            $resultUser = $this->setUserFromRowQuery($row);\n+        } else {\n+            $resultUser = null;\n+        }\n+\n+        return $resultUser;\n+    }\n+\n+    /**\n+     * @param Array $row\n+     *\n+     * @return User\n+     */\n+    protected function setUserFromRowQuery($row)\n+    {\n+        $resultUser = (new User())","path":"src/models/Users.php","position":69,"original_position":69,"commit_id":"c384e6b1bdb97fec2f4bafb80a4004175f4f4da0","original_commit_id":"c384e6b1bdb97fec2f4bafb80a4004175f4f4da0","user":{"login":"index0h","id":675070,"avatar_url":"https://avatars.githubusercontent.com/u/675070?v=3","gravatar_id":"","url":"https://api.github.com/users/index0h","html_url":"https://github.com/index0h","followers_url":"https://api.github.com/users/index0h/followers","following_url":"https://api.github.com/users/index0h/following{/other_user}","gists_url":"https://api.github.com/users/index0h/gists{/gist_id}","starred_url":"https://api.github.com/users/index0h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/index0h/subscriptions","organizations_url":"https://api.github.com/users/index0h/orgs","repos_url":"https://api.github.com/users/index0h/repos","events_url":"https://api.github.com/users/index0h/events{/privacy}","received_events_url":"https://api.github.com/users/index0h/received_events","type":"User","site_admin":false},"body":"Что произойдет, если тебе влетит сюда стока, или объект?","created_at":"2015-11-12T09:19:35Z","updated_at":"2015-11-12T09:19:35Z","html_url":"https://github.com/pers1307/Blog/pull/14#discussion_r44635501","pull_request_url":"https://api.github.com/repos/pers1307/Blog/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/comments/44635501"},"html":{"href":"https://github.com/pers1307/Blog/pull/14#discussion_r44635501"},"pull_request":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/pers1307/Blog/pulls/14","id":50414933,"html_url":"https://github.com/pers1307/Blog/pull/14","diff_url":"https://github.com/pers1307/Blog/pull/14.diff","patch_url":"https://github.com/pers1307/Blog/pull/14.patch","issue_url":"https://api.github.com/repos/pers1307/Blog/issues/14","number":14,"state":"open","locked":false,"title":"Version 3.1","user":{"login":"pers1307","id":15194486,"avatar_url":"https://avatars.githubusercontent.com/u/15194486?v=3","gravatar_id":"","url":"https://api.github.com/users/pers1307","html_url":"https://github.com/pers1307","followers_url":"https://api.github.com/users/pers1307/followers","following_url":"https://api.github.com/users/pers1307/following{/other_user}","gists_url":"https://api.github.com/users/pers1307/gists{/gist_id}","starred_url":"https://api.github.com/users/pers1307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pers1307/subscriptions","organizations_url":"https://api.github.com/users/pers1307/orgs","repos_url":"https://api.github.com/users/pers1307/repos","events_url":"https://api.github.com/users/pers1307/events{/privacy}","received_events_url":"https://api.github.com/users/pers1307/received_events","type":"User","site_admin":false},"body":"Проверь плж.","created_at":"2015-11-11T18:00:21Z","updated_at":"2015-11-12T09:19:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2b5593c960e1329edb2387c548768ddc71191e9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pers1307/Blog/pulls/14/commits","review_comments_url":"https://api.github.com/repos/pers1307/Blog/pulls/14/comments","review_comment_url":"https://api.github.com/repos/pers1307/Blog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pers1307/Blog/issues/14/comments","statuses_url":"https://api.github.com/repos/pers1307/Blog/statuses/c384e6b1bdb97fec2f4bafb80a4004175f4f4da0","head":{"label":"pers1307:version_3.1","ref":"version_3.1","sha":"c384e6b1bdb97fec2f4bafb80a4004175f4f4da0","user":{"login":"pers1307","id":15194486,"avatar_url":"https://avatars.githubusercontent.com/u/15194486?v=3","gravatar_id":"","url":"https://api.github.com/users/pers1307","html_url":"https://github.com/pers1307","followers_url":"https://api.github.com/users/pers1307/followers","following_url":"https://api.github.com/users/pers1307/following{/other_user}","gists_url":"https://api.github.com/users/pers1307/gists{/gist_id}","starred_url":"https://api.github.com/users/pers1307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pers1307/subscriptions","organizations_url":"https://api.github.com/users/pers1307/orgs","repos_url":"https://api.github.com/users/pers1307/repos","events_url":"https://api.github.com/users/pers1307/events{/privacy}","received_events_url":"https://api.github.com/users/pers1307/received_events","type":"User","site_admin":false},"repo":{"id":44674094,"name":"Blog","full_name":"pers1307/Blog","owner":{"login":"pers1307","id":15194486,"avatar_url":"https://avatars.githubusercontent.com/u/15194486?v=3","gravatar_id":"","url":"https://api.github.com/users/pers1307","html_url":"https://github.com/pers1307","followers_url":"https://api.github.com/users/pers1307/followers","following_url":"https://api.github.com/users/pers1307/following{/other_user}","gists_url":"https://api.github.com/users/pers1307/gists{/gist_id}","starred_url":"https://api.github.com/users/pers1307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pers1307/subscriptions","organizations_url":"https://api.github.com/users/pers1307/orgs","repos_url":"https://api.github.com/users/pers1307/repos","events_url":"https://api.github.com/users/pers1307/events{/privacy}","received_events_url":"https://api.github.com/users/pers1307/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pers1307/Blog","description":"Format Blog","fork":false,"url":"https://api.github.com/repos/pers1307/Blog","forks_url":"https://api.github.com/repos/pers1307/Blog/forks","keys_url":"https://api.github.com/repos/pers1307/Blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pers1307/Blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pers1307/Blog/teams","hooks_url":"https://api.github.com/repos/pers1307/Blog/hooks","issue_events_url":"https://api.github.com/repos/pers1307/Blog/issues/events{/number}","events_url":"https://api.github.com/repos/pers1307/Blog/events","assignees_url":"https://api.github.com/repos/pers1307/Blog/assignees{/user}","branches_url":"https://api.github.com/repos/pers1307/Blog/branches{/branch}","tags_url":"https://api.github.com/repos/pers1307/Blog/tags","blobs_url":"https://api.github.com/repos/pers1307/Blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pers1307/Blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pers1307/Blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/pers1307/Blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pers1307/Blog/statuses/{sha}","languages_url":"https://api.github.com/repos/pers1307/Blog/languages","stargazers_url":"https://api.github.com/repos/pers1307/Blog/stargazers","contributors_url":"https://api.github.com/repos/pers1307/Blog/contributors","subscribers_url":"https://api.github.com/repos/pers1307/Blog/subscribers","subscription_url":"https://api.github.com/repos/pers1307/Blog/subscription","commits_url":"https://api.github.com/repos/pers1307/Blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/pers1307/Blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/pers1307/Blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/pers1307/Blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/pers1307/Blog/contents/{+path}","compare_url":"https://api.github.com/repos/pers1307/Blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pers1307/Blog/merges","archive_url":"https://api.github.com/repos/pers1307/Blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pers1307/Blog/downloads","issues_url":"https://api.github.com/repos/pers1307/Blog/issues{/number}","pulls_url":"https://api.github.com/repos/pers1307/Blog/pulls{/number}","milestones_url":"https://api.github.com/repos/pers1307/Blog/milestones{/number}","notifications_url":"https://api.github.com/repos/pers1307/Blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pers1307/Blog/labels{/name}","releases_url":"https://api.github.com/repos/pers1307/Blog/releases{/id}","created_at":"2015-10-21T12:19:01Z","updated_at":"2015-11-04T09:46:18Z","pushed_at":"2015-11-11T18:00:22Z","git_url":"git://github.com/pers1307/Blog.git","ssh_url":"git@github.com:pers1307/Blog.git","clone_url":"https://github.com/pers1307/Blog.git","svn_url":"https://github.com/pers1307/Blog","homepage":null,"size":3552,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"base":{"label":"pers1307:master","ref":"master","sha":"0d0515d9a0adeb7635bf84dd6850f5ae5f06c4db","user":{"login":"pers1307","id":15194486,"avatar_url":"https://avatars.githubusercontent.com/u/15194486?v=3","gravatar_id":"","url":"https://api.github.com/users/pers1307","html_url":"https://github.com/pers1307","followers_url":"https://api.github.com/users/pers1307/followers","following_url":"https://api.github.com/users/pers1307/following{/other_user}","gists_url":"https://api.github.com/users/pers1307/gists{/gist_id}","starred_url":"https://api.github.com/users/pers1307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pers1307/subscriptions","organizations_url":"https://api.github.com/users/pers1307/orgs","repos_url":"https://api.github.com/users/pers1307/repos","events_url":"https://api.github.com/users/pers1307/events{/privacy}","received_events_url":"https://api.github.com/users/pers1307/received_events","type":"User","site_admin":false},"repo":{"id":44674094,"name":"Blog","full_name":"pers1307/Blog","owner":{"login":"pers1307","id":15194486,"avatar_url":"https://avatars.githubusercontent.com/u/15194486?v=3","gravatar_id":"","url":"https://api.github.com/users/pers1307","html_url":"https://github.com/pers1307","followers_url":"https://api.github.com/users/pers1307/followers","following_url":"https://api.github.com/users/pers1307/following{/other_user}","gists_url":"https://api.github.com/users/pers1307/gists{/gist_id}","starred_url":"https://api.github.com/users/pers1307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pers1307/subscriptions","organizations_url":"https://api.github.com/users/pers1307/orgs","repos_url":"https://api.github.com/users/pers1307/repos","events_url":"https://api.github.com/users/pers1307/events{/privacy}","received_events_url":"https://api.github.com/users/pers1307/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pers1307/Blog","description":"Format Blog","fork":false,"url":"https://api.github.com/repos/pers1307/Blog","forks_url":"https://api.github.com/repos/pers1307/Blog/forks","keys_url":"https://api.github.com/repos/pers1307/Blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pers1307/Blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pers1307/Blog/teams","hooks_url":"https://api.github.com/repos/pers1307/Blog/hooks","issue_events_url":"https://api.github.com/repos/pers1307/Blog/issues/events{/number}","events_url":"https://api.github.com/repos/pers1307/Blog/events","assignees_url":"https://api.github.com/repos/pers1307/Blog/assignees{/user}","branches_url":"https://api.github.com/repos/pers1307/Blog/branches{/branch}","tags_url":"https://api.github.com/repos/pers1307/Blog/tags","blobs_url":"https://api.github.com/repos/pers1307/Blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pers1307/Blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pers1307/Blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/pers1307/Blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pers1307/Blog/statuses/{sha}","languages_url":"https://api.github.com/repos/pers1307/Blog/languages","stargazers_url":"https://api.github.com/repos/pers1307/Blog/stargazers","contributors_url":"https://api.github.com/repos/pers1307/Blog/contributors","subscribers_url":"https://api.github.com/repos/pers1307/Blog/subscribers","subscription_url":"https://api.github.com/repos/pers1307/Blog/subscription","commits_url":"https://api.github.com/repos/pers1307/Blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/pers1307/Blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/pers1307/Blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/pers1307/Blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/pers1307/Blog/contents/{+path}","compare_url":"https://api.github.com/repos/pers1307/Blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pers1307/Blog/merges","archive_url":"https://api.github.com/repos/pers1307/Blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pers1307/Blog/downloads","issues_url":"https://api.github.com/repos/pers1307/Blog/issues{/number}","pulls_url":"https://api.github.com/repos/pers1307/Blog/pulls{/number}","milestones_url":"https://api.github.com/repos/pers1307/Blog/milestones{/number}","notifications_url":"https://api.github.com/repos/pers1307/Blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pers1307/Blog/labels{/name}","releases_url":"https://api.github.com/repos/pers1307/Blog/releases{/id}","created_at":"2015-10-21T12:19:01Z","updated_at":"2015-11-04T09:46:18Z","pushed_at":"2015-11-11T18:00:22Z","git_url":"git://github.com/pers1307/Blog.git","ssh_url":"git@github.com:pers1307/Blog.git","clone_url":"https://github.com/pers1307/Blog.git","svn_url":"https://github.com/pers1307/Blog","homepage":null,"size":3552,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/14"},"html":{"href":"https://github.com/pers1307/Blog/pull/14"},"issue":{"href":"https://api.github.com/repos/pers1307/Blog/issues/14"},"comments":{"href":"https://api.github.com/repos/pers1307/Blog/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pers1307/Blog/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/pers1307/Blog/statuses/c384e6b1bdb97fec2f4bafb80a4004175f4f4da0"}}}}