{"action":"created","comment":{"url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/comments/37299547","id":37299547,"diff_hunk":"@@ -132,17 +132,23 @@ public function __call($method, $args)\n         if (! in_array(strtoupper($method), $this->httpRouteMethods, true)) {\n             throw new BadMethodCallException('Unsupported method');\n         }\n-\n-        if (count($args) !== 2) {\n+        $numArgs = count($args);\n+        if ($numArgs < 2) {\n             throw new BadMethodCallException(sprintf(\n-                '%s::%s requires exactly 2 arguments; received %d',\n+                '%s::%s requires at least 2 arguments; received %d',\n                 __CLASS__,\n                 $method,\n                 count($args)\n             ));\n         }\n \n-        $args[] = [$method];\n+        if ($numArgs === 3) {\n+            $name    = $args[2];\n+            $args[2] = [$method];\n+            $args[]  = $name;","path":"src/Application.php","position":21,"original_position":21,"commit_id":"f5e0b530c5b43df2e32a5aa1ff1377cdaf33ebb8","original_commit_id":"f5e0b530c5b43df2e32a5aa1ff1377cdaf33ebb8","user":{"login":"ezimuel","id":475967,"avatar_url":"https://avatars.githubusercontent.com/u/475967?v=3","gravatar_id":"","url":"https://api.github.com/users/ezimuel","html_url":"https://github.com/ezimuel","followers_url":"https://api.github.com/users/ezimuel/followers","following_url":"https://api.github.com/users/ezimuel/following{/other_user}","gists_url":"https://api.github.com/users/ezimuel/gists{/gist_id}","starred_url":"https://api.github.com/users/ezimuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezimuel/subscriptions","organizations_url":"https://api.github.com/users/ezimuel/orgs","repos_url":"https://api.github.com/users/ezimuel/repos","events_url":"https://api.github.com/users/ezimuel/events{/privacy}","received_events_url":"https://api.github.com/users/ezimuel/received_events","type":"User","site_admin":false},"body":"@weierophinney if you use setName() on the returned Route object, you are not changing the name of the route for the Application, because of [this](https://github.com/ezimuel/zend-expressive/blob/fix/40/src/Application.php#L297-L298).\r\n","created_at":"2015-08-18T13:51:19Z","updated_at":"2015-08-18T13:51:19Z","html_url":"https://github.com/zendframework/zend-expressive/pull/73#discussion_r37299547","pull_request_url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/comments/37299547"},"html":{"href":"https://github.com/zendframework/zend-expressive/pull/73#discussion_r37299547"},"pull_request":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73","id":42695466,"html_url":"https://github.com/zendframework/zend-expressive/pull/73","diff_url":"https://github.com/zendframework/zend-expressive/pull/73.diff","patch_url":"https://github.com/zendframework/zend-expressive/pull/73.patch","issue_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/73","number":73,"state":"open","locked":false,"title":"Fixed issue #40 + minor fixes","user":{"login":"ezimuel","id":475967,"avatar_url":"https://avatars.githubusercontent.com/u/475967?v=3","gravatar_id":"","url":"https://api.github.com/users/ezimuel","html_url":"https://github.com/ezimuel","followers_url":"https://api.github.com/users/ezimuel/followers","following_url":"https://api.github.com/users/ezimuel/following{/other_user}","gists_url":"https://api.github.com/users/ezimuel/gists{/gist_id}","starred_url":"https://api.github.com/users/ezimuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezimuel/subscriptions","organizations_url":"https://api.github.com/users/ezimuel/orgs","repos_url":"https://api.github.com/users/ezimuel/repos","events_url":"https://api.github.com/users/ezimuel/events{/privacy}","received_events_url":"https://api.github.com/users/ezimuel/received_events","type":"User","site_admin":false},"body":"**NOTE:** this PR needs the merge of https://github.com/zendframework/zend-psr7bridge/pull/2.\r\n\r\nThis PR fixes issue #40. I added the name of the route in Router/Route. You can specify the name as the last optional parameter in the constructor. If the name is not specified I create a new one based on the path and the HTTP methods:\r\n```php\r\n$this->name = empty($name) ? $path . '^' . implode('_', (array) $this->methods) : $name;\r\n```\r\nI also added the naming support in Application::route(). You can add a name as last parameter, for instance adding the `'foo'` name:\r\n```php\r\n$app->route('/foo', $middleware, [ 'GET' ], 'foo');\r\n\\\\ also using direct http methods\r\n$app->get('/foo', $middleware, 'foo');\r\n```\r\nWe cannot have a syntax like that: \r\n```php\r\n$app->get('/foo', $middleware)->setName('foo');\r\n```\r\nBecause the `route()` method, called by `get()`, add the route to the router adapter.\r\n\r\nFor the ZF2 route adapter I used the HTTP method route and a special `'fail'` route injected in each route to manage the 405 error (Method not allowed).\r\n\r\nI also added some tests to cover more route scenarios with or without route name.\r\n\r\n","created_at":"2015-08-18T13:02:10Z","updated_at":"2015-08-18T13:51:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16ef739aa289c75cafbbc9e3e42f653af5971d3f","assignee":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73/commits","review_comments_url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73/comments","review_comment_url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/73/comments","statuses_url":"https://api.github.com/repos/zendframework/zend-expressive/statuses/f5e0b530c5b43df2e32a5aa1ff1377cdaf33ebb8","head":{"label":"ezimuel:fix/40","ref":"fix/40","sha":"f5e0b530c5b43df2e32a5aa1ff1377cdaf33ebb8","user":{"login":"ezimuel","id":475967,"avatar_url":"https://avatars.githubusercontent.com/u/475967?v=3","gravatar_id":"","url":"https://api.github.com/users/ezimuel","html_url":"https://github.com/ezimuel","followers_url":"https://api.github.com/users/ezimuel/followers","following_url":"https://api.github.com/users/ezimuel/following{/other_user}","gists_url":"https://api.github.com/users/ezimuel/gists{/gist_id}","starred_url":"https://api.github.com/users/ezimuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezimuel/subscriptions","organizations_url":"https://api.github.com/users/ezimuel/orgs","repos_url":"https://api.github.com/users/ezimuel/repos","events_url":"https://api.github.com/users/ezimuel/events{/privacy}","received_events_url":"https://api.github.com/users/ezimuel/received_events","type":"User","site_admin":false},"repo":{"id":40252970,"name":"zend-expressive","full_name":"ezimuel/zend-expressive","owner":{"login":"ezimuel","id":475967,"avatar_url":"https://avatars.githubusercontent.com/u/475967?v=3","gravatar_id":"","url":"https://api.github.com/users/ezimuel","html_url":"https://github.com/ezimuel","followers_url":"https://api.github.com/users/ezimuel/followers","following_url":"https://api.github.com/users/ezimuel/following{/other_user}","gists_url":"https://api.github.com/users/ezimuel/gists{/gist_id}","starred_url":"https://api.github.com/users/ezimuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezimuel/subscriptions","organizations_url":"https://api.github.com/users/ezimuel/orgs","repos_url":"https://api.github.com/users/ezimuel/repos","events_url":"https://api.github.com/users/ezimuel/events{/privacy}","received_events_url":"https://api.github.com/users/ezimuel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ezimuel/zend-expressive","description":"Start to develop PSR-7 middleware applications in PHP in a minute!","fork":true,"url":"https://api.github.com/repos/ezimuel/zend-expressive","forks_url":"https://api.github.com/repos/ezimuel/zend-expressive/forks","keys_url":"https://api.github.com/repos/ezimuel/zend-expressive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezimuel/zend-expressive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezimuel/zend-expressive/teams","hooks_url":"https://api.github.com/repos/ezimuel/zend-expressive/hooks","issue_events_url":"https://api.github.com/repos/ezimuel/zend-expressive/issues/events{/number}","events_url":"https://api.github.com/repos/ezimuel/zend-expressive/events","assignees_url":"https://api.github.com/repos/ezimuel/zend-expressive/assignees{/user}","branches_url":"https://api.github.com/repos/ezimuel/zend-expressive/branches{/branch}","tags_url":"https://api.github.com/repos/ezimuel/zend-expressive/tags","blobs_url":"https://api.github.com/repos/ezimuel/zend-expressive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezimuel/zend-expressive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezimuel/zend-expressive/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezimuel/zend-expressive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezimuel/zend-expressive/statuses/{sha}","languages_url":"https://api.github.com/repos/ezimuel/zend-expressive/languages","stargazers_url":"https://api.github.com/repos/ezimuel/zend-expressive/stargazers","contributors_url":"https://api.github.com/repos/ezimuel/zend-expressive/contributors","subscribers_url":"https://api.github.com/repos/ezimuel/zend-expressive/subscribers","subscription_url":"https://api.github.com/repos/ezimuel/zend-expressive/subscription","commits_url":"https://api.github.com/repos/ezimuel/zend-expressive/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezimuel/zend-expressive/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezimuel/zend-expressive/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezimuel/zend-expressive/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezimuel/zend-expressive/contents/{+path}","compare_url":"https://api.github.com/repos/ezimuel/zend-expressive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezimuel/zend-expressive/merges","archive_url":"https://api.github.com/repos/ezimuel/zend-expressive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezimuel/zend-expressive/downloads","issues_url":"https://api.github.com/repos/ezimuel/zend-expressive/issues{/number}","pulls_url":"https://api.github.com/repos/ezimuel/zend-expressive/pulls{/number}","milestones_url":"https://api.github.com/repos/ezimuel/zend-expressive/milestones{/number}","notifications_url":"https://api.github.com/repos/ezimuel/zend-expressive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezimuel/zend-expressive/labels{/name}","releases_url":"https://api.github.com/repos/ezimuel/zend-expressive/releases{/id}","created_at":"2015-08-05T15:22:04Z","updated_at":"2015-08-05T15:22:05Z","pushed_at":"2015-08-18T13:15:41Z","git_url":"git://github.com/ezimuel/zend-expressive.git","ssh_url":"git@github.com:ezimuel/zend-expressive.git","clone_url":"https://github.com/ezimuel/zend-expressive.git","svn_url":"https://github.com/ezimuel/zend-expressive","homepage":null,"size":282,"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":"zendframework:master","ref":"master","sha":"6eb9c3adaf564273b0322c307f8f84fc6678f0f8","user":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"repo":{"id":40017341,"name":"zend-expressive","full_name":"zendframework/zend-expressive","owner":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendframework/zend-expressive","description":"Start to develop PSR-7 middleware applications in PHP in a minute!","fork":false,"url":"https://api.github.com/repos/zendframework/zend-expressive","forks_url":"https://api.github.com/repos/zendframework/zend-expressive/forks","keys_url":"https://api.github.com/repos/zendframework/zend-expressive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendframework/zend-expressive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendframework/zend-expressive/teams","hooks_url":"https://api.github.com/repos/zendframework/zend-expressive/hooks","issue_events_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/events{/number}","events_url":"https://api.github.com/repos/zendframework/zend-expressive/events","assignees_url":"https://api.github.com/repos/zendframework/zend-expressive/assignees{/user}","branches_url":"https://api.github.com/repos/zendframework/zend-expressive/branches{/branch}","tags_url":"https://api.github.com/repos/zendframework/zend-expressive/tags","blobs_url":"https://api.github.com/repos/zendframework/zend-expressive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendframework/zend-expressive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendframework/zend-expressive/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendframework/zend-expressive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendframework/zend-expressive/statuses/{sha}","languages_url":"https://api.github.com/repos/zendframework/zend-expressive/languages","stargazers_url":"https://api.github.com/repos/zendframework/zend-expressive/stargazers","contributors_url":"https://api.github.com/repos/zendframework/zend-expressive/contributors","subscribers_url":"https://api.github.com/repos/zendframework/zend-expressive/subscribers","subscription_url":"https://api.github.com/repos/zendframework/zend-expressive/subscription","commits_url":"https://api.github.com/repos/zendframework/zend-expressive/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendframework/zend-expressive/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendframework/zend-expressive/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendframework/zend-expressive/contents/{+path}","compare_url":"https://api.github.com/repos/zendframework/zend-expressive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendframework/zend-expressive/merges","archive_url":"https://api.github.com/repos/zendframework/zend-expressive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendframework/zend-expressive/downloads","issues_url":"https://api.github.com/repos/zendframework/zend-expressive/issues{/number}","pulls_url":"https://api.github.com/repos/zendframework/zend-expressive/pulls{/number}","milestones_url":"https://api.github.com/repos/zendframework/zend-expressive/milestones{/number}","notifications_url":"https://api.github.com/repos/zendframework/zend-expressive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendframework/zend-expressive/labels{/name}","releases_url":"https://api.github.com/repos/zendframework/zend-expressive/releases{/id}","created_at":"2015-07-31T17:45:22Z","updated_at":"2015-08-14T21:52:54Z","pushed_at":"2015-08-18T13:15:42Z","git_url":"git://github.com/zendframework/zend-expressive.git","ssh_url":"git@github.com:zendframework/zend-expressive.git","clone_url":"https://github.com/zendframework/zend-expressive.git","svn_url":"https://github.com/zendframework/zend-expressive","homepage":null,"size":973,"stargazers_count":26,"watchers_count":26,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":13,"forks":11,"open_issues":13,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73"},"html":{"href":"https://github.com/zendframework/zend-expressive/pull/73"},"issue":{"href":"https://api.github.com/repos/zendframework/zend-expressive/issues/73"},"comments":{"href":"https://api.github.com/repos/zendframework/zend-expressive/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendframework/zend-expressive/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/zendframework/zend-expressive/statuses/f5e0b530c5b43df2e32a5aa1ff1377cdaf33ebb8"}}}}