{"action":"created","comment":{"url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments/65125892","id":65125892,"diff_hunk":"@@ -5,30 +5,48 @@\n {\n     protected $type = 'id';\n     protected $class = '';\n+    protected $allow_abbr = true;\n+    protected $allow_obj = false;\n+    protected $key_attr = 'id';\n     protected $parsed;\n \n     public function validate($value)\n     {\n-        if (is_numeric($value) && $value <= 0) {\n-            return false;\n+        if (is_numeric($value)) {\n+            if ($value <= 0) {\n+                return false;\n+            }\n+        } else if (is_array($value)) {\n+            if (!$this->allow_obj) {\n+                return false;\n+            }\n+        } else {\n+            // not numeric and obj not allowed, so check abbr string\n+            if (!$this->allow_abbr || !is_string($value) || !preg_match('/^[a-zA-Z]{2,5}$/', $value)) {\n+                return false;\n+            }\n         }\n \n-        if (!is_numeric($value) && (!is_string($value) || !preg_match('/^[a-zA-Z]{2,5}$/', $value))) {\n-            return false;\n-        }\n         return $this->exists($value);\n     }\n \n     public function parse($id)\n     {\n-        $class = $this->class;\n-\n         if ($this->parsed) {\n             return $this->parsed;\n         }\n \n+        if (is_array($id)) {\n+            if (!$this->allow_obj) {\n+                throw new \\Exception('Array input not allowed');\n+            }\n+            $id = $id[$this->key_attr];\n+        }\n+\n+        $class = $this->class;\n+\n         if (is_numeric($id)) {\n-            return $class::find($id);\n+            return $class::find(intval($id));","path":"src/app/Api/Parsers/IdOrAbbrParserBase.php","position":53,"original_position":53,"commit_id":"b11031df3053db26e7bcfc029083401bb27b17de","original_commit_id":"b11031df3053db26e7bcfc029083401bb27b17de","user":{"login":"pdarg","id":5846767,"avatar_url":"https://avatars.githubusercontent.com/u/5846767?v=3","gravatar_id":"","url":"https://api.github.com/users/pdarg","html_url":"https://github.com/pdarg","followers_url":"https://api.github.com/users/pdarg/followers","following_url":"https://api.github.com/users/pdarg/following{/other_user}","gists_url":"https://api.github.com/users/pdarg/gists{/gist_id}","starred_url":"https://api.github.com/users/pdarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdarg/subscriptions","organizations_url":"https://api.github.com/users/pdarg/orgs","repos_url":"https://api.github.com/users/pdarg/repos","events_url":"https://api.github.com/users/pdarg/events{/privacy}","received_events_url":"https://api.github.com/users/pdarg/received_events","type":"User","site_admin":false},"body":"if `intval()` isn't needed, please remove it for cleanliness","created_at":"2016-05-31T05:43:17Z","updated_at":"2016-05-31T05:43:17Z","html_url":"https://github.com/tmlpstats/tmlpstats/pull/448#discussion_r65125892","pull_request_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448","_links":{"self":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments/65125892"},"html":{"href":"https://github.com/tmlpstats/tmlpstats/pull/448#discussion_r65125892"},"pull_request":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448"}}},"pull_request":{"url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448","id":71960449,"html_url":"https://github.com/tmlpstats/tmlpstats/pull/448","diff_url":"https://github.com/tmlpstats/tmlpstats/pull/448.diff","patch_url":"https://github.com/tmlpstats/tmlpstats/pull/448.patch","issue_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/448","number":448,"state":"open","locked":false,"title":"Team application saving works","user":{"login":"crast","id":1609368,"avatar_url":"https://avatars.githubusercontent.com/u/1609368?v=3","gravatar_id":"","url":"https://api.github.com/users/crast","html_url":"https://github.com/crast","followers_url":"https://api.github.com/users/crast/followers","following_url":"https://api.github.com/users/crast/following{/other_user}","gists_url":"https://api.github.com/users/crast/gists{/gist_id}","starred_url":"https://api.github.com/users/crast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crast/subscriptions","organizations_url":"https://api.github.com/users/crast/orgs","repos_url":"https://api.github.com/users/crast/repos","events_url":"https://api.github.com/users/crast/events{/privacy}","received_events_url":"https://api.github.com/users/crast/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-31T05:33:47Z","updated_at":"2016-05-31T05:43:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dca905ff55387c4c073f9c8d0f2b1c6a42412e7a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448/commits","review_comments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448/comments","review_comment_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/448/comments","statuses_url":"https://api.github.com/repos/tmlpstats/tmlpstats/statuses/b11031df3053db26e7bcfc029083401bb27b17de","head":{"label":"crast:applications-update-create","ref":"applications-update-create","sha":"b11031df3053db26e7bcfc029083401bb27b17de","user":{"login":"crast","id":1609368,"avatar_url":"https://avatars.githubusercontent.com/u/1609368?v=3","gravatar_id":"","url":"https://api.github.com/users/crast","html_url":"https://github.com/crast","followers_url":"https://api.github.com/users/crast/followers","following_url":"https://api.github.com/users/crast/following{/other_user}","gists_url":"https://api.github.com/users/crast/gists{/gist_id}","starred_url":"https://api.github.com/users/crast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crast/subscriptions","organizations_url":"https://api.github.com/users/crast/orgs","repos_url":"https://api.github.com/users/crast/repos","events_url":"https://api.github.com/users/crast/events{/privacy}","received_events_url":"https://api.github.com/users/crast/received_events","type":"User","site_admin":false},"repo":{"id":39049412,"name":"tmlpstats","full_name":"crast/tmlpstats","owner":{"login":"crast","id":1609368,"avatar_url":"https://avatars.githubusercontent.com/u/1609368?v=3","gravatar_id":"","url":"https://api.github.com/users/crast","html_url":"https://github.com/crast","followers_url":"https://api.github.com/users/crast/followers","following_url":"https://api.github.com/users/crast/following{/other_user}","gists_url":"https://api.github.com/users/crast/gists{/gist_id}","starred_url":"https://api.github.com/users/crast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crast/subscriptions","organizations_url":"https://api.github.com/users/crast/orgs","repos_url":"https://api.github.com/users/crast/repos","events_url":"https://api.github.com/users/crast/events{/privacy}","received_events_url":"https://api.github.com/users/crast/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/crast/tmlpstats","description":"TMLP Stats","fork":true,"url":"https://api.github.com/repos/crast/tmlpstats","forks_url":"https://api.github.com/repos/crast/tmlpstats/forks","keys_url":"https://api.github.com/repos/crast/tmlpstats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crast/tmlpstats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crast/tmlpstats/teams","hooks_url":"https://api.github.com/repos/crast/tmlpstats/hooks","issue_events_url":"https://api.github.com/repos/crast/tmlpstats/issues/events{/number}","events_url":"https://api.github.com/repos/crast/tmlpstats/events","assignees_url":"https://api.github.com/repos/crast/tmlpstats/assignees{/user}","branches_url":"https://api.github.com/repos/crast/tmlpstats/branches{/branch}","tags_url":"https://api.github.com/repos/crast/tmlpstats/tags","blobs_url":"https://api.github.com/repos/crast/tmlpstats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crast/tmlpstats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crast/tmlpstats/git/refs{/sha}","trees_url":"https://api.github.com/repos/crast/tmlpstats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crast/tmlpstats/statuses/{sha}","languages_url":"https://api.github.com/repos/crast/tmlpstats/languages","stargazers_url":"https://api.github.com/repos/crast/tmlpstats/stargazers","contributors_url":"https://api.github.com/repos/crast/tmlpstats/contributors","subscribers_url":"https://api.github.com/repos/crast/tmlpstats/subscribers","subscription_url":"https://api.github.com/repos/crast/tmlpstats/subscription","commits_url":"https://api.github.com/repos/crast/tmlpstats/commits{/sha}","git_commits_url":"https://api.github.com/repos/crast/tmlpstats/git/commits{/sha}","comments_url":"https://api.github.com/repos/crast/tmlpstats/comments{/number}","issue_comment_url":"https://api.github.com/repos/crast/tmlpstats/issues/comments{/number}","contents_url":"https://api.github.com/repos/crast/tmlpstats/contents/{+path}","compare_url":"https://api.github.com/repos/crast/tmlpstats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crast/tmlpstats/merges","archive_url":"https://api.github.com/repos/crast/tmlpstats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crast/tmlpstats/downloads","issues_url":"https://api.github.com/repos/crast/tmlpstats/issues{/number}","pulls_url":"https://api.github.com/repos/crast/tmlpstats/pulls{/number}","milestones_url":"https://api.github.com/repos/crast/tmlpstats/milestones{/number}","notifications_url":"https://api.github.com/repos/crast/tmlpstats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crast/tmlpstats/labels{/name}","releases_url":"https://api.github.com/repos/crast/tmlpstats/releases{/id}","deployments_url":"https://api.github.com/repos/crast/tmlpstats/deployments","created_at":"2015-07-14T02:38:33Z","updated_at":"2016-05-17T03:59:35Z","pushed_at":"2016-05-31T05:33:28Z","git_url":"git://github.com/crast/tmlpstats.git","ssh_url":"git@github.com:crast/tmlpstats.git","clone_url":"https://github.com/crast/tmlpstats.git","svn_url":"https://github.com/crast/tmlpstats","homepage":null,"size":4042,"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":"tmlpstats:master","ref":"master","sha":"4cc6aae54f0e502579c38cbe91bfb737202e7efc","user":{"login":"tmlpstats","id":16251117,"avatar_url":"https://avatars.githubusercontent.com/u/16251117?v=3","gravatar_id":"","url":"https://api.github.com/users/tmlpstats","html_url":"https://github.com/tmlpstats","followers_url":"https://api.github.com/users/tmlpstats/followers","following_url":"https://api.github.com/users/tmlpstats/following{/other_user}","gists_url":"https://api.github.com/users/tmlpstats/gists{/gist_id}","starred_url":"https://api.github.com/users/tmlpstats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmlpstats/subscriptions","organizations_url":"https://api.github.com/users/tmlpstats/orgs","repos_url":"https://api.github.com/users/tmlpstats/repos","events_url":"https://api.github.com/users/tmlpstats/events{/privacy}","received_events_url":"https://api.github.com/users/tmlpstats/received_events","type":"Organization","site_admin":false},"repo":{"id":31303967,"name":"tmlpstats","full_name":"tmlpstats/tmlpstats","owner":{"login":"tmlpstats","id":16251117,"avatar_url":"https://avatars.githubusercontent.com/u/16251117?v=3","gravatar_id":"","url":"https://api.github.com/users/tmlpstats","html_url":"https://github.com/tmlpstats","followers_url":"https://api.github.com/users/tmlpstats/followers","following_url":"https://api.github.com/users/tmlpstats/following{/other_user}","gists_url":"https://api.github.com/users/tmlpstats/gists{/gist_id}","starred_url":"https://api.github.com/users/tmlpstats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmlpstats/subscriptions","organizations_url":"https://api.github.com/users/tmlpstats/orgs","repos_url":"https://api.github.com/users/tmlpstats/repos","events_url":"https://api.github.com/users/tmlpstats/events{/privacy}","received_events_url":"https://api.github.com/users/tmlpstats/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tmlpstats/tmlpstats","description":"TMLP Stats","fork":false,"url":"https://api.github.com/repos/tmlpstats/tmlpstats","forks_url":"https://api.github.com/repos/tmlpstats/tmlpstats/forks","keys_url":"https://api.github.com/repos/tmlpstats/tmlpstats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmlpstats/tmlpstats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmlpstats/tmlpstats/teams","hooks_url":"https://api.github.com/repos/tmlpstats/tmlpstats/hooks","issue_events_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/events{/number}","events_url":"https://api.github.com/repos/tmlpstats/tmlpstats/events","assignees_url":"https://api.github.com/repos/tmlpstats/tmlpstats/assignees{/user}","branches_url":"https://api.github.com/repos/tmlpstats/tmlpstats/branches{/branch}","tags_url":"https://api.github.com/repos/tmlpstats/tmlpstats/tags","blobs_url":"https://api.github.com/repos/tmlpstats/tmlpstats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmlpstats/tmlpstats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmlpstats/tmlpstats/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmlpstats/tmlpstats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmlpstats/tmlpstats/statuses/{sha}","languages_url":"https://api.github.com/repos/tmlpstats/tmlpstats/languages","stargazers_url":"https://api.github.com/repos/tmlpstats/tmlpstats/stargazers","contributors_url":"https://api.github.com/repos/tmlpstats/tmlpstats/contributors","subscribers_url":"https://api.github.com/repos/tmlpstats/tmlpstats/subscribers","subscription_url":"https://api.github.com/repos/tmlpstats/tmlpstats/subscription","commits_url":"https://api.github.com/repos/tmlpstats/tmlpstats/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmlpstats/tmlpstats/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmlpstats/tmlpstats/contents/{+path}","compare_url":"https://api.github.com/repos/tmlpstats/tmlpstats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmlpstats/tmlpstats/merges","archive_url":"https://api.github.com/repos/tmlpstats/tmlpstats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmlpstats/tmlpstats/downloads","issues_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues{/number}","pulls_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls{/number}","milestones_url":"https://api.github.com/repos/tmlpstats/tmlpstats/milestones{/number}","notifications_url":"https://api.github.com/repos/tmlpstats/tmlpstats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmlpstats/tmlpstats/labels{/name}","releases_url":"https://api.github.com/repos/tmlpstats/tmlpstats/releases{/id}","deployments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/deployments","created_at":"2015-02-25T08:25:46Z","updated_at":"2016-03-29T04:37:33Z","pushed_at":"2016-05-31T05:33:47Z","git_url":"git://github.com/tmlpstats/tmlpstats.git","ssh_url":"git@github.com:tmlpstats/tmlpstats.git","clone_url":"https://github.com/tmlpstats/tmlpstats.git","svn_url":"https://github.com/tmlpstats/tmlpstats","homepage":null,"size":4174,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":22,"forks":3,"open_issues":22,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448"},"html":{"href":"https://github.com/tmlpstats/tmlpstats/pull/448"},"issue":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/448"},"comments":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/448/comments"},"review_comments":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448/comments"},"review_comment":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/448/commits"},"statuses":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/statuses/b11031df3053db26e7bcfc029083401bb27b17de"}}}}
{"actor":{"display_login":"pdarg"}}