{"action":"created","comment":{"url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments/65012360","id":65012360,"diff_hunk":"@@ -0,0 +1,174 @@\n+<?php\n+namespace TmlpStats\\Domain;\n+\n+use Illuminate\\Contracts\\Support\\Arrayable;\n+use TmlpStats as Models;\n+\n+/**\n+ * Models a team application\n+ */\n+class TeamApplication extends ParserDomain implements Arrayable, \\JsonSerializable\n+{\n+    protected static $validProperties = [\n+        'firstName' => [\n+            'owner' => 'person',\n+            'type' => 'string',\n+        ],\n+        'lastName' => [\n+            'owner' => 'person',\n+            'type' => 'string',\n+        ],\n+        'phone' => [\n+            'owner' => 'person',\n+            'type' => 'string',\n+        ],\n+        'email' => [\n+            'owner' => 'person',\n+            'type' => 'string',\n+        ],\n+        'center' => [\n+            'owner' => 'person',\n+            'type' => 'Center',\n+        ],\n+        'unsubscribed' => [\n+            'owner' => 'person',\n+            'type' => 'bool',\n+        ],\n+        'teamYear' => [\n+            'owner' => 'application',\n+            'type' => 'int',\n+        ],\n+        'regDate' => [\n+            'owner' => 'application',\n+            'type' => 'date',\n+        ],\n+        'isReviewer' => [\n+            'owner' => 'application',\n+            'type' => 'bool',\n+        ],\n+        'tmlpRegistrationId' => [\n+            'owner' => 'applicationData',\n+            'type' => 'int',\n+        ],\n+        'appOutDate' => [\n+            'owner' => 'applicationData',\n+            'type' => 'date',\n+        ],\n+        'appInDate' => [\n+            'owner' => 'applicationData',\n+            'type' => 'date',\n+        ],\n+        'apprDate' => [\n+            'owner' => 'applicationData',\n+            'type' => 'date',\n+        ],\n+        'wdDate' => [\n+            'owner' => 'applicationData',\n+            'type' => 'date',\n+        ],\n+        'withdrawCode' => [\n+            'owner' => 'applicationData',\n+            'type' => 'WithdrawCode',\n+        ],\n+        'committedTeamMember' => [\n+            'owner' => 'applicationData',\n+            'type' => 'TeamMember',\n+        ],\n+        'incomingQuarter' => [\n+            'owner' => 'applicationData',\n+            'type' => 'Quarter',\n+        ],\n+        'comment' => [\n+            'owner' => 'applicationData',\n+            'type' => 'string',\n+        ],\n+        'travel' => [\n+            'owner' => 'applicationData',\n+            'type' => 'bool',\n+        ],\n+        'room' => [\n+            'owner' => 'applicationData',\n+            'type' => 'bool',\n+        ],\n+    ];\n+\n+    public function __construct()\n+    {\n+        // do nothing!\n+    }\n+\n+    public function toArray()\n+    {\n+        $vprops = static::$validProperties;\n+        foreach ($this->values as $k => $v) {\n+            if ($v !== null) {\n+                if ($vprops[$k]['type'] == 'date') {\n+                    $v = $v->toDateString();\n+                }\n+            }\n+            $a[$k] = $v;\n+        }\n+\n+        return $a;\n+    }\n+\n+    public function jsonSerialize()\n+    {\n+        return $this->toArray();\n+    }\n+\n+    public static function fromModel($appData, $application = null, $person = null)\n+    {\n+        if ($application === null) {\n+            $application = $appData->registration;\n+        }\n+        if ($person === null) {\n+            $person = $application->person;\n+        }\n+\n+        $obj = new static();\n+        foreach (static::$validProperties as $k => $v) {\n+            switch ($v['owner']) {\n+                case 'person':\n+                    $obj->$k = $person->$k;\n+                    break;\n+                case 'application':\n+                    $obj->$k = $application->$k;\n+                    break;\n+                case 'applicationData':\n+                    $obj->$k = $appData->$k;\n+            }\n+        }\n+        $obj->tmlpRegistrationId = $application->id;\n+\n+        return $obj;\n+    }\n+\n+    public function fillModel($appData, $application = null, $only_set = true)\n+    {\n+        if ($application === null) {\n+            $application = $appData->registration;\n+        }\n+\n+        foreach ($this->values as $k => $v) {\n+            if ($only_set && (!isset($this->setValues[$k]) || !$this->setValues[$k])) {\n+                continue;\n+            }\n+            switch (self::$validProperties[$k]['owner']) {\n+                case 'person':\n+                    $target = $application->person;\n+                    break;\n+                case 'application':\n+                    $target = $application;\n+                    break;\n+                case 'applicationData':\n+                    $target = $appData;\n+                    break;","path":"src/app/Domain/TeamApplication.php","position":166,"original_position":166,"commit_id":"bb72e6b13f588a1fb7bbfaf8f64c54b75c1fd8d1","original_commit_id":"bb72e6b13f588a1fb7bbfaf8f64c54b75c1fd8d1","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":"default: continue?","created_at":"2016-05-29T22:03:05Z","updated_at":"2016-05-29T22:03:05Z","html_url":"https://github.com/tmlpstats/tmlpstats/pull/441#discussion_r65012360","pull_request_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441","_links":{"self":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments/65012360"},"html":{"href":"https://github.com/tmlpstats/tmlpstats/pull/441#discussion_r65012360"},"pull_request":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441"}}},"pull_request":{"url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441","id":71814744,"html_url":"https://github.com/tmlpstats/tmlpstats/pull/441","diff_url":"https://github.com/tmlpstats/tmlpstats/pull/441.diff","patch_url":"https://github.com/tmlpstats/tmlpstats/pull/441.patch","issue_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/441","number":441,"state":"open","locked":false,"title":"Add domain object for proxying Applications as a single domain.","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":"This has a couple of reasons:\r\n\r\n* Security, not exposing properties on e.g. person which don't need it\r\n* Simplifying JS and app level code\r\n* Removing parsing boilerplate from the API","created_at":"2016-05-29T00:09:02Z","updated_at":"2016-05-29T22:03:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55f43961d19cf2b3f54a5c21a00340fc27310a81","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441/commits","review_comments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441/comments","review_comment_url":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/441/comments","statuses_url":"https://api.github.com/repos/tmlpstats/tmlpstats/statuses/bb72e6b13f588a1fb7bbfaf8f64c54b75c1fd8d1","head":{"label":"crast:applications-api-roundtrip","ref":"applications-api-roundtrip","sha":"bb72e6b13f588a1fb7bbfaf8f64c54b75c1fd8d1","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-29T21:10:21Z","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":3997,"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":"90aea97bcda3989a34a2b3091e50f350640fbe89","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-29T21:10:22Z","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":4072,"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/441"},"html":{"href":"https://github.com/tmlpstats/tmlpstats/pull/441"},"issue":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/441"},"comments":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/issues/441/comments"},"review_comments":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441/comments"},"review_comment":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/pulls/441/commits"},"statuses":{"href":"https://api.github.com/repos/tmlpstats/tmlpstats/statuses/bb72e6b13f588a1fb7bbfaf8f64c54b75c1fd8d1"}}}}
{"actor":{"display_login":"pdarg"}}