{"action":"created","comment":{"url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/comments/67969303","id":67969303,"diff_hunk":"@@ -0,0 +1,30 @@\n+<?php\n+\n+// load and initialize any global libraries\n+require_once __DIR__ . '/../config/app.php';\n+require_once LIBRARY_DIR . '/functions.php';\n+require_once LIBRARY_DIR . '/dbconn.php';\n+require_once LIBRARY_DIR . '/models/product.php';\n+require_once LIBRARY_DIR . '/controllers/product.php';\n+require_once LIBRARY_DIR . '/models/wishlist.php';\n+require_once LIBRARY_DIR . '/controllers/wishlist.php';\n+\n+// route the request internally\n+$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);\n+\n+if ('/index.php/products' === $uri) {\n+    productListAction();\n+} elseif ('/index.php/products/add' === $uri && isset($_POST['product']) && isValidProduct($_POST['product'])) {\n+    productAddAction($_POST);\n+} elseif ('/index.php/products/remove' === $uri && isset($_GET['remove'])) {\n+    productRemoveAction($_GET['remove']);\n+} elseif ('/index.php/wishlist' === $uri && isset($_GET['email'])) {\n+    wishlistListAction($_GET['email']);\n+} elseif ('/index.php/wishlist/add' === $uri && isset($_GET['email']) && isset($_POST['submit']) && isValidWishList($_POST['wish_item'])) {\n+    wishlistAddAction($_GET['email'], $_POST);\n+} elseif ('/index.php/wishlist/remove' === $uri && isset($_GET['email']) && isset($_GET['remove'])) {\n+    wishlistRemoveAction($_GET['email'], $_GET['remove']);\n+} else {\n+    header('HTTP/1.1 404 Not Found');\n+    echo '<html><body><h1>Page Not Found</h1></body></html>';\n+}","path":"public/index.php","position":30,"original_position":30,"commit_id":"ecfaa66be9dc38285b01cf145c5491604f015eed","original_commit_id":"ecfaa66be9dc38285b01cf145c5491604f015eed","user":{"login":"hussani","id":959130,"avatar_url":"https://avatars.githubusercontent.com/u/959130?v=3","gravatar_id":"","url":"https://api.github.com/users/hussani","html_url":"https://github.com/hussani","followers_url":"https://api.github.com/users/hussani/followers","following_url":"https://api.github.com/users/hussani/following{/other_user}","gists_url":"https://api.github.com/users/hussani/gists{/gist_id}","starred_url":"https://api.github.com/users/hussani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hussani/subscriptions","organizations_url":"https://api.github.com/users/hussani/orgs","repos_url":"https://api.github.com/users/hussani/repos","events_url":"https://api.github.com/users/hussani/events{/privacy}","received_events_url":"https://api.github.com/users/hussani/received_events","type":"User","site_admin":false},"body":"O router ficou bem legal.\r\nCreio que ficaria melhor com `switch-case`.\r\nAs validações poderiam ficar em cada action, o que tornaria ele mais legível e a separação de contextos ainda melhor.","created_at":"2016-06-21T23:11:14Z","updated_at":"2016-06-21T23:11:14Z","html_url":"https://github.com/tonicospinelli/developing-for-business/pull/6#discussion_r67969303","pull_request_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/comments/67969303"},"html":{"href":"https://github.com/tonicospinelli/developing-for-business/pull/6#discussion_r67969303"},"pull_request":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6","id":74327916,"html_url":"https://github.com/tonicospinelli/developing-for-business/pull/6","diff_url":"https://github.com/tonicospinelli/developing-for-business/pull/6.diff","patch_url":"https://github.com/tonicospinelli/developing-for-business/pull/6.patch","issue_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/6","number":6,"state":"closed","locked":false,"title":"refactoring: create front controller","user":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"body":"it will routing all requests and call defined controller action","created_at":"2016-06-18T05:02:14Z","updated_at":"2016-06-21T23:11:14Z","closed_at":"2016-06-20T23:48:34Z","merged_at":"2016-06-20T23:48:34Z","merge_commit_sha":"cf52cd69e0d49b9d6f0a27c104dc56f1986ddc70","assignee":null,"milestone":{"url":"https://api.github.com/repos/tonicospinelli/developing-for-business/milestones/2","html_url":"https://github.com/tonicospinelli/developing-for-business/milestones/Isolating%20Layers","labels_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/milestones/2/labels","id":1827961,"number":2,"title":"Isolating Layers","description":null,"creator":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":6,"state":"open","created_at":"2016-06-15T01:48:56Z","updated_at":"2016-06-21T14:14:38Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6/commits","review_comments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6/comments","review_comment_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/6/comments","statuses_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/statuses/ecfaa66be9dc38285b01cf145c5491604f015eed","head":{"label":"tonicospinelli:06-front-controller","ref":"06-front-controller","sha":"ecfaa66be9dc38285b01cf145c5491604f015eed","user":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"repo":{"id":60567619,"name":"developing-for-business","full_name":"tonicospinelli/developing-for-business","owner":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tonicospinelli/developing-for-business","description":"Quick and simple way to move from flat PHP to Business implementation over Object Orientation","fork":false,"url":"https://api.github.com/repos/tonicospinelli/developing-for-business","forks_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/forks","keys_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/teams","hooks_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/hooks","issue_events_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/events{/number}","events_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/events","assignees_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/assignees{/user}","branches_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/branches{/branch}","tags_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/tags","blobs_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/refs{/sha}","trees_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/statuses/{sha}","languages_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/languages","stargazers_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/stargazers","contributors_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/contributors","subscribers_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/subscribers","subscription_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/subscription","commits_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/commits{/sha}","git_commits_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/commits{/sha}","comments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/comments{/number}","issue_comment_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/comments{/number}","contents_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/contents/{+path}","compare_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/merges","archive_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/downloads","issues_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues{/number}","pulls_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls{/number}","milestones_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/milestones{/number}","notifications_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/labels{/name}","releases_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/releases{/id}","deployments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/deployments","created_at":"2016-06-06T23:34:52Z","updated_at":"2016-06-18T23:04:02Z","pushed_at":"2016-06-21T17:00:37Z","git_url":"git://github.com/tonicospinelli/developing-for-business.git","ssh_url":"git@github.com:tonicospinelli/developing-for-business.git","clone_url":"https://github.com/tonicospinelli/developing-for-business.git","svn_url":"https://github.com/tonicospinelli/developing-for-business","homepage":null,"size":19,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"base":{"label":"tonicospinelli:master","ref":"master","sha":"4aa1c285265329e7d8bfb7fabcaad9ea2ae8a4a2","user":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"repo":{"id":60567619,"name":"developing-for-business","full_name":"tonicospinelli/developing-for-business","owner":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tonicospinelli/developing-for-business","description":"Quick and simple way to move from flat PHP to Business implementation over Object Orientation","fork":false,"url":"https://api.github.com/repos/tonicospinelli/developing-for-business","forks_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/forks","keys_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/teams","hooks_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/hooks","issue_events_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/events{/number}","events_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/events","assignees_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/assignees{/user}","branches_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/branches{/branch}","tags_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/tags","blobs_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/refs{/sha}","trees_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/statuses/{sha}","languages_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/languages","stargazers_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/stargazers","contributors_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/contributors","subscribers_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/subscribers","subscription_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/subscription","commits_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/commits{/sha}","git_commits_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/git/commits{/sha}","comments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/comments{/number}","issue_comment_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/comments{/number}","contents_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/contents/{+path}","compare_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/merges","archive_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/downloads","issues_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues{/number}","pulls_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls{/number}","milestones_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/milestones{/number}","notifications_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/labels{/name}","releases_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/releases{/id}","deployments_url":"https://api.github.com/repos/tonicospinelli/developing-for-business/deployments","created_at":"2016-06-06T23:34:52Z","updated_at":"2016-06-18T23:04:02Z","pushed_at":"2016-06-21T17:00:37Z","git_url":"git://github.com/tonicospinelli/developing-for-business.git","ssh_url":"git@github.com:tonicospinelli/developing-for-business.git","clone_url":"https://github.com/tonicospinelli/developing-for-business.git","svn_url":"https://github.com/tonicospinelli/developing-for-business","homepage":null,"size":19,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6"},"html":{"href":"https://github.com/tonicospinelli/developing-for-business/pull/6"},"issue":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/6"},"comments":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/tonicospinelli/developing-for-business/statuses/ecfaa66be9dc38285b01cf145c5491604f015eed"}}}}
{"actor":{"display_login":"hussani"}}