{"action":"created","comment":{"url":"https://api.github.com/repos/knpuniversity/oo/pulls/comments/40768936","id":40768936,"diff_hunk":"@@ -0,0 +1,228 @@\n+<?php\n+\n+namespace Challenges\\AbstractShip;\n+\n+use KnpU\\ActivityRunner\\Activity\\CodingChallenge\\CodingContext;\n+use KnpU\\ActivityRunner\\Activity\\CodingChallenge\\CorrectAnswer;\n+use KnpU\\ActivityRunner\\Activity\\CodingChallengeInterface;\n+use KnpU\\ActivityRunner\\Activity\\CodingChallenge\\CodingExecutionResult;\n+use KnpU\\ActivityRunner\\Activity\\CodingChallenge\\FileBuilder;\n+use KnpU\\ActivityRunner\\Activity\\Exception\\GradingException;\n+\n+class ExtendAbstractClassCoding implements CodingChallengeInterface\n+{\n+    /**\n+     * @return string\n+     */\n+    public function getQuestion()\n+    {\n+        return <<<EOF\n+We've just gotten word that the Rebels have *also*\n+destroyed the `DeathStarII`. Wow, rotten luck. Anyways,\n+it sounds like we'll be creating blue prints for many\n+different types of DeathStar's in the future, to keep\n+the Rebels guessing.\n+\n+To make this easier, create an `AbstractDeathStar` class,\n+move all of the shared code into it, and update\n+`DeathStar` and `DeathStarII` to extend this new class.\n+Make sure to get rid of anything in those classes\n+that you've moved into the new parent class.\n+EOF;\n+    }\n+\n+    public function getFileBuilder()\n+    {\n+        $fileBuilder = new FileBuilder();\n+        $fileBuilder\n+            ->addFileContents('AbstractDeathStar.php', <<<EOF\n+EOF\n+            )\n+            ->addFileContents('DeathStar.php', <<<EOF\n+<?php\n+\n+class DeathStar\n+{\n+    private \\$crewSize;\n+\n+    private \\$weaponPower;\n+\n+    public function setCrewSize(\\$numberOfPeople)\n+    {\n+        \\$this->crewSize = \\$numberOfPeople;\n+    }\n+\n+    public function getCrewSize()\n+    {\n+        return \\$this->crewSize;\n+    }\n+\n+    public function setWeaponPower(\\$power)\n+    {\n+        \\$this->weaponPower = \\$power;\n+    }\n+\n+    public function getWeaponPower()\n+    {\n+        return \\$this->weaponPower;\n+    }\n+\n+    public function makeFiringNoise()\n+    {\n+        echo 'BOOM x '.\\$this->weaponPower;\n+    }\n+}\n+EOF\n+            )\n+            ->addFileContents('DeathStarII.php', <<<EOF\n+<?php\n+\n+class DeathStarII extends DeathStar\n+{\n+    // this DeathStar must *always* have 5000 people on it\n+    public function getCrewSize()\n+    {\n+        return 5000;\n+    }\n+\n+    public function makeFiringNoise()\n+    {\n+        echo 'SUPER BOOM';\n+    }\n+}\n+EOF\n+            )\n+            ->addFileContents('index.php', <<<EOF\n+<?php\n+\n+require 'AbstractDeathStar.php';\n+require 'DeathStar.php';\n+require 'DeathStarII.php';\n+\n+\\$deathStar1 = new DeathStar();\n+\\$deathStar1->setCrewSize(3000);\n+\\$deathStar1->setWeaponPower(500);\n+\n+\\$deathStar2 = new DeathStarII();\n+\\$deathStar2->setWeaponPower(999);\n+\n+?>\n+\n+<table>\n+    <tr>\n+        <td>&nbsp;</td>\n+        <th>DeathStar 1</th>\n+        <th>DeathStar 2</th>\n+    </tr>\n+    <tr>\n+        <th>Crew Size</th>\n+        <td><?php echo \\$deathStar1->getCrewSize(); ?></td>\n+        <td><?php echo \\$deathStar2->getCrewSize(); ?></td>\n+    </tr>\n+    <tr>\n+        <th>Weapon Power</th>\n+        <td><?php echo \\$deathStar1->getWeaponPower(); ?></td>\n+        <td><?php echo \\$deathStar2->getWeaponPower(); ?></td>\n+    </tr>\n+    <tr>\n+        <th>Fire!</th>\n+        <td><?php echo \\$deathStar1->makeFiringNoise(); ?></td>\n+        <td><?php echo \\$deathStar2->makeFiringNoise(); ?></td>\n+    </tr>\n+</table>\n+EOF\n+            )\n+            ->setEntryPointFilename('index.php')\n+        ;\n+\n+        return $fileBuilder;\n+    }\n+\n+    public function getExecutionMode()\n+    {\n+        return self::EXECUTION_MODE_PHP_NORMAL;\n+    }\n+\n+    public function setupContext(CodingContext $context)\n+    {\n+    }\n+\n+    public function grade(CodingExecutionResult $result)\n+    {\n+        try {\n+            $abstractClass = new \\ReflectionClass('\\AbstractDeathStar');\n+        } catch (\\Exception $e) {\n+            throw new GradingException($e->getMessage().'. Did you create it?');\n+        }\n+        if (!$abstractClass->isAbstract()) {\n+            throw new GradingException('The `AbstractDeathStar` class should be declared as abstract.');\n+        }\n+        if (false\n+            or !$abstractClass->hasMethod('setCrewSize')\n+            or !$abstractClass->hasMethod('getCrewSize')\n+            or !$abstractClass->hasMethod('setWeaponPower')\n+            or !$abstractClass->hasMethod('getWeaponPower')\n+            or !$abstractClass->hasMethod('makeFiringNoise')\n+        ) {","path":"knpu/episode3/Challenges/AbstractShip/ExtendAbstractClassCoding.php","position":166,"original_position":166,"commit_id":"09495a6d72d1fc12a55170934915cf9abe0c5054","original_commit_id":"c6cb5028989885bad47336de6f12458dceb2ff21","user":{"login":"bocharsky-bw","id":3317635,"avatar_url":"https://avatars.githubusercontent.com/u/3317635?v=3","gravatar_id":"","url":"https://api.github.com/users/bocharsky-bw","html_url":"https://github.com/bocharsky-bw","followers_url":"https://api.github.com/users/bocharsky-bw/followers","following_url":"https://api.github.com/users/bocharsky-bw/following{/other_user}","gists_url":"https://api.github.com/users/bocharsky-bw/gists{/gist_id}","starred_url":"https://api.github.com/users/bocharsky-bw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bocharsky-bw/subscriptions","organizations_url":"https://api.github.com/users/bocharsky-bw/orgs","repos_url":"https://api.github.com/users/bocharsky-bw/repos","events_url":"https://api.github.com/users/bocharsky-bw/events{/privacy}","received_events_url":"https://api.github.com/users/bocharsky-bw/received_events","type":"User","site_admin":false},"body":"Btw, `or` has lower precedence than `||` as we can see in [docs](http://php.net/manual/en/language.operators.precedence.php), so I change it to `||`","created_at":"2015-09-30T08:23:32Z","updated_at":"2015-09-30T08:23:32Z","html_url":"https://github.com/knpuniversity/oo/pull/8#discussion_r40768936","pull_request_url":"https://api.github.com/repos/knpuniversity/oo/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/comments/40768936"},"html":{"href":"https://github.com/knpuniversity/oo/pull/8#discussion_r40768936"},"pull_request":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/knpuniversity/oo/pulls/8","id":46325600,"html_url":"https://github.com/knpuniversity/oo/pull/8","diff_url":"https://github.com/knpuniversity/oo/pull/8.diff","patch_url":"https://github.com/knpuniversity/oo/pull/8.patch","issue_url":"https://api.github.com/repos/knpuniversity/oo/issues/8","number":8,"state":"open","locked":false,"title":"Add code activities for abstract-ship ch5 of ep3","user":{"login":"bocharsky-bw","id":3317635,"avatar_url":"https://avatars.githubusercontent.com/u/3317635?v=3","gravatar_id":"","url":"https://api.github.com/users/bocharsky-bw","html_url":"https://github.com/bocharsky-bw","followers_url":"https://api.github.com/users/bocharsky-bw/followers","following_url":"https://api.github.com/users/bocharsky-bw/following{/other_user}","gists_url":"https://api.github.com/users/bocharsky-bw/gists{/gist_id}","starred_url":"https://api.github.com/users/bocharsky-bw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bocharsky-bw/subscriptions","organizations_url":"https://api.github.com/users/bocharsky-bw/orgs","repos_url":"https://api.github.com/users/bocharsky-bw/repos","events_url":"https://api.github.com/users/bocharsky-bw/events{/privacy}","received_events_url":"https://api.github.com/users/bocharsky-bw/received_events","type":"User","site_admin":false},"body":"Resolve `05-abstract-ship` in #1 ","created_at":"2015-09-29T20:10:58Z","updated_at":"2015-09-30T08:23:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d77ea3c639b72c5e7f1805e62e33323eca671d61","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/knpuniversity/oo/pulls/8/commits","review_comments_url":"https://api.github.com/repos/knpuniversity/oo/pulls/8/comments","review_comment_url":"https://api.github.com/repos/knpuniversity/oo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/knpuniversity/oo/issues/8/comments","statuses_url":"https://api.github.com/repos/knpuniversity/oo/statuses/09495a6d72d1fc12a55170934915cf9abe0c5054","head":{"label":"knpuniversity:code-activities-ep3-ch5","ref":"code-activities-ep3-ch5","sha":"09495a6d72d1fc12a55170934915cf9abe0c5054","user":{"login":"knpuniversity","id":4474785,"avatar_url":"https://avatars.githubusercontent.com/u/4474785?v=3","gravatar_id":"","url":"https://api.github.com/users/knpuniversity","html_url":"https://github.com/knpuniversity","followers_url":"https://api.github.com/users/knpuniversity/followers","following_url":"https://api.github.com/users/knpuniversity/following{/other_user}","gists_url":"https://api.github.com/users/knpuniversity/gists{/gist_id}","starred_url":"https://api.github.com/users/knpuniversity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knpuniversity/subscriptions","organizations_url":"https://api.github.com/users/knpuniversity/orgs","repos_url":"https://api.github.com/users/knpuniversity/repos","events_url":"https://api.github.com/users/knpuniversity/events{/privacy}","received_events_url":"https://api.github.com/users/knpuniversity/received_events","type":"Organization","site_admin":false},"repo":{"id":28870708,"name":"oo","full_name":"knpuniversity/oo","owner":{"login":"knpuniversity","id":4474785,"avatar_url":"https://avatars.githubusercontent.com/u/4474785?v=3","gravatar_id":"","url":"https://api.github.com/users/knpuniversity","html_url":"https://github.com/knpuniversity","followers_url":"https://api.github.com/users/knpuniversity/followers","following_url":"https://api.github.com/users/knpuniversity/following{/other_user}","gists_url":"https://api.github.com/users/knpuniversity/gists{/gist_id}","starred_url":"https://api.github.com/users/knpuniversity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knpuniversity/subscriptions","organizations_url":"https://api.github.com/users/knpuniversity/orgs","repos_url":"https://api.github.com/users/knpuniversity/repos","events_url":"https://api.github.com/users/knpuniversity/events{/privacy}","received_events_url":"https://api.github.com/users/knpuniversity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/knpuniversity/oo","description":"Screencast code, script and spare parts for classes (e.g. extra interfaces, refurbished class constants, etc) for the intro OO course","fork":false,"url":"https://api.github.com/repos/knpuniversity/oo","forks_url":"https://api.github.com/repos/knpuniversity/oo/forks","keys_url":"https://api.github.com/repos/knpuniversity/oo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knpuniversity/oo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knpuniversity/oo/teams","hooks_url":"https://api.github.com/repos/knpuniversity/oo/hooks","issue_events_url":"https://api.github.com/repos/knpuniversity/oo/issues/events{/number}","events_url":"https://api.github.com/repos/knpuniversity/oo/events","assignees_url":"https://api.github.com/repos/knpuniversity/oo/assignees{/user}","branches_url":"https://api.github.com/repos/knpuniversity/oo/branches{/branch}","tags_url":"https://api.github.com/repos/knpuniversity/oo/tags","blobs_url":"https://api.github.com/repos/knpuniversity/oo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knpuniversity/oo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knpuniversity/oo/git/refs{/sha}","trees_url":"https://api.github.com/repos/knpuniversity/oo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knpuniversity/oo/statuses/{sha}","languages_url":"https://api.github.com/repos/knpuniversity/oo/languages","stargazers_url":"https://api.github.com/repos/knpuniversity/oo/stargazers","contributors_url":"https://api.github.com/repos/knpuniversity/oo/contributors","subscribers_url":"https://api.github.com/repos/knpuniversity/oo/subscribers","subscription_url":"https://api.github.com/repos/knpuniversity/oo/subscription","commits_url":"https://api.github.com/repos/knpuniversity/oo/commits{/sha}","git_commits_url":"https://api.github.com/repos/knpuniversity/oo/git/commits{/sha}","comments_url":"https://api.github.com/repos/knpuniversity/oo/comments{/number}","issue_comment_url":"https://api.github.com/repos/knpuniversity/oo/issues/comments{/number}","contents_url":"https://api.github.com/repos/knpuniversity/oo/contents/{+path}","compare_url":"https://api.github.com/repos/knpuniversity/oo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knpuniversity/oo/merges","archive_url":"https://api.github.com/repos/knpuniversity/oo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knpuniversity/oo/downloads","issues_url":"https://api.github.com/repos/knpuniversity/oo/issues{/number}","pulls_url":"https://api.github.com/repos/knpuniversity/oo/pulls{/number}","milestones_url":"https://api.github.com/repos/knpuniversity/oo/milestones{/number}","notifications_url":"https://api.github.com/repos/knpuniversity/oo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knpuniversity/oo/labels{/name}","releases_url":"https://api.github.com/repos/knpuniversity/oo/releases{/id}","created_at":"2015-01-06T15:58:52Z","updated_at":"2015-07-15T12:21:17Z","pushed_at":"2015-09-30T08:14:24Z","git_url":"git://github.com/knpuniversity/oo.git","ssh_url":"git@github.com:knpuniversity/oo.git","clone_url":"https://github.com/knpuniversity/oo.git","svn_url":"https://github.com/knpuniversity/oo","homepage":"https://knpuniversity.com/screencast/oo","size":1660,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"knpuniversity:master","ref":"master","sha":"b433e0673f84aa6ed3ad4d837d17fca8d0b49202","user":{"login":"knpuniversity","id":4474785,"avatar_url":"https://avatars.githubusercontent.com/u/4474785?v=3","gravatar_id":"","url":"https://api.github.com/users/knpuniversity","html_url":"https://github.com/knpuniversity","followers_url":"https://api.github.com/users/knpuniversity/followers","following_url":"https://api.github.com/users/knpuniversity/following{/other_user}","gists_url":"https://api.github.com/users/knpuniversity/gists{/gist_id}","starred_url":"https://api.github.com/users/knpuniversity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knpuniversity/subscriptions","organizations_url":"https://api.github.com/users/knpuniversity/orgs","repos_url":"https://api.github.com/users/knpuniversity/repos","events_url":"https://api.github.com/users/knpuniversity/events{/privacy}","received_events_url":"https://api.github.com/users/knpuniversity/received_events","type":"Organization","site_admin":false},"repo":{"id":28870708,"name":"oo","full_name":"knpuniversity/oo","owner":{"login":"knpuniversity","id":4474785,"avatar_url":"https://avatars.githubusercontent.com/u/4474785?v=3","gravatar_id":"","url":"https://api.github.com/users/knpuniversity","html_url":"https://github.com/knpuniversity","followers_url":"https://api.github.com/users/knpuniversity/followers","following_url":"https://api.github.com/users/knpuniversity/following{/other_user}","gists_url":"https://api.github.com/users/knpuniversity/gists{/gist_id}","starred_url":"https://api.github.com/users/knpuniversity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knpuniversity/subscriptions","organizations_url":"https://api.github.com/users/knpuniversity/orgs","repos_url":"https://api.github.com/users/knpuniversity/repos","events_url":"https://api.github.com/users/knpuniversity/events{/privacy}","received_events_url":"https://api.github.com/users/knpuniversity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/knpuniversity/oo","description":"Screencast code, script and spare parts for classes (e.g. extra interfaces, refurbished class constants, etc) for the intro OO course","fork":false,"url":"https://api.github.com/repos/knpuniversity/oo","forks_url":"https://api.github.com/repos/knpuniversity/oo/forks","keys_url":"https://api.github.com/repos/knpuniversity/oo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knpuniversity/oo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knpuniversity/oo/teams","hooks_url":"https://api.github.com/repos/knpuniversity/oo/hooks","issue_events_url":"https://api.github.com/repos/knpuniversity/oo/issues/events{/number}","events_url":"https://api.github.com/repos/knpuniversity/oo/events","assignees_url":"https://api.github.com/repos/knpuniversity/oo/assignees{/user}","branches_url":"https://api.github.com/repos/knpuniversity/oo/branches{/branch}","tags_url":"https://api.github.com/repos/knpuniversity/oo/tags","blobs_url":"https://api.github.com/repos/knpuniversity/oo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knpuniversity/oo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knpuniversity/oo/git/refs{/sha}","trees_url":"https://api.github.com/repos/knpuniversity/oo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knpuniversity/oo/statuses/{sha}","languages_url":"https://api.github.com/repos/knpuniversity/oo/languages","stargazers_url":"https://api.github.com/repos/knpuniversity/oo/stargazers","contributors_url":"https://api.github.com/repos/knpuniversity/oo/contributors","subscribers_url":"https://api.github.com/repos/knpuniversity/oo/subscribers","subscription_url":"https://api.github.com/repos/knpuniversity/oo/subscription","commits_url":"https://api.github.com/repos/knpuniversity/oo/commits{/sha}","git_commits_url":"https://api.github.com/repos/knpuniversity/oo/git/commits{/sha}","comments_url":"https://api.github.com/repos/knpuniversity/oo/comments{/number}","issue_comment_url":"https://api.github.com/repos/knpuniversity/oo/issues/comments{/number}","contents_url":"https://api.github.com/repos/knpuniversity/oo/contents/{+path}","compare_url":"https://api.github.com/repos/knpuniversity/oo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knpuniversity/oo/merges","archive_url":"https://api.github.com/repos/knpuniversity/oo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knpuniversity/oo/downloads","issues_url":"https://api.github.com/repos/knpuniversity/oo/issues{/number}","pulls_url":"https://api.github.com/repos/knpuniversity/oo/pulls{/number}","milestones_url":"https://api.github.com/repos/knpuniversity/oo/milestones{/number}","notifications_url":"https://api.github.com/repos/knpuniversity/oo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knpuniversity/oo/labels{/name}","releases_url":"https://api.github.com/repos/knpuniversity/oo/releases{/id}","created_at":"2015-01-06T15:58:52Z","updated_at":"2015-07-15T12:21:17Z","pushed_at":"2015-09-30T08:14:24Z","git_url":"git://github.com/knpuniversity/oo.git","ssh_url":"git@github.com:knpuniversity/oo.git","clone_url":"https://github.com/knpuniversity/oo.git","svn_url":"https://github.com/knpuniversity/oo","homepage":"https://knpuniversity.com/screencast/oo","size":1660,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/8"},"html":{"href":"https://github.com/knpuniversity/oo/pull/8"},"issue":{"href":"https://api.github.com/repos/knpuniversity/oo/issues/8"},"comments":{"href":"https://api.github.com/repos/knpuniversity/oo/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/knpuniversity/oo/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/knpuniversity/oo/statuses/09495a6d72d1fc12a55170934915cf9abe0c5054"}}}}