{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony-demo/pulls/comments/39747905","id":39747905,"diff_hunk":"@@ -0,0 +1,52 @@\n+<?php\n+\n+namespace AppBundle\\EventListener;\n+\n+use Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent;\n+use Symfony\\Component\\HttpFoundation\\RedirectResponse;\n+use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+\n+/**\n+ * This listener subscribes to the 'kernel.request' event to redirect a client\n+ * to an appropriate locale, according to browser settings.\n+ *\n+ * See http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-request-event\n+ *\n+ * @author Oleg Voronkovich <oleg-voronkovich@yandex.ru>\n+ */\n+class RedirectToPreferredLocaleListener\n+{\n+    /**\n+     * @var UrlGeneratorInterface\n+     */\n+    private $urlGenerator;\n+\n+    /**\n+     * List of supported locales.\n+     *\n+     * @var string[]\n+     */\n+    private $locales = array();\n+\n+    public function __construct($locales = '', UrlGeneratorInterface $urlGenerator)","path":"src/AppBundle/EventListener/RedirectToPreferredLocaleListener.php","position":null,"original_position":31,"commit_id":"3f3c165661368c5bc84673abb5e49accb45da68a","original_commit_id":"5f0f5745024377a9ca7a6634ad1ecc6a1bebc48e","user":{"login":"voronkovich","id":2299535,"avatar_url":"https://avatars.githubusercontent.com/u/2299535?v=3","gravatar_id":"","url":"https://api.github.com/users/voronkovich","html_url":"https://github.com/voronkovich","followers_url":"https://api.github.com/users/voronkovich/followers","following_url":"https://api.github.com/users/voronkovich/following{/other_user}","gists_url":"https://api.github.com/users/voronkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/voronkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronkovich/subscriptions","organizations_url":"https://api.github.com/users/voronkovich/orgs","repos_url":"https://api.github.com/users/voronkovich/repos","events_url":"https://api.github.com/users/voronkovich/events{/privacy}","received_events_url":"https://api.github.com/users/voronkovich/received_events","type":"User","site_admin":false},"body":"@yceruto yes, you're rigth. No exceptions.","created_at":"2015-09-17T13:59:01Z","updated_at":"2015-09-17T13:59:01Z","html_url":"https://github.com/symfony/symfony-demo/pull/199#discussion_r39747905","pull_request_url":"https://api.github.com/repos/symfony/symfony-demo/pulls/199","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/comments/39747905"},"html":{"href":"https://github.com/symfony/symfony-demo/pull/199#discussion_r39747905"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/199"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony-demo/pulls/199","id":45281439,"html_url":"https://github.com/symfony/symfony-demo/pull/199","diff_url":"https://github.com/symfony/symfony-demo/pull/199.diff","patch_url":"https://github.com/symfony/symfony-demo/pull/199.patch","issue_url":"https://api.github.com/repos/symfony/symfony-demo/issues/199","number":199,"state":"open","locked":false,"title":"Redirect a client to an appropriate locale","user":{"login":"voronkovich","id":2299535,"avatar_url":"https://avatars.githubusercontent.com/u/2299535?v=3","gravatar_id":"","url":"https://api.github.com/users/voronkovich","html_url":"https://github.com/voronkovich","followers_url":"https://api.github.com/users/voronkovich/followers","following_url":"https://api.github.com/users/voronkovich/following{/other_user}","gists_url":"https://api.github.com/users/voronkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/voronkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronkovich/subscriptions","organizations_url":"https://api.github.com/users/voronkovich/orgs","repos_url":"https://api.github.com/users/voronkovich/repos","events_url":"https://api.github.com/users/voronkovich/events{/privacy}","received_events_url":"https://api.github.com/users/voronkovich/received_events","type":"User","site_admin":false},"body":"A simple example of how to use the event listeners","created_at":"2015-09-17T11:55:25Z","updated_at":"2015-09-17T13:59:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18d147fe951df2ed281e3d801021d31e60763540","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony-demo/pulls/199/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony-demo/pulls/199/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony-demo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony-demo/issues/199/comments","statuses_url":"https://api.github.com/repos/symfony/symfony-demo/statuses/3f3c165661368c5bc84673abb5e49accb45da68a","head":{"label":"voronkovich:resolve_client_language","ref":"resolve_client_language","sha":"3f3c165661368c5bc84673abb5e49accb45da68a","user":{"login":"voronkovich","id":2299535,"avatar_url":"https://avatars.githubusercontent.com/u/2299535?v=3","gravatar_id":"","url":"https://api.github.com/users/voronkovich","html_url":"https://github.com/voronkovich","followers_url":"https://api.github.com/users/voronkovich/followers","following_url":"https://api.github.com/users/voronkovich/following{/other_user}","gists_url":"https://api.github.com/users/voronkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/voronkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronkovich/subscriptions","organizations_url":"https://api.github.com/users/voronkovich/orgs","repos_url":"https://api.github.com/users/voronkovich/repos","events_url":"https://api.github.com/users/voronkovich/events{/privacy}","received_events_url":"https://api.github.com/users/voronkovich/received_events","type":"User","site_admin":false},"repo":{"id":36131936,"name":"symfony-demo","full_name":"voronkovich/symfony-demo","owner":{"login":"voronkovich","id":2299535,"avatar_url":"https://avatars.githubusercontent.com/u/2299535?v=3","gravatar_id":"","url":"https://api.github.com/users/voronkovich","html_url":"https://github.com/voronkovich","followers_url":"https://api.github.com/users/voronkovich/followers","following_url":"https://api.github.com/users/voronkovich/following{/other_user}","gists_url":"https://api.github.com/users/voronkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/voronkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronkovich/subscriptions","organizations_url":"https://api.github.com/users/voronkovich/orgs","repos_url":"https://api.github.com/users/voronkovich/repos","events_url":"https://api.github.com/users/voronkovich/events{/privacy}","received_events_url":"https://api.github.com/users/voronkovich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/voronkovich/symfony-demo","description":"","fork":true,"url":"https://api.github.com/repos/voronkovich/symfony-demo","forks_url":"https://api.github.com/repos/voronkovich/symfony-demo/forks","keys_url":"https://api.github.com/repos/voronkovich/symfony-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voronkovich/symfony-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voronkovich/symfony-demo/teams","hooks_url":"https://api.github.com/repos/voronkovich/symfony-demo/hooks","issue_events_url":"https://api.github.com/repos/voronkovich/symfony-demo/issues/events{/number}","events_url":"https://api.github.com/repos/voronkovich/symfony-demo/events","assignees_url":"https://api.github.com/repos/voronkovich/symfony-demo/assignees{/user}","branches_url":"https://api.github.com/repos/voronkovich/symfony-demo/branches{/branch}","tags_url":"https://api.github.com/repos/voronkovich/symfony-demo/tags","blobs_url":"https://api.github.com/repos/voronkovich/symfony-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voronkovich/symfony-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voronkovich/symfony-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/voronkovich/symfony-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voronkovich/symfony-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/voronkovich/symfony-demo/languages","stargazers_url":"https://api.github.com/repos/voronkovich/symfony-demo/stargazers","contributors_url":"https://api.github.com/repos/voronkovich/symfony-demo/contributors","subscribers_url":"https://api.github.com/repos/voronkovich/symfony-demo/subscribers","subscription_url":"https://api.github.com/repos/voronkovich/symfony-demo/subscription","commits_url":"https://api.github.com/repos/voronkovich/symfony-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/voronkovich/symfony-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/voronkovich/symfony-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/voronkovich/symfony-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/voronkovich/symfony-demo/contents/{+path}","compare_url":"https://api.github.com/repos/voronkovich/symfony-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voronkovich/symfony-demo/merges","archive_url":"https://api.github.com/repos/voronkovich/symfony-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voronkovich/symfony-demo/downloads","issues_url":"https://api.github.com/repos/voronkovich/symfony-demo/issues{/number}","pulls_url":"https://api.github.com/repos/voronkovich/symfony-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/voronkovich/symfony-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/voronkovich/symfony-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voronkovich/symfony-demo/labels{/name}","releases_url":"https://api.github.com/repos/voronkovich/symfony-demo/releases{/id}","created_at":"2015-05-23T16:32:26Z","updated_at":"2015-08-17T17:02:53Z","pushed_at":"2015-09-17T13:45:56Z","git_url":"git://github.com/voronkovich/symfony-demo.git","ssh_url":"git@github.com:voronkovich/symfony-demo.git","clone_url":"https://github.com/voronkovich/symfony-demo.git","svn_url":"https://github.com/voronkovich/symfony-demo","homepage":null,"size":1602,"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":"symfony:master","ref":"master","sha":"97e834860cf772d7698b4065e72b4166f669bdbf","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":32792088,"name":"symfony-demo","full_name":"symfony/symfony-demo","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony-demo","description":"","fork":false,"url":"https://api.github.com/repos/symfony/symfony-demo","forks_url":"https://api.github.com/repos/symfony/symfony-demo/forks","keys_url":"https://api.github.com/repos/symfony/symfony-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony-demo/teams","hooks_url":"https://api.github.com/repos/symfony/symfony-demo/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony-demo/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony-demo/events","assignees_url":"https://api.github.com/repos/symfony/symfony-demo/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony-demo/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony-demo/tags","blobs_url":"https://api.github.com/repos/symfony/symfony-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony-demo/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony-demo/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony-demo/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony-demo/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony-demo/subscription","commits_url":"https://api.github.com/repos/symfony/symfony-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony-demo/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony-demo/merges","archive_url":"https://api.github.com/repos/symfony/symfony-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony-demo/downloads","issues_url":"https://api.github.com/repos/symfony/symfony-demo/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony-demo/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony-demo/releases{/id}","created_at":"2015-03-24T10:37:08Z","updated_at":"2015-09-14T22:06:31Z","pushed_at":"2015-09-17T13:45:56Z","git_url":"git://github.com/symfony/symfony-demo.git","ssh_url":"git@github.com:symfony/symfony-demo.git","clone_url":"https://github.com/symfony/symfony-demo.git","svn_url":"https://github.com/symfony/symfony-demo","homepage":null,"size":3033,"stargazers_count":231,"watchers_count":231,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":20,"forks":95,"open_issues":20,"watchers":231,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/199"},"html":{"href":"https://github.com/symfony/symfony-demo/pull/199"},"issue":{"href":"https://api.github.com/repos/symfony/symfony-demo/issues/199"},"comments":{"href":"https://api.github.com/repos/symfony/symfony-demo/issues/199/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/199/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony-demo/pulls/199/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony-demo/statuses/3f3c165661368c5bc84673abb5e49accb45da68a"}}}}