{"action":"created","comment":{"url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/comments/54883421","id":54883421,"diff_hunk":"@@ -0,0 +1,103 @@\n+<?php\n+\n+namespace Werkspot\\BingAdsApiBundle\\Api\\Helper;\n+\n+use GuzzleHttp\\ClientInterface;\n+use Symfony\\Component\\Filesystem\\FileSystem;\n+use Werkspot\\BingAdsApiBundle\\Guzzle\\Exceptions\\CurlException;\n+use Werkspot\\BingAdsApiBundle\\Guzzle\\Exceptions\\HttpStatusCodeException;\n+\n+class File\n+{\n+    /**\n+     * @var ClientInterface\n+     */\n+    private $guzzleClient;\n+\n+    /**\n+     * @var FileSystem\n+     */\n+    private $fileSystem;\n+\n+    public function __construct(ClientInterface $guzzleClient = null)\n+    {\n+        $this->guzzleClient = $guzzleClient;\n+        $this->fileSystem = new FileSystem();\n+\n+    }\n+\n+    /**\n+     * @param $source\n+     * @param null|string $destination\n+     *\n+     * @return bool|string\n+     *\n+     * @throws \\Exception\n+     */\n+    public function getFile($source, $destination = null)\n+    {\n+        if (preg_match('/^((https?)\\:\\/\\/)?([a-z0-9-.]*)\\.([a-z]{2,255})(\\:[0-9]{2,5})?(\\/([a-z0-9+$_-]\\.?)+)*\\/?(\\?[a-z+&$_.-][a-z0-9;:@&%=+\\/$_.-]*)?(#[a-z_.-][a-z0-9+$_.-]*)?$/', $source)) {\n+            if (!$destination) {\n+                throw new \\Exception(\"No file destination given.\");\n+            }\n+            $destination = $this->download($source, $destination);\n+        } else {\n+            if ($destination) {\n+                $this->fileSystem->copy($source, $destination);\n+            } else {\n+                $destination = $source;\n+            }\n+        }\n+\n+        if (!$this->fileSystem->exists($destination)) {\n+            return false;\n+        }\n+        return $destination;\n+    }\n+\n+    /**\n+     *\n+     * @param string $url Url we want to download from\n+     * @param string $destination local file we want to store the data including path (usually $this->cacheDir)\n+     *\n+     * @return string\n+     *\n+     * @throws CurlException\n+     * @throws HttpStatusCodeException\n+     * @throws \\Exception\n+     */\n+    public function download($url, $destination)\n+    {\n+        $this->guzzleClient->request('GET', $url, ['sink' => $destination]);\n+        return $destination;\n+    }\n+\n+    /**\n+     *\n+     * @param string $file zipFile we want to open\n+     * @param bool $delete\n+     *\n+     * @return array of extracted files\n+     *\n+     * @throws \\Exception\n+     */\n+    public function unZip($file, $delete = true)","path":"Api/Helper/File.php","position":84,"original_position":84,"commit_id":"1dd31886a258be31e09be4690b9269ce395bbcb9","original_commit_id":"1dd31886a258be31e09be4690b9269ce395bbcb9","user":{"login":"MarijnKoesen","id":711208,"avatar_url":"https://avatars.githubusercontent.com/u/711208?v=3","gravatar_id":"","url":"https://api.github.com/users/MarijnKoesen","html_url":"https://github.com/MarijnKoesen","followers_url":"https://api.github.com/users/MarijnKoesen/followers","following_url":"https://api.github.com/users/MarijnKoesen/following{/other_user}","gists_url":"https://api.github.com/users/MarijnKoesen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarijnKoesen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarijnKoesen/subscriptions","organizations_url":"https://api.github.com/users/MarijnKoesen/orgs","repos_url":"https://api.github.com/users/MarijnKoesen/repos","events_url":"https://api.github.com/users/MarijnKoesen/events{/privacy}","received_events_url":"https://api.github.com/users/MarijnKoesen/received_events","type":"User","site_admin":false},"body":"It's not really clear that the zip is extracted in the same folder that is resides in, you really need to read the implementation, it would be better if you could know without reading the implementation","created_at":"2016-03-03T14:08:10Z","updated_at":"2016-03-03T14:08:10Z","html_url":"https://github.com/Werkspot/BingAdsApiBundle/pull/4#discussion_r54883421","pull_request_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/comments/54883421"},"html":{"href":"https://github.com/Werkspot/BingAdsApiBundle/pull/4#discussion_r54883421"},"pull_request":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4","id":61229322,"html_url":"https://github.com/Werkspot/BingAdsApiBundle/pull/4","diff_url":"https://github.com/Werkspot/BingAdsApiBundle/pull/4.diff","patch_url":"https://github.com/Werkspot/BingAdsApiBundle/pull/4.patch","issue_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/4","number":4,"state":"open","locked":false,"title":"Tests","user":{"login":"LauLaman","id":8283992,"avatar_url":"https://avatars.githubusercontent.com/u/8283992?v=3","gravatar_id":"","url":"https://api.github.com/users/LauLaman","html_url":"https://github.com/LauLaman","followers_url":"https://api.github.com/users/LauLaman/followers","following_url":"https://api.github.com/users/LauLaman/following{/other_user}","gists_url":"https://api.github.com/users/LauLaman/gists{/gist_id}","starred_url":"https://api.github.com/users/LauLaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LauLaman/subscriptions","organizations_url":"https://api.github.com/users/LauLaman/orgs","repos_url":"https://api.github.com/users/LauLaman/repos","events_url":"https://api.github.com/users/LauLaman/events{/privacy}","received_events_url":"https://api.github.com/users/LauLaman/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-01T11:36:05Z","updated_at":"2016-03-03T14:08:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f89f11173d9e1ae9daed11ed3c13d0c0c07232b6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4/commits","review_comments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4/comments","review_comment_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/4/comments","statuses_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/statuses/1dd31886a258be31e09be4690b9269ce395bbcb9","head":{"label":"Werkspot:tests","ref":"tests","sha":"1dd31886a258be31e09be4690b9269ce395bbcb9","user":{"login":"Werkspot","id":4354216,"avatar_url":"https://avatars.githubusercontent.com/u/4354216?v=3","gravatar_id":"","url":"https://api.github.com/users/Werkspot","html_url":"https://github.com/Werkspot","followers_url":"https://api.github.com/users/Werkspot/followers","following_url":"https://api.github.com/users/Werkspot/following{/other_user}","gists_url":"https://api.github.com/users/Werkspot/gists{/gist_id}","starred_url":"https://api.github.com/users/Werkspot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Werkspot/subscriptions","organizations_url":"https://api.github.com/users/Werkspot/orgs","repos_url":"https://api.github.com/users/Werkspot/repos","events_url":"https://api.github.com/users/Werkspot/events{/privacy}","received_events_url":"https://api.github.com/users/Werkspot/received_events","type":"Organization","site_admin":false},"repo":{"id":52085650,"name":"BingAdsApiBundle","full_name":"Werkspot/BingAdsApiBundle","owner":{"login":"Werkspot","id":4354216,"avatar_url":"https://avatars.githubusercontent.com/u/4354216?v=3","gravatar_id":"","url":"https://api.github.com/users/Werkspot","html_url":"https://github.com/Werkspot","followers_url":"https://api.github.com/users/Werkspot/followers","following_url":"https://api.github.com/users/Werkspot/following{/other_user}","gists_url":"https://api.github.com/users/Werkspot/gists{/gist_id}","starred_url":"https://api.github.com/users/Werkspot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Werkspot/subscriptions","organizations_url":"https://api.github.com/users/Werkspot/orgs","repos_url":"https://api.github.com/users/Werkspot/repos","events_url":"https://api.github.com/users/Werkspot/events{/privacy}","received_events_url":"https://api.github.com/users/Werkspot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Werkspot/BingAdsApiBundle","description":"Simple Symfony integration  Bing Ads Api","fork":false,"url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle","forks_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/forks","keys_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/teams","hooks_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/hooks","issue_events_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/events{/number}","events_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/events","assignees_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/assignees{/user}","branches_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/branches{/branch}","tags_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/tags","blobs_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/languages","stargazers_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/stargazers","contributors_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/contributors","subscribers_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/subscribers","subscription_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/subscription","commits_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/contents/{+path}","compare_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/merges","archive_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/downloads","issues_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues{/number}","pulls_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/labels{/name}","releases_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/releases{/id}","deployments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/deployments","created_at":"2016-02-19T12:15:48Z","updated_at":"2016-02-19T15:56:24Z","pushed_at":"2016-03-03T11:43:42Z","git_url":"git://github.com/Werkspot/BingAdsApiBundle.git","ssh_url":"git@github.com:Werkspot/BingAdsApiBundle.git","clone_url":"https://github.com/Werkspot/BingAdsApiBundle.git","svn_url":"https://github.com/Werkspot/BingAdsApiBundle","homepage":null,"size":70,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Werkspot:master","ref":"master","sha":"51d12382290b6c3e7fa2cbb76718442b26a142a7","user":{"login":"Werkspot","id":4354216,"avatar_url":"https://avatars.githubusercontent.com/u/4354216?v=3","gravatar_id":"","url":"https://api.github.com/users/Werkspot","html_url":"https://github.com/Werkspot","followers_url":"https://api.github.com/users/Werkspot/followers","following_url":"https://api.github.com/users/Werkspot/following{/other_user}","gists_url":"https://api.github.com/users/Werkspot/gists{/gist_id}","starred_url":"https://api.github.com/users/Werkspot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Werkspot/subscriptions","organizations_url":"https://api.github.com/users/Werkspot/orgs","repos_url":"https://api.github.com/users/Werkspot/repos","events_url":"https://api.github.com/users/Werkspot/events{/privacy}","received_events_url":"https://api.github.com/users/Werkspot/received_events","type":"Organization","site_admin":false},"repo":{"id":52085650,"name":"BingAdsApiBundle","full_name":"Werkspot/BingAdsApiBundle","owner":{"login":"Werkspot","id":4354216,"avatar_url":"https://avatars.githubusercontent.com/u/4354216?v=3","gravatar_id":"","url":"https://api.github.com/users/Werkspot","html_url":"https://github.com/Werkspot","followers_url":"https://api.github.com/users/Werkspot/followers","following_url":"https://api.github.com/users/Werkspot/following{/other_user}","gists_url":"https://api.github.com/users/Werkspot/gists{/gist_id}","starred_url":"https://api.github.com/users/Werkspot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Werkspot/subscriptions","organizations_url":"https://api.github.com/users/Werkspot/orgs","repos_url":"https://api.github.com/users/Werkspot/repos","events_url":"https://api.github.com/users/Werkspot/events{/privacy}","received_events_url":"https://api.github.com/users/Werkspot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Werkspot/BingAdsApiBundle","description":"Simple Symfony integration  Bing Ads Api","fork":false,"url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle","forks_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/forks","keys_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/teams","hooks_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/hooks","issue_events_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/events{/number}","events_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/events","assignees_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/assignees{/user}","branches_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/branches{/branch}","tags_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/tags","blobs_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/languages","stargazers_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/stargazers","contributors_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/contributors","subscribers_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/subscribers","subscription_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/subscription","commits_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/contents/{+path}","compare_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/merges","archive_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/downloads","issues_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues{/number}","pulls_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/labels{/name}","releases_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/releases{/id}","deployments_url":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/deployments","created_at":"2016-02-19T12:15:48Z","updated_at":"2016-02-19T15:56:24Z","pushed_at":"2016-03-03T11:43:42Z","git_url":"git://github.com/Werkspot/BingAdsApiBundle.git","ssh_url":"git@github.com:Werkspot/BingAdsApiBundle.git","clone_url":"https://github.com/Werkspot/BingAdsApiBundle.git","svn_url":"https://github.com/Werkspot/BingAdsApiBundle","homepage":null,"size":70,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4"},"html":{"href":"https://github.com/Werkspot/BingAdsApiBundle/pull/4"},"issue":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/4"},"comments":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/Werkspot/BingAdsApiBundle/statuses/1dd31886a258be31e09be4690b9269ce395bbcb9"}}}}