{"action":"created","comment":{"url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/comments/82793650","pull_request_review_id":3675589,"id":82793650,"diff_hunk":"@@ -0,0 +1,84 @@\n+<?php\n+\n+namespace Geocoder\\Provider;\n+\n+use Geocoder\\Exception\\InvalidCredentials as InvalidCredentialsException;\n+use Geocoder\\Exception\\NoResult as NoResultException;\n+use Geocoder\\Exception\\UnsupportedOperation as UnsupportedException;\n+\n+use Ivory\\HttpAdapter\\HttpAdapterInterface;\n+\n+class What3wordsProvider extends AbstractHttpProvider implements Provider\n+{\n+    const FORWARD_URL = 'https://api.what3words.com/v2/forward?addr=%s&key=%s';\n+    const REVERSE_URL = 'https://api.what3words.com/v2/reverse?coords=%F,%F&key=%s';\n+\n+    private $apiKey = null;\n+\n+    public function __construct(HttpAdapterInterface $adapter, $apiKey)\n+    {\n+        parent::__construct($adapter);\n+\n+        $this->apiKey = $apiKey;\n+    }\n+\n+    public function getName()\n+    {\n+        return 'what3words';\n+    }\n+\n+    public function geocode($value)\n+    {\n+        if (filter_var($value, FILTER_VALIDATE_IP)) {\n+            throw new UnsupportedException('The what3words provider does not support IP addresses.');\n+        }\n+\n+        if (null == $this->apiKey) {\n+            throw new InvalidCredentialsException('No what3words API key provided.');\n+        }\n+\n+        $query = sprintf(self::FORWARD_URL, urlencode($value), $this->apiKey);\n+        return $this->executeQuery($query);\n+    }\n+\n+    public function reverse($latitude, $longitude)\n+    {\n+        if (null == $this->apiKey) {\n+            throw new InvalidCredentialsException('No what3word API key provided.');\n+        }\n+\n+        $query = sprintf(self::REVERSE_URL, $latitude, $longitude, $this->apiKey);","path":"src/Geocoder/Provider/What3wordsProvider.php","position":50,"original_position":50,"commit_id":"596f1bd58dd3f81fa0f9a307f2f48d9dae4dec4d","original_commit_id":"6509d43a914dbdb32b48a37474e48657904cc807","user":{"login":"Nyholm","id":1275206,"avatar_url":"https://avatars.githubusercontent.com/u/1275206?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyholm","html_url":"https://github.com/Nyholm","followers_url":"https://api.github.com/users/Nyholm/followers","following_url":"https://api.github.com/users/Nyholm/following{/other_user}","gists_url":"https://api.github.com/users/Nyholm/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyholm/subscriptions","organizations_url":"https://api.github.com/users/Nyholm/orgs","repos_url":"https://api.github.com/users/Nyholm/repos","events_url":"https://api.github.com/users/Nyholm/events{/privacy}","received_events_url":"https://api.github.com/users/Nyholm/received_events","type":"User","site_admin":false},"body":"Mea culpa =)\r\n","created_at":"2016-10-11T13:38:22Z","updated_at":"2016-10-11T13:38:22Z","html_url":"https://github.com/geocoder-php/geocoder-extra/pull/42#discussion_r82793650","pull_request_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/comments/82793650"},"html":{"href":"https://github.com/geocoder-php/geocoder-extra/pull/42#discussion_r82793650"},"pull_request":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42","id":84992326,"html_url":"https://github.com/geocoder-php/geocoder-extra/pull/42","diff_url":"https://github.com/geocoder-php/geocoder-extra/pull/42.diff","patch_url":"https://github.com/geocoder-php/geocoder-extra/pull/42.patch","issue_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/42","number":42,"state":"open","locked":false,"title":"Add what3words as a supported provider","user":{"login":"vicchi","id":442617,"avatar_url":"https://avatars.githubusercontent.com/u/442617?v=3","gravatar_id":"","url":"https://api.github.com/users/vicchi","html_url":"https://github.com/vicchi","followers_url":"https://api.github.com/users/vicchi/followers","following_url":"https://api.github.com/users/vicchi/following{/other_user}","gists_url":"https://api.github.com/users/vicchi/gists{/gist_id}","starred_url":"https://api.github.com/users/vicchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicchi/subscriptions","organizations_url":"https://api.github.com/users/vicchi/orgs","repos_url":"https://api.github.com/users/vicchi/repos","events_url":"https://api.github.com/users/vicchi/events{/privacy}","received_events_url":"https://api.github.com/users/vicchi/received_events","type":"User","site_admin":false},"body":"Note - due to the semantics of the what3words _3 word address_ scheme, this provider returns the 3 word address as the `locality` element of the returned `Address`. The coordinates and bounding box are also always returned in their usual place in `Address`.\r\n\r\nA valid API key is also required to use the service and for the unit tests, this can be supplied in a local copy of `phpunit.xml` as `<server name=\"WHAT3WORDS_API_KEY\" value=\"a-valid-api-key\" />`","created_at":"2016-09-13T06:34:45Z","updated_at":"2016-10-11T13:38:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1b5fb58e1e1efcd3a6a6534a0225193c5bdc9aa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42/commits","review_comments_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42/comments","review_comment_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/42/comments","statuses_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/statuses/596f1bd58dd3f81fa0f9a307f2f48d9dae4dec4d","head":{"label":"vicchi:gg-what3words-provider","ref":"gg-what3words-provider","sha":"596f1bd58dd3f81fa0f9a307f2f48d9dae4dec4d","user":{"login":"vicchi","id":442617,"avatar_url":"https://avatars.githubusercontent.com/u/442617?v=3","gravatar_id":"","url":"https://api.github.com/users/vicchi","html_url":"https://github.com/vicchi","followers_url":"https://api.github.com/users/vicchi/followers","following_url":"https://api.github.com/users/vicchi/following{/other_user}","gists_url":"https://api.github.com/users/vicchi/gists{/gist_id}","starred_url":"https://api.github.com/users/vicchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicchi/subscriptions","organizations_url":"https://api.github.com/users/vicchi/orgs","repos_url":"https://api.github.com/users/vicchi/repos","events_url":"https://api.github.com/users/vicchi/events{/privacy}","received_events_url":"https://api.github.com/users/vicchi/received_events","type":"User","site_admin":false},"repo":{"id":67692139,"name":"geocoder-extra","full_name":"vicchi/geocoder-extra","owner":{"login":"vicchi","id":442617,"avatar_url":"https://avatars.githubusercontent.com/u/442617?v=3","gravatar_id":"","url":"https://api.github.com/users/vicchi","html_url":"https://github.com/vicchi","followers_url":"https://api.github.com/users/vicchi/followers","following_url":"https://api.github.com/users/vicchi/following{/other_user}","gists_url":"https://api.github.com/users/vicchi/gists{/gist_id}","starred_url":"https://api.github.com/users/vicchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicchi/subscriptions","organizations_url":"https://api.github.com/users/vicchi/orgs","repos_url":"https://api.github.com/users/vicchi/repos","events_url":"https://api.github.com/users/vicchi/events{/privacy}","received_events_url":"https://api.github.com/users/vicchi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vicchi/geocoder-extra","description":"Geocoder extra features.","fork":true,"url":"https://api.github.com/repos/vicchi/geocoder-extra","forks_url":"https://api.github.com/repos/vicchi/geocoder-extra/forks","keys_url":"https://api.github.com/repos/vicchi/geocoder-extra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vicchi/geocoder-extra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vicchi/geocoder-extra/teams","hooks_url":"https://api.github.com/repos/vicchi/geocoder-extra/hooks","issue_events_url":"https://api.github.com/repos/vicchi/geocoder-extra/issues/events{/number}","events_url":"https://api.github.com/repos/vicchi/geocoder-extra/events","assignees_url":"https://api.github.com/repos/vicchi/geocoder-extra/assignees{/user}","branches_url":"https://api.github.com/repos/vicchi/geocoder-extra/branches{/branch}","tags_url":"https://api.github.com/repos/vicchi/geocoder-extra/tags","blobs_url":"https://api.github.com/repos/vicchi/geocoder-extra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vicchi/geocoder-extra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vicchi/geocoder-extra/git/refs{/sha}","trees_url":"https://api.github.com/repos/vicchi/geocoder-extra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vicchi/geocoder-extra/statuses/{sha}","languages_url":"https://api.github.com/repos/vicchi/geocoder-extra/languages","stargazers_url":"https://api.github.com/repos/vicchi/geocoder-extra/stargazers","contributors_url":"https://api.github.com/repos/vicchi/geocoder-extra/contributors","subscribers_url":"https://api.github.com/repos/vicchi/geocoder-extra/subscribers","subscription_url":"https://api.github.com/repos/vicchi/geocoder-extra/subscription","commits_url":"https://api.github.com/repos/vicchi/geocoder-extra/commits{/sha}","git_commits_url":"https://api.github.com/repos/vicchi/geocoder-extra/git/commits{/sha}","comments_url":"https://api.github.com/repos/vicchi/geocoder-extra/comments{/number}","issue_comment_url":"https://api.github.com/repos/vicchi/geocoder-extra/issues/comments{/number}","contents_url":"https://api.github.com/repos/vicchi/geocoder-extra/contents/{+path}","compare_url":"https://api.github.com/repos/vicchi/geocoder-extra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vicchi/geocoder-extra/merges","archive_url":"https://api.github.com/repos/vicchi/geocoder-extra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vicchi/geocoder-extra/downloads","issues_url":"https://api.github.com/repos/vicchi/geocoder-extra/issues{/number}","pulls_url":"https://api.github.com/repos/vicchi/geocoder-extra/pulls{/number}","milestones_url":"https://api.github.com/repos/vicchi/geocoder-extra/milestones{/number}","notifications_url":"https://api.github.com/repos/vicchi/geocoder-extra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vicchi/geocoder-extra/labels{/name}","releases_url":"https://api.github.com/repos/vicchi/geocoder-extra/releases{/id}","deployments_url":"https://api.github.com/repos/vicchi/geocoder-extra/deployments","created_at":"2016-09-08T10:11:07Z","updated_at":"2016-09-08T10:11:09Z","pushed_at":"2016-10-11T12:54:15Z","git_url":"git://github.com/vicchi/geocoder-extra.git","ssh_url":"git@github.com:vicchi/geocoder-extra.git","clone_url":"https://github.com/vicchi/geocoder-extra.git","svn_url":"https://github.com/vicchi/geocoder-extra","homepage":null,"size":127,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"geocoder-php:master","ref":"master","sha":"a0c076428ffad83e0b9f053a474cda2d7945dd52","user":{"login":"geocoder-php","id":5303359,"avatar_url":"https://avatars.githubusercontent.com/u/5303359?v=3","gravatar_id":"","url":"https://api.github.com/users/geocoder-php","html_url":"https://github.com/geocoder-php","followers_url":"https://api.github.com/users/geocoder-php/followers","following_url":"https://api.github.com/users/geocoder-php/following{/other_user}","gists_url":"https://api.github.com/users/geocoder-php/gists{/gist_id}","starred_url":"https://api.github.com/users/geocoder-php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geocoder-php/subscriptions","organizations_url":"https://api.github.com/users/geocoder-php/orgs","repos_url":"https://api.github.com/users/geocoder-php/repos","events_url":"https://api.github.com/users/geocoder-php/events{/privacy}","received_events_url":"https://api.github.com/users/geocoder-php/received_events","type":"Organization","site_admin":false},"repo":{"id":15278172,"name":"geocoder-extra","full_name":"geocoder-php/geocoder-extra","owner":{"login":"geocoder-php","id":5303359,"avatar_url":"https://avatars.githubusercontent.com/u/5303359?v=3","gravatar_id":"","url":"https://api.github.com/users/geocoder-php","html_url":"https://github.com/geocoder-php","followers_url":"https://api.github.com/users/geocoder-php/followers","following_url":"https://api.github.com/users/geocoder-php/following{/other_user}","gists_url":"https://api.github.com/users/geocoder-php/gists{/gist_id}","starred_url":"https://api.github.com/users/geocoder-php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geocoder-php/subscriptions","organizations_url":"https://api.github.com/users/geocoder-php/orgs","repos_url":"https://api.github.com/users/geocoder-php/repos","events_url":"https://api.github.com/users/geocoder-php/events{/privacy}","received_events_url":"https://api.github.com/users/geocoder-php/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geocoder-php/geocoder-extra","description":"Geocoder extra features.","fork":false,"url":"https://api.github.com/repos/geocoder-php/geocoder-extra","forks_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/forks","keys_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/teams","hooks_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/hooks","issue_events_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/events{/number}","events_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/events","assignees_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/assignees{/user}","branches_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/branches{/branch}","tags_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/tags","blobs_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/git/refs{/sha}","trees_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/statuses/{sha}","languages_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/languages","stargazers_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/stargazers","contributors_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/contributors","subscribers_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/subscribers","subscription_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/subscription","commits_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/commits{/sha}","git_commits_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/git/commits{/sha}","comments_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/comments{/number}","issue_comment_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/comments{/number}","contents_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/contents/{+path}","compare_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/merges","archive_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/downloads","issues_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues{/number}","pulls_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls{/number}","milestones_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/milestones{/number}","notifications_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/labels{/name}","releases_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/releases{/id}","deployments_url":"https://api.github.com/repos/geocoder-php/geocoder-extra/deployments","created_at":"2013-12-18T08:48:15Z","updated_at":"2016-09-23T23:24:43Z","pushed_at":"2016-10-11T12:54:16Z","git_url":"git://github.com/geocoder-php/geocoder-extra.git","ssh_url":"git@github.com:geocoder-php/geocoder-extra.git","clone_url":"https://github.com/geocoder-php/geocoder-extra.git","svn_url":"https://github.com/geocoder-php/geocoder-extra","homepage":null,"size":2311,"stargazers_count":36,"watchers_count":36,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":10,"forks":15,"open_issues":10,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42"},"html":{"href":"https://github.com/geocoder-php/geocoder-extra/pull/42"},"issue":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/42"},"comments":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/geocoder-php/geocoder-extra/statuses/596f1bd58dd3f81fa0f9a307f2f48d9dae4dec4d"}}}}
{"actor":{"display_login":"Nyholm"}}