{"action":"created","issue":{"url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/5","labels_url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/5/comments","events_url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/5/events","html_url":"https://github.com/relayphp/Relay.Relay/issues/5","id":88817807,"number":5,"title":"Allow to use the same instance multiple times","user":{"login":"oscarotero","id":377873,"avatar_url":"https://avatars.githubusercontent.com/u/377873?v=3","gravatar_id":"","url":"https://api.github.com/users/oscarotero","html_url":"https://github.com/oscarotero","followers_url":"https://api.github.com/users/oscarotero/followers","following_url":"https://api.github.com/users/oscarotero/following{/other_user}","gists_url":"https://api.github.com/users/oscarotero/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarotero/subscriptions","organizations_url":"https://api.github.com/users/oscarotero/orgs","repos_url":"https://api.github.com/users/oscarotero/repos","events_url":"https://api.github.com/users/oscarotero/events{/privacy}","received_events_url":"https://api.github.com/users/oscarotero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-16T19:30:59Z","updated_at":"2015-06-16T20:01:41Z","closed_at":null,"body":"Currently, the `__invoke()` method of `Relay` use `array_shift` to get the next middleware from the queue. I think it should better to use [next()](http://php.net/next) to get the element without remove it, so the queue should be used multiple times:\r\n\r\n```php\r\n$dispatcher = new Relay([$middleware1, $middleware2]);\r\n\r\n$response = $dispatcher(new ServerRequest(), new Response());\r\n$response2 = $dispatcher(new ServerRequest(), new Response());\r\n```"},"comment":{"url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/comments/112551695","html_url":"https://github.com/relayphp/Relay.Relay/issues/5#issuecomment-112551695","issue_url":"https://api.github.com/repos/relayphp/Relay.Relay/issues/5","id":112551695,"user":{"login":"pmjones","id":25754,"avatar_url":"https://avatars.githubusercontent.com/u/25754?v=3","gravatar_id":"","url":"https://api.github.com/users/pmjones","html_url":"https://github.com/pmjones","followers_url":"https://api.github.com/users/pmjones/followers","following_url":"https://api.github.com/users/pmjones/following{/other_user}","gists_url":"https://api.github.com/users/pmjones/gists{/gist_id}","starred_url":"https://api.github.com/users/pmjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmjones/subscriptions","organizations_url":"https://api.github.com/users/pmjones/orgs","repos_url":"https://api.github.com/users/pmjones/repos","events_url":"https://api.github.com/users/pmjones/events{/privacy}","received_events_url":"https://api.github.com/users/pmjones/received_events","type":"User","site_admin":false},"created_at":"2015-06-16T20:01:41Z","updated_at":"2015-06-16T20:01:41Z","body":"> why limit to just one direction?\r\n\r\nNo good reason, other than I didn't think of it. Feature request accepted!"}}