{"action":"created","comment":{"url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/comments/30144397","id":30144397,"diff_hunk":"@@ -60,134 +60,137 @@ public function cleanup()\n \n \tpublic function subscriptions()\n \t{\n-\t\t$account = \\Propeller\\Instagram\\Model_Account::query()\n+\t\ttry \n+\t\t{\n+\t\t\t$account = \\Propeller\\Instagram\\Model_Account::query()\n \t\t\t\t->where('active', 1)\n \t\t\t\t->get_one();\n \n-\t\t$instagram = new \\Instagram\\Instagram;\n-\t\t$instagram->setAccessToken($account->token);\n-\n-\t\t$subscriptions = \\Propeller\\Instagram\\Model_Subscription::query()\n-\t\t\t->where('status', 'Live')\n-\t\t\t->get();\n+\t\t\t$instagram = new \\Instagram\\Instagram;\n+\t\t\t$instagram->setAccessToken($account->token);\n \n-\t\tforeach($subscriptions as $sub) {\n+\t\t\t$subscriptions = \\Propeller\\Instagram\\Model_Subscription::query()\n+\t\t\t\t->where('status', 'Live')\n+\t\t\t\t->get();\n \n-\t\t\t$tag = $instagram->getTag($sub->object_id);\n-\t\t\t$media = $tag->getMedia();\n-\t\t\t$count = 0;\n+\t\t\tforeach($subscriptions as $sub) \n+\t\t\t{\n+\t\t\t\t$tag = $instagram->getTag($sub->object_id);\n+\t\t\t\t$media = $tag->getMedia();\n+\t\t\t\t$count = 0;\n \t\t\t\n-\t\t\tforeach($media as $med) {\n-\n-\t\t\t\t$image = \\DB::select('instagram_id')\n-\t\t\t\t\t->from(\\Propeller\\Instagram\\Model_Image::table())\n-\t\t\t\t\t->where('instagram_id', $med->id)\n-\t\t\t\t\t->execute()\n-\t\t\t\t\t->as_array('instagram_id', null);\n-\t\t\t\t\t\t\t\t\t\t\n-\t\t\t\ttry\n+\t\t\t\tforeach($media as $med) \n \t\t\t\t{\n-\t\t\t\t\t$ch = curl_init();\n-\t\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $med->images->standard_resolution->url);\n-\t\t\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n-\t\t\t\t\t$output = curl_exec($ch);\n-\t\t\t\t\t$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);\n-\t\t\t\t\tcurl_close($ch);\t\n+\t\t\t\t\n+\t\t\t\t\t$image = \\DB::select('instagram_id')\n+\t\t\t\t\t\t->from(\\Propeller\\Instagram\\Model_Image::table())\n+\t\t\t\t\t\t->where('instagram_id', $med->id)\n+\t\t\t\t\t\t->execute()\n+\t\t\t\t\t\t->as_array('instagram_id', null);\n+\t\t\t\t\t\t\t\t\t\t\n+\t\t\t\t\t\t$ch = curl_init();\n+\t\t\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $med->images->standard_resolution->url);\n+\t\t\t\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n+\t\t\t\t\t\t$output = curl_exec($ch);\n+\t\t\t\t\t\t$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);\n+\t\t\t\t\t\tcurl_close($ch);\t\n \t\t\t\t\t\n-\t\t\t\t\tif($content_type == 'application/xml' and $xml = new \\SimpleXMLElement($output))\n-\t\t\t\t\t{\n-\t\t\t\t\t\t// Handle access denied error\n-\t\t\t\t\t\tif($xml->Code == 'AccessDenied')\t\t\t\t\t\t\n-\t\t\t\t\t\t{\t\t\t\t\t\t\n-\t\t\t\t\t\t\tthrow new ImageAccessDeindedException(\"Access denied to 'http://distilleryimage0.s3.amazonaws.com/47040426c57211e2880f22000a1f9ca7_5.jpg'. This entry hasn't been saved to the DB.\");\n-\t\t\t\t\t\t}\n+\t\t\t\t\t\tif($content_type == 'application/xml' and $xml = new \\SimpleXMLElement($output))\n+\t\t\t\t\t\t{","path":"tasks/instagrampoll.php","position":73,"original_position":73,"commit_id":"366850e9028c668b96c79724c7192331a9c238f8","original_commit_id":"366850e9028c668b96c79724c7192331a9c238f8","user":{"login":"xploSEoF","id":7510900,"avatar_url":"https://avatars.githubusercontent.com/u/7510900?v=3","gravatar_id":"","url":"https://api.github.com/users/xploSEoF","html_url":"https://github.com/xploSEoF","followers_url":"https://api.github.com/users/xploSEoF/followers","following_url":"https://api.github.com/users/xploSEoF/following{/other_user}","gists_url":"https://api.github.com/users/xploSEoF/gists{/gist_id}","starred_url":"https://api.github.com/users/xploSEoF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xploSEoF/subscriptions","organizations_url":"https://api.github.com/users/xploSEoF/orgs","repos_url":"https://api.github.com/users/xploSEoF/repos","events_url":"https://api.github.com/users/xploSEoF/events{/privacy}","received_events_url":"https://api.github.com/users/xploSEoF/received_events","type":"User","site_admin":false},"body":"Could we keep all braces for anything other than functions and classes on the same line please?","created_at":"2015-05-12T15:14:52Z","updated_at":"2015-05-12T15:14:52Z","html_url":"https://github.com/propcom/PHP-Instagram-API/pull/9#discussion_r30144397","pull_request_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/comments/30144397"},"html":{"href":"https://github.com/propcom/PHP-Instagram-API/pull/9#discussion_r30144397"},"pull_request":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9","id":28031122,"html_url":"https://github.com/propcom/PHP-Instagram-API/pull/9","diff_url":"https://github.com/propcom/PHP-Instagram-API/pull/9.diff","patch_url":"https://github.com/propcom/PHP-Instagram-API/pull/9.patch","issue_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/9","number":9,"state":"open","locked":false,"title":"Moved try catch to cover more code","user":{"login":"tristanbettany","id":6310137,"avatar_url":"https://avatars.githubusercontent.com/u/6310137?v=3","gravatar_id":"","url":"https://api.github.com/users/tristanbettany","html_url":"https://github.com/tristanbettany","followers_url":"https://api.github.com/users/tristanbettany/followers","following_url":"https://api.github.com/users/tristanbettany/following{/other_user}","gists_url":"https://api.github.com/users/tristanbettany/gists{/gist_id}","starred_url":"https://api.github.com/users/tristanbettany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tristanbettany/subscriptions","organizations_url":"https://api.github.com/users/tristanbettany/orgs","repos_url":"https://api.github.com/users/tristanbettany/repos","events_url":"https://api.github.com/users/tristanbettany/events{/privacy}","received_events_url":"https://api.github.com/users/tristanbettany/received_events","type":"User","site_admin":false},"body":" \t\r\nClient:\tGeronimo Inns 1/GERONIMO\r\nJob:\t1/00037141 Geronimo - Ongoing Support\r\nPhase:\t004 January\r\nStage:\t[95611] Instagram API Error\r\n\r\n\r\nTry and catch more errors with larger try catch","created_at":"2015-01-26T14:46:39Z","updated_at":"2015-05-12T15:14:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf9bae477a00d5c82e8e31a39149e4e86a63ddf2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9/commits","review_comments_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9/comments","review_comment_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/comments{/number}","comments_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/9/comments","statuses_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/statuses/366850e9028c668b96c79724c7192331a9c238f8","head":{"label":"propcom:bugfix-moved-try-catch","ref":"bugfix-moved-try-catch","sha":"366850e9028c668b96c79724c7192331a9c238f8","user":{"login":"propcom","id":853537,"avatar_url":"https://avatars.githubusercontent.com/u/853537?v=3","gravatar_id":"","url":"https://api.github.com/users/propcom","html_url":"https://github.com/propcom","followers_url":"https://api.github.com/users/propcom/followers","following_url":"https://api.github.com/users/propcom/following{/other_user}","gists_url":"https://api.github.com/users/propcom/gists{/gist_id}","starred_url":"https://api.github.com/users/propcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/propcom/subscriptions","organizations_url":"https://api.github.com/users/propcom/orgs","repos_url":"https://api.github.com/users/propcom/repos","events_url":"https://api.github.com/users/propcom/events{/privacy}","received_events_url":"https://api.github.com/users/propcom/received_events","type":"Organization","site_admin":false},"repo":{"id":7794083,"name":"PHP-Instagram-API","full_name":"propcom/PHP-Instagram-API","owner":{"login":"propcom","id":853537,"avatar_url":"https://avatars.githubusercontent.com/u/853537?v=3","gravatar_id":"","url":"https://api.github.com/users/propcom","html_url":"https://github.com/propcom","followers_url":"https://api.github.com/users/propcom/followers","following_url":"https://api.github.com/users/propcom/following{/other_user}","gists_url":"https://api.github.com/users/propcom/gists{/gist_id}","starred_url":"https://api.github.com/users/propcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/propcom/subscriptions","organizations_url":"https://api.github.com/users/propcom/orgs","repos_url":"https://api.github.com/users/propcom/repos","events_url":"https://api.github.com/users/propcom/events{/privacy}","received_events_url":"https://api.github.com/users/propcom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/propcom/PHP-Instagram-API","description":"PHP 5.3+ wrapper for the Instagram API","fork":true,"url":"https://api.github.com/repos/propcom/PHP-Instagram-API","forks_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/forks","keys_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/teams","hooks_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/hooks","issue_events_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/events{/number}","events_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/events","assignees_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/assignees{/user}","branches_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/branches{/branch}","tags_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/tags","blobs_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/statuses/{sha}","languages_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/languages","stargazers_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/stargazers","contributors_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/contributors","subscribers_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/subscribers","subscription_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/subscription","commits_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/comments{/number}","contents_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/contents/{+path}","compare_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/merges","archive_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/downloads","issues_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues{/number}","pulls_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls{/number}","milestones_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/milestones{/number}","notifications_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/labels{/name}","releases_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/releases{/id}","created_at":"2013-01-24T08:45:30Z","updated_at":"2015-03-18T16:58:49Z","pushed_at":"2015-03-18T16:58:48Z","git_url":"git://github.com/propcom/PHP-Instagram-API.git","ssh_url":"git@github.com:propcom/PHP-Instagram-API.git","clone_url":"https://github.com/propcom/PHP-Instagram-API.git","svn_url":"https://github.com/propcom/PHP-Instagram-API","homepage":"","size":695,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"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":1,"default_branch":"master"}},"base":{"label":"propcom:master","ref":"master","sha":"3ef3371eb96994fac68d4adbd68ee42dfa7916ed","user":{"login":"propcom","id":853537,"avatar_url":"https://avatars.githubusercontent.com/u/853537?v=3","gravatar_id":"","url":"https://api.github.com/users/propcom","html_url":"https://github.com/propcom","followers_url":"https://api.github.com/users/propcom/followers","following_url":"https://api.github.com/users/propcom/following{/other_user}","gists_url":"https://api.github.com/users/propcom/gists{/gist_id}","starred_url":"https://api.github.com/users/propcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/propcom/subscriptions","organizations_url":"https://api.github.com/users/propcom/orgs","repos_url":"https://api.github.com/users/propcom/repos","events_url":"https://api.github.com/users/propcom/events{/privacy}","received_events_url":"https://api.github.com/users/propcom/received_events","type":"Organization","site_admin":false},"repo":{"id":7794083,"name":"PHP-Instagram-API","full_name":"propcom/PHP-Instagram-API","owner":{"login":"propcom","id":853537,"avatar_url":"https://avatars.githubusercontent.com/u/853537?v=3","gravatar_id":"","url":"https://api.github.com/users/propcom","html_url":"https://github.com/propcom","followers_url":"https://api.github.com/users/propcom/followers","following_url":"https://api.github.com/users/propcom/following{/other_user}","gists_url":"https://api.github.com/users/propcom/gists{/gist_id}","starred_url":"https://api.github.com/users/propcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/propcom/subscriptions","organizations_url":"https://api.github.com/users/propcom/orgs","repos_url":"https://api.github.com/users/propcom/repos","events_url":"https://api.github.com/users/propcom/events{/privacy}","received_events_url":"https://api.github.com/users/propcom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/propcom/PHP-Instagram-API","description":"PHP 5.3+ wrapper for the Instagram API","fork":true,"url":"https://api.github.com/repos/propcom/PHP-Instagram-API","forks_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/forks","keys_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/teams","hooks_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/hooks","issue_events_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/events{/number}","events_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/events","assignees_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/assignees{/user}","branches_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/branches{/branch}","tags_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/tags","blobs_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/statuses/{sha}","languages_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/languages","stargazers_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/stargazers","contributors_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/contributors","subscribers_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/subscribers","subscription_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/subscription","commits_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/comments{/number}","contents_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/contents/{+path}","compare_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/merges","archive_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/downloads","issues_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues{/number}","pulls_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls{/number}","milestones_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/milestones{/number}","notifications_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/labels{/name}","releases_url":"https://api.github.com/repos/propcom/PHP-Instagram-API/releases{/id}","created_at":"2013-01-24T08:45:30Z","updated_at":"2015-03-18T16:58:49Z","pushed_at":"2015-03-18T16:58:48Z","git_url":"git://github.com/propcom/PHP-Instagram-API.git","ssh_url":"git@github.com:propcom/PHP-Instagram-API.git","clone_url":"https://github.com/propcom/PHP-Instagram-API.git","svn_url":"https://github.com/propcom/PHP-Instagram-API","homepage":"","size":695,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9"},"html":{"href":"https://github.com/propcom/PHP-Instagram-API/pull/9"},"issue":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/9"},"comments":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/propcom/PHP-Instagram-API/statuses/366850e9028c668b96c79724c7192331a9c238f8"}}}}