{"action":"created","comment":{"url":"https://api.github.com/repos/uuf6429/rune/pulls/comments/74021511","id":74021511,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\n+\n+namespace uuf6429\\Rune\\Action;\n+\n+abstract class AbstractConfigurableAction implements ActionInterface\n+{\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function execute($eval, $context, $rule)\n+    {\n+        $configExpr = $this->getConfigExpression();\n+        $config = is_null($configExpr) ? [] : $eval->evaluate($configExpr);\n+        $this->executeWithConfig($eval, $context, $rule, (array) $config);\n+    }\n+\n+    /**\n+     * @return array Array of [name => expression] pairs.\n+     */\n+    abstract protected function getConfigDefinition();\n+\n+    /**\n+     * Do whatever you want here.\n+     *\n+     * @param EvaluatorInterface $eval    Evaluator instance.\n+     * @param ContextInterface   $context The current context.\n+     * @param RuleInterface      $rule    The rule that triggered this action.\n+     * @param array              $config  Array of [name => value] pairs.\n+     */\n+    abstract protected function executeWithConfig($eval, $context, $rule, $config);\n+\n+    /**\n+     * Returns config expression or null if not applicable.\n+     *\n+     * @return string|null\n+     */\n+    private function getConfigExpression()\n+    {\n+        $result = [];\n+\n+        foreach ($this->getConfigDefinition() as $name => $expression) {\n+            if (trim($expression) === '') {\n+                $expression = 'null';\n+            }\n+            $result[] = sprintf(\n+                '%s: (%s)',\n+                var_export($name, true),","path":"src/Rune/Action/AbstractConfigurableAction.php","position":47,"original_position":47,"commit_id":"7a6f782f7facd1fa5177e5de660019d653e1d753","original_commit_id":"7a6f782f7facd1fa5177e5de660019d653e1d753","user":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"body":"Ensure that `$name` is scalar.","created_at":"2016-08-09T08:54:47Z","updated_at":"2016-08-09T08:54:47Z","html_url":"https://github.com/uuf6429/rune/pull/26#discussion_r74021511","pull_request_url":"https://api.github.com/repos/uuf6429/rune/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/comments/74021511"},"html":{"href":"https://github.com/uuf6429/rune/pull/26#discussion_r74021511"},"pull_request":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/uuf6429/rune/pulls/26","id":78582187,"html_url":"https://github.com/uuf6429/rune/pull/26","diff_url":"https://github.com/uuf6429/rune/pull/26.diff","patch_url":"https://github.com/uuf6429/rune/pull/26.patch","issue_url":"https://api.github.com/repos/uuf6429/rune/issues/26","number":26,"state":"open","locked":false,"title":"Added AbstractConfigurableAction class and tests, fixed #25","user":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"body":"- [x] AbstractConfigurableAction\r\n- [x] Unit test","created_at":"2016-07-23T20:47:35Z","updated_at":"2016-08-09T08:54:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84f5b5ef3b64c6e8c5fb89fcde1703ba9636be85","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/uuf6429/rune/pulls/26/commits","review_comments_url":"https://api.github.com/repos/uuf6429/rune/pulls/26/comments","review_comment_url":"https://api.github.com/repos/uuf6429/rune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uuf6429/rune/issues/26/comments","statuses_url":"https://api.github.com/repos/uuf6429/rune/statuses/7a6f782f7facd1fa5177e5de660019d653e1d753","head":{"label":"uuf6429:#25---ConfigurableAction-abstract-class","ref":"#25---ConfigurableAction-abstract-class","sha":"7a6f782f7facd1fa5177e5de660019d653e1d753","user":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"repo":{"id":54148817,"name":"rune","full_name":"uuf6429/rune","owner":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uuf6429/rune","description":"PHP Rule Engine","fork":false,"url":"https://api.github.com/repos/uuf6429/rune","forks_url":"https://api.github.com/repos/uuf6429/rune/forks","keys_url":"https://api.github.com/repos/uuf6429/rune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uuf6429/rune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uuf6429/rune/teams","hooks_url":"https://api.github.com/repos/uuf6429/rune/hooks","issue_events_url":"https://api.github.com/repos/uuf6429/rune/issues/events{/number}","events_url":"https://api.github.com/repos/uuf6429/rune/events","assignees_url":"https://api.github.com/repos/uuf6429/rune/assignees{/user}","branches_url":"https://api.github.com/repos/uuf6429/rune/branches{/branch}","tags_url":"https://api.github.com/repos/uuf6429/rune/tags","blobs_url":"https://api.github.com/repos/uuf6429/rune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uuf6429/rune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uuf6429/rune/git/refs{/sha}","trees_url":"https://api.github.com/repos/uuf6429/rune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uuf6429/rune/statuses/{sha}","languages_url":"https://api.github.com/repos/uuf6429/rune/languages","stargazers_url":"https://api.github.com/repos/uuf6429/rune/stargazers","contributors_url":"https://api.github.com/repos/uuf6429/rune/contributors","subscribers_url":"https://api.github.com/repos/uuf6429/rune/subscribers","subscription_url":"https://api.github.com/repos/uuf6429/rune/subscription","commits_url":"https://api.github.com/repos/uuf6429/rune/commits{/sha}","git_commits_url":"https://api.github.com/repos/uuf6429/rune/git/commits{/sha}","comments_url":"https://api.github.com/repos/uuf6429/rune/comments{/number}","issue_comment_url":"https://api.github.com/repos/uuf6429/rune/issues/comments{/number}","contents_url":"https://api.github.com/repos/uuf6429/rune/contents/{+path}","compare_url":"https://api.github.com/repos/uuf6429/rune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uuf6429/rune/merges","archive_url":"https://api.github.com/repos/uuf6429/rune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uuf6429/rune/downloads","issues_url":"https://api.github.com/repos/uuf6429/rune/issues{/number}","pulls_url":"https://api.github.com/repos/uuf6429/rune/pulls{/number}","milestones_url":"https://api.github.com/repos/uuf6429/rune/milestones{/number}","notifications_url":"https://api.github.com/repos/uuf6429/rune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uuf6429/rune/labels{/name}","releases_url":"https://api.github.com/repos/uuf6429/rune/releases{/id}","deployments_url":"https://api.github.com/repos/uuf6429/rune/deployments","created_at":"2016-03-17T20:21:00Z","updated_at":"2016-07-12T17:00:01Z","pushed_at":"2016-08-08T19:43:02Z","git_url":"git://github.com/uuf6429/rune.git","ssh_url":"git@github.com:uuf6429/rune.git","clone_url":"https://github.com/uuf6429/rune.git","svn_url":"https://github.com/uuf6429/rune","homepage":null,"size":159,"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":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"uuf6429:master","ref":"master","sha":"3b471f6f2566f018af37d9a2c62a6fc734cef5ae","user":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"repo":{"id":54148817,"name":"rune","full_name":"uuf6429/rune","owner":{"login":"uuf6429","id":230049,"avatar_url":"https://avatars.githubusercontent.com/u/230049?v=3","gravatar_id":"","url":"https://api.github.com/users/uuf6429","html_url":"https://github.com/uuf6429","followers_url":"https://api.github.com/users/uuf6429/followers","following_url":"https://api.github.com/users/uuf6429/following{/other_user}","gists_url":"https://api.github.com/users/uuf6429/gists{/gist_id}","starred_url":"https://api.github.com/users/uuf6429/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uuf6429/subscriptions","organizations_url":"https://api.github.com/users/uuf6429/orgs","repos_url":"https://api.github.com/users/uuf6429/repos","events_url":"https://api.github.com/users/uuf6429/events{/privacy}","received_events_url":"https://api.github.com/users/uuf6429/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uuf6429/rune","description":"PHP Rule Engine","fork":false,"url":"https://api.github.com/repos/uuf6429/rune","forks_url":"https://api.github.com/repos/uuf6429/rune/forks","keys_url":"https://api.github.com/repos/uuf6429/rune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uuf6429/rune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uuf6429/rune/teams","hooks_url":"https://api.github.com/repos/uuf6429/rune/hooks","issue_events_url":"https://api.github.com/repos/uuf6429/rune/issues/events{/number}","events_url":"https://api.github.com/repos/uuf6429/rune/events","assignees_url":"https://api.github.com/repos/uuf6429/rune/assignees{/user}","branches_url":"https://api.github.com/repos/uuf6429/rune/branches{/branch}","tags_url":"https://api.github.com/repos/uuf6429/rune/tags","blobs_url":"https://api.github.com/repos/uuf6429/rune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uuf6429/rune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uuf6429/rune/git/refs{/sha}","trees_url":"https://api.github.com/repos/uuf6429/rune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uuf6429/rune/statuses/{sha}","languages_url":"https://api.github.com/repos/uuf6429/rune/languages","stargazers_url":"https://api.github.com/repos/uuf6429/rune/stargazers","contributors_url":"https://api.github.com/repos/uuf6429/rune/contributors","subscribers_url":"https://api.github.com/repos/uuf6429/rune/subscribers","subscription_url":"https://api.github.com/repos/uuf6429/rune/subscription","commits_url":"https://api.github.com/repos/uuf6429/rune/commits{/sha}","git_commits_url":"https://api.github.com/repos/uuf6429/rune/git/commits{/sha}","comments_url":"https://api.github.com/repos/uuf6429/rune/comments{/number}","issue_comment_url":"https://api.github.com/repos/uuf6429/rune/issues/comments{/number}","contents_url":"https://api.github.com/repos/uuf6429/rune/contents/{+path}","compare_url":"https://api.github.com/repos/uuf6429/rune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uuf6429/rune/merges","archive_url":"https://api.github.com/repos/uuf6429/rune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uuf6429/rune/downloads","issues_url":"https://api.github.com/repos/uuf6429/rune/issues{/number}","pulls_url":"https://api.github.com/repos/uuf6429/rune/pulls{/number}","milestones_url":"https://api.github.com/repos/uuf6429/rune/milestones{/number}","notifications_url":"https://api.github.com/repos/uuf6429/rune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uuf6429/rune/labels{/name}","releases_url":"https://api.github.com/repos/uuf6429/rune/releases{/id}","deployments_url":"https://api.github.com/repos/uuf6429/rune/deployments","created_at":"2016-03-17T20:21:00Z","updated_at":"2016-07-12T17:00:01Z","pushed_at":"2016-08-08T19:43:02Z","git_url":"git://github.com/uuf6429/rune.git","ssh_url":"git@github.com:uuf6429/rune.git","clone_url":"https://github.com/uuf6429/rune.git","svn_url":"https://github.com/uuf6429/rune","homepage":null,"size":159,"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":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/26"},"html":{"href":"https://github.com/uuf6429/rune/pull/26"},"issue":{"href":"https://api.github.com/repos/uuf6429/rune/issues/26"},"comments":{"href":"https://api.github.com/repos/uuf6429/rune/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uuf6429/rune/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/uuf6429/rune/statuses/7a6f782f7facd1fa5177e5de660019d653e1d753"}}}}
{"actor":{"display_login":"uuf6429"}}