{"action":"created","comment":{"url":"https://api.github.com/repos/starweb/starlit-app/pulls/comments/208852585","pull_request_review_id":144746120,"id":208852585,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODg1MjU4NQ==","diff_hunk":"@@ -60,6 +63,38 @@ public function testAddClearRoute()\n         $this->assertCount(0, $this->router->getRoutes());\n     }\n \n+    public function testAddRouteWithName()\n+    {\n+        $route = new Route('/foo/bar', [], ['controller' => '[a-z-]+', 'action' => '[a-z-]+']);\n+\n+        $this->assertCount(3, $this->router->getRoutes());","path":"tests/RouterTest.php","position":20,"original_position":20,"commit_id":"526c4743d0bd6e4db7d6b873ce18ec284aa0c2f9","original_commit_id":"526c4743d0bd6e4db7d6b873ce18ec284aa0c2f9","user":{"login":"felixsand","id":9284362,"node_id":"MDQ6VXNlcjkyODQzNjI=","avatar_url":"https://avatars1.githubusercontent.com/u/9284362?v=4","gravatar_id":"","url":"https://api.github.com/users/felixsand","html_url":"https://github.com/felixsand","followers_url":"https://api.github.com/users/felixsand/followers","following_url":"https://api.github.com/users/felixsand/following{/other_user}","gists_url":"https://api.github.com/users/felixsand/gists{/gist_id}","starred_url":"https://api.github.com/users/felixsand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixsand/subscriptions","organizations_url":"https://api.github.com/users/felixsand/orgs","repos_url":"https://api.github.com/users/felixsand/repos","events_url":"https://api.github.com/users/felixsand/events{/privacy}","received_events_url":"https://api.github.com/users/felixsand/received_events","type":"User","site_admin":false},"body":"This test can be easily broken by changes in other parts of this test. What do you think about the following approach instead:\r\n```\r\n$numberOfRoutes = count($this->router->getRoutes());\r\n$this->router->addRoute($route, 'foo-bar');\r\n$numberOfRoutes++;\r\n$this->assertCount($numberOfRoutes, ($routes = $this->router->getRoutes()));\r\n```\r\n\r\n(same for `testAddRouteWithHttpMethods()`)","created_at":"2018-08-09T08:52:03Z","updated_at":"2018-08-09T08:55:41Z","html_url":"https://github.com/starweb/starlit-app/pull/1#discussion_r208852585","pull_request_url":"https://api.github.com/repos/starweb/starlit-app/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/comments/208852585"},"html":{"href":"https://github.com/starweb/starlit-app/pull/1#discussion_r208852585"},"pull_request":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/starweb/starlit-app/pulls/1","id":202790207,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyNzkwMjA3","html_url":"https://github.com/starweb/starlit-app/pull/1","diff_url":"https://github.com/starweb/starlit-app/pull/1.diff","patch_url":"https://github.com/starweb/starlit-app/pull/1.patch","issue_url":"https://api.github.com/repos/starweb/starlit-app/issues/1","number":1,"state":"open","locked":false,"title":"adds support for route names and http methods in the array for routes","user":{"login":"lordrhodos","id":807902,"node_id":"MDQ6VXNlcjgwNzkwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/807902?v=4","gravatar_id":"","url":"https://api.github.com/users/lordrhodos","html_url":"https://github.com/lordrhodos","followers_url":"https://api.github.com/users/lordrhodos/followers","following_url":"https://api.github.com/users/lordrhodos/following{/other_user}","gists_url":"https://api.github.com/users/lordrhodos/gists{/gist_id}","starred_url":"https://api.github.com/users/lordrhodos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lordrhodos/subscriptions","organizations_url":"https://api.github.com/users/lordrhodos/orgs","repos_url":"https://api.github.com/users/lordrhodos/repos","events_url":"https://api.github.com/users/lordrhodos/events{/privacy}","received_events_url":"https://api.github.com/users/lordrhodos/received_events","type":"User","site_admin":false},"body":"This PR extends the routing by adding support for:\r\n\r\n* route names\r\n* HTTP methods \r\n\r\n\r\nBackground\r\n---\r\nThe Startlit routing implementation based on the `symfony/routing` component is quite limited and supports only a subset of the features provided by the component:\r\n\r\n* routing names are not supported\r\n* can not configure multiple routes for the same `path`\r\n* can not configure HTTP methods for routes\r\n\r\nA new `Route` just gets added like this:\r\n\r\n```\r\n$this->addRoute(new Route($path, $defaults, $requirements);\r\n```\r\nsupporting only `path`, `defaults` and `requirements`, but the `Route` constructor supports a lot more optional attributes which should be (fully?) supported:\r\n\r\n```\r\n/**\r\n * Constructor.\r\n *\r\n * Available options:\r\n *\r\n *  * compiler_class: A class name able to compile this route instance (RouteCompiler by default)\r\n *  * utf8:           Whether UTF-8 matching is enforced ot not\r\n *\r\n * @param string          $path         The path pattern to match\r\n * @param array           $defaults     An array of default parameter values\r\n * @param array           $requirements An array of requirements for parameters (regexes)\r\n * @param array           $options      An array of options\r\n * @param string          $host         The host pattern to match\r\n * @param string|string[] $schemes      A required URI scheme or an array of restricted schemes\r\n * @param string|string[] $methods      A required HTTP method or an array of restricted methods\r\n * @param string          $condition    A condition that should evaluate to true for the route to match\r\n */\r\npublic function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '')\r\n```\r\nOn top of that Starlit does not allow route names, thus does not allow support for multiple routes using the same path (e.g. with different HTTP methods):\r\n\r\n```\r\n/**\r\n  * Add route.\r\n  *\r\n  * @param Route $route\r\n  */\r\n public function addRoute(Route $route)\r\n {\r\n     // We use path as name (sees no use for names)\r\n     $this->routes->add($route->getPath(), $route);\r\n }\r\n```\r\n","created_at":"2018-07-20T09:13:18Z","updated_at":"2018-08-09T08:55:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"481547900b500e4102d8d3b83f6b2c4602f10f88","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jandreasn","id":1712334,"node_id":"MDQ6VXNlcjE3MTIzMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1712334?v=4","gravatar_id":"","url":"https://api.github.com/users/jandreasn","html_url":"https://github.com/jandreasn","followers_url":"https://api.github.com/users/jandreasn/followers","following_url":"https://api.github.com/users/jandreasn/following{/other_user}","gists_url":"https://api.github.com/users/jandreasn/gists{/gist_id}","starred_url":"https://api.github.com/users/jandreasn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jandreasn/subscriptions","organizations_url":"https://api.github.com/users/jandreasn/orgs","repos_url":"https://api.github.com/users/jandreasn/repos","events_url":"https://api.github.com/users/jandreasn/events{/privacy}","received_events_url":"https://api.github.com/users/jandreasn/received_events","type":"User","site_admin":false},{"login":"henrikjon","id":27212232,"node_id":"MDQ6VXNlcjI3MjEyMjMy","avatar_url":"https://avatars0.githubusercontent.com/u/27212232?v=4","gravatar_id":"","url":"https://api.github.com/users/henrikjon","html_url":"https://github.com/henrikjon","followers_url":"https://api.github.com/users/henrikjon/followers","following_url":"https://api.github.com/users/henrikjon/following{/other_user}","gists_url":"https://api.github.com/users/henrikjon/gists{/gist_id}","starred_url":"https://api.github.com/users/henrikjon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrikjon/subscriptions","organizations_url":"https://api.github.com/users/henrikjon/orgs","repos_url":"https://api.github.com/users/henrikjon/repos","events_url":"https://api.github.com/users/henrikjon/events{/privacy}","received_events_url":"https://api.github.com/users/henrikjon/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1019258452,"node_id":"MDU6TGFiZWwxMDE5MjU4NDUy","url":"https://api.github.com/repos/starweb/starlit-app/labels/Status:%20Review%20Needed","name":"Status: Review Needed","color":"f9d0c4","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/starweb/starlit-app/pulls/1/commits","review_comments_url":"https://api.github.com/repos/starweb/starlit-app/pulls/1/comments","review_comment_url":"https://api.github.com/repos/starweb/starlit-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/starweb/starlit-app/issues/1/comments","statuses_url":"https://api.github.com/repos/starweb/starlit-app/statuses/526c4743d0bd6e4db7d6b873ce18ec284aa0c2f9","head":{"label":"lordrhodos:feature/extend-router-support","ref":"feature/extend-router-support","sha":"526c4743d0bd6e4db7d6b873ce18ec284aa0c2f9","user":{"login":"lordrhodos","id":807902,"node_id":"MDQ6VXNlcjgwNzkwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/807902?v=4","gravatar_id":"","url":"https://api.github.com/users/lordrhodos","html_url":"https://github.com/lordrhodos","followers_url":"https://api.github.com/users/lordrhodos/followers","following_url":"https://api.github.com/users/lordrhodos/following{/other_user}","gists_url":"https://api.github.com/users/lordrhodos/gists{/gist_id}","starred_url":"https://api.github.com/users/lordrhodos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lordrhodos/subscriptions","organizations_url":"https://api.github.com/users/lordrhodos/orgs","repos_url":"https://api.github.com/users/lordrhodos/repos","events_url":"https://api.github.com/users/lordrhodos/events{/privacy}","received_events_url":"https://api.github.com/users/lordrhodos/received_events","type":"User","site_admin":false},"repo":{"id":141688048,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2ODgwNDg=","name":"starlit-app","full_name":"lordrhodos/starlit-app","owner":{"login":"lordrhodos","id":807902,"node_id":"MDQ6VXNlcjgwNzkwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/807902?v=4","gravatar_id":"","url":"https://api.github.com/users/lordrhodos","html_url":"https://github.com/lordrhodos","followers_url":"https://api.github.com/users/lordrhodos/followers","following_url":"https://api.github.com/users/lordrhodos/following{/other_user}","gists_url":"https://api.github.com/users/lordrhodos/gists{/gist_id}","starred_url":"https://api.github.com/users/lordrhodos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lordrhodos/subscriptions","organizations_url":"https://api.github.com/users/lordrhodos/orgs","repos_url":"https://api.github.com/users/lordrhodos/repos","events_url":"https://api.github.com/users/lordrhodos/events{/privacy}","received_events_url":"https://api.github.com/users/lordrhodos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lordrhodos/starlit-app","description":"A lightweight PHP MVC style microframework.","fork":true,"url":"https://api.github.com/repos/lordrhodos/starlit-app","forks_url":"https://api.github.com/repos/lordrhodos/starlit-app/forks","keys_url":"https://api.github.com/repos/lordrhodos/starlit-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lordrhodos/starlit-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lordrhodos/starlit-app/teams","hooks_url":"https://api.github.com/repos/lordrhodos/starlit-app/hooks","issue_events_url":"https://api.github.com/repos/lordrhodos/starlit-app/issues/events{/number}","events_url":"https://api.github.com/repos/lordrhodos/starlit-app/events","assignees_url":"https://api.github.com/repos/lordrhodos/starlit-app/assignees{/user}","branches_url":"https://api.github.com/repos/lordrhodos/starlit-app/branches{/branch}","tags_url":"https://api.github.com/repos/lordrhodos/starlit-app/tags","blobs_url":"https://api.github.com/repos/lordrhodos/starlit-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lordrhodos/starlit-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lordrhodos/starlit-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/lordrhodos/starlit-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lordrhodos/starlit-app/statuses/{sha}","languages_url":"https://api.github.com/repos/lordrhodos/starlit-app/languages","stargazers_url":"https://api.github.com/repos/lordrhodos/starlit-app/stargazers","contributors_url":"https://api.github.com/repos/lordrhodos/starlit-app/contributors","subscribers_url":"https://api.github.com/repos/lordrhodos/starlit-app/subscribers","subscription_url":"https://api.github.com/repos/lordrhodos/starlit-app/subscription","commits_url":"https://api.github.com/repos/lordrhodos/starlit-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/lordrhodos/starlit-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/lordrhodos/starlit-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/lordrhodos/starlit-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/lordrhodos/starlit-app/contents/{+path}","compare_url":"https://api.github.com/repos/lordrhodos/starlit-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lordrhodos/starlit-app/merges","archive_url":"https://api.github.com/repos/lordrhodos/starlit-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lordrhodos/starlit-app/downloads","issues_url":"https://api.github.com/repos/lordrhodos/starlit-app/issues{/number}","pulls_url":"https://api.github.com/repos/lordrhodos/starlit-app/pulls{/number}","milestones_url":"https://api.github.com/repos/lordrhodos/starlit-app/milestones{/number}","notifications_url":"https://api.github.com/repos/lordrhodos/starlit-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lordrhodos/starlit-app/labels{/name}","releases_url":"https://api.github.com/repos/lordrhodos/starlit-app/releases{/id}","deployments_url":"https://api.github.com/repos/lordrhodos/starlit-app/deployments","created_at":"2018-07-20T08:51:28Z","updated_at":"2018-07-20T08:51:30Z","pushed_at":"2018-08-09T07:50:24Z","git_url":"git://github.com/lordrhodos/starlit-app.git","ssh_url":"git@github.com:lordrhodos/starlit-app.git","clone_url":"https://github.com/lordrhodos/starlit-app.git","svn_url":"https://github.com/lordrhodos/starlit-app","homepage":"","size":37,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"starweb:master","ref":"master","sha":"a1324c83bdfe3f6e5074b81e4630c0ebfb92365c","user":{"login":"starweb","id":1343870,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDM4NzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1343870?v=4","gravatar_id":"","url":"https://api.github.com/users/starweb","html_url":"https://github.com/starweb","followers_url":"https://api.github.com/users/starweb/followers","following_url":"https://api.github.com/users/starweb/following{/other_user}","gists_url":"https://api.github.com/users/starweb/gists{/gist_id}","starred_url":"https://api.github.com/users/starweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starweb/subscriptions","organizations_url":"https://api.github.com/users/starweb/orgs","repos_url":"https://api.github.com/users/starweb/repos","events_url":"https://api.github.com/users/starweb/events{/privacy}","received_events_url":"https://api.github.com/users/starweb/received_events","type":"Organization","site_admin":false},"repo":{"id":48774299,"node_id":"MDEwOlJlcG9zaXRvcnk0ODc3NDI5OQ==","name":"starlit-app","full_name":"starweb/starlit-app","owner":{"login":"starweb","id":1343870,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDM4NzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1343870?v=4","gravatar_id":"","url":"https://api.github.com/users/starweb","html_url":"https://github.com/starweb","followers_url":"https://api.github.com/users/starweb/followers","following_url":"https://api.github.com/users/starweb/following{/other_user}","gists_url":"https://api.github.com/users/starweb/gists{/gist_id}","starred_url":"https://api.github.com/users/starweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starweb/subscriptions","organizations_url":"https://api.github.com/users/starweb/orgs","repos_url":"https://api.github.com/users/starweb/repos","events_url":"https://api.github.com/users/starweb/events{/privacy}","received_events_url":"https://api.github.com/users/starweb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/starweb/starlit-app","description":"A lightweight PHP MVC style microframework.","fork":false,"url":"https://api.github.com/repos/starweb/starlit-app","forks_url":"https://api.github.com/repos/starweb/starlit-app/forks","keys_url":"https://api.github.com/repos/starweb/starlit-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starweb/starlit-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starweb/starlit-app/teams","hooks_url":"https://api.github.com/repos/starweb/starlit-app/hooks","issue_events_url":"https://api.github.com/repos/starweb/starlit-app/issues/events{/number}","events_url":"https://api.github.com/repos/starweb/starlit-app/events","assignees_url":"https://api.github.com/repos/starweb/starlit-app/assignees{/user}","branches_url":"https://api.github.com/repos/starweb/starlit-app/branches{/branch}","tags_url":"https://api.github.com/repos/starweb/starlit-app/tags","blobs_url":"https://api.github.com/repos/starweb/starlit-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starweb/starlit-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starweb/starlit-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/starweb/starlit-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starweb/starlit-app/statuses/{sha}","languages_url":"https://api.github.com/repos/starweb/starlit-app/languages","stargazers_url":"https://api.github.com/repos/starweb/starlit-app/stargazers","contributors_url":"https://api.github.com/repos/starweb/starlit-app/contributors","subscribers_url":"https://api.github.com/repos/starweb/starlit-app/subscribers","subscription_url":"https://api.github.com/repos/starweb/starlit-app/subscription","commits_url":"https://api.github.com/repos/starweb/starlit-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/starweb/starlit-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/starweb/starlit-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/starweb/starlit-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/starweb/starlit-app/contents/{+path}","compare_url":"https://api.github.com/repos/starweb/starlit-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starweb/starlit-app/merges","archive_url":"https://api.github.com/repos/starweb/starlit-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starweb/starlit-app/downloads","issues_url":"https://api.github.com/repos/starweb/starlit-app/issues{/number}","pulls_url":"https://api.github.com/repos/starweb/starlit-app/pulls{/number}","milestones_url":"https://api.github.com/repos/starweb/starlit-app/milestones{/number}","notifications_url":"https://api.github.com/repos/starweb/starlit-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starweb/starlit-app/labels{/name}","releases_url":"https://api.github.com/repos/starweb/starlit-app/releases{/id}","deployments_url":"https://api.github.com/repos/starweb/starlit-app/deployments","created_at":"2015-12-30T01:09:29Z","updated_at":"2016-12-05T12:02:27Z","pushed_at":"2018-08-09T07:50:25Z","git_url":"git://github.com/starweb/starlit-app.git","ssh_url":"git@github.com:starweb/starlit-app.git","clone_url":"https://github.com/starweb/starlit-app.git","svn_url":"https://github.com/starweb/starlit-app","homepage":"","size":35,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/1"},"html":{"href":"https://github.com/starweb/starlit-app/pull/1"},"issue":{"href":"https://api.github.com/repos/starweb/starlit-app/issues/1"},"comments":{"href":"https://api.github.com/repos/starweb/starlit-app/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/starweb/starlit-app/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/starweb/starlit-app/statuses/526c4743d0bd6e4db7d6b873ce18ec284aa0c2f9"}},"author_association":"NONE"}}
{"actor":{"display_login":"felixsand"}}