{"action":"created","comment":{"url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/comments/37418258","id":37418258,"diff_hunk":"@@ -0,0 +1,86 @@\n+<?php\n+\n+namespace Stats\\Controllers;\n+\n+use Joomla\\Controller\\AbstractController;\n+use Stats\\Models\\StatsModel;\n+\n+/**\n+ * Controller for processing submitted statistics data.\n+ *\n+ * @method         \\Stats\\Application  getApplication()  Get the application object.\n+ * @property-read  \\Stats\\Application  $app              Application object\n+ *\n+ * @since          1.0\n+ */\n+class SubmitControllerPost extends AbstractController\n+{\n+\t/**\n+\t * Statistics model object.\n+\t *\n+\t * @var    StatsModel\n+\t * @since  1.0\n+\t */\n+\tprivate $model;\n+\n+\t/**\n+\t * Constructor.\n+\t *\n+\t * @param   StatsModel  $model  Statistics model object.\n+\t *\n+\t * @since   1.0\n+\t */\n+\tpublic function __construct(StatsModel $model)\n+\t{\n+\t\t$this->model = $model;\n+\t}\n+\n+\t/**\n+\t * Execute the controller.\n+\t *\n+\t * @return  boolean\n+\t *\n+\t * @since   1.0\n+\t * @throws  \\RuntimeException\n+\t */\n+\tpublic function execute()\n+\t{\n+\t\t$input = $this->getInput();\n+\n+\t\t$data = [\n+\t\t\t'php_version' => $input->getRaw('php_version'),\n+\t\t\t'db_version'  => $input->getRaw('db_version'),\n+\t\t\t'cms_version' => $input->getRaw('cms_version')\n+\t\t];\n+\n+\t\t// Filter the submitted version data.\n+\t\t$data = array_map(\n+\t\t\tfunction ($value)","path":"src/Controllers/SubmitControllerPost.php","position":58,"original_position":58,"commit_id":"473a651b10036fb1ad779e7b10af45ad4e0f9dfc","original_commit_id":"473a651b10036fb1ad779e7b10af45ad4e0f9dfc","user":{"login":"zero-24","id":2596554,"avatar_url":"https://avatars.githubusercontent.com/u/2596554?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-24","html_url":"https://github.com/zero-24","followers_url":"https://api.github.com/users/zero-24/followers","following_url":"https://api.github.com/users/zero-24/following{/other_user}","gists_url":"https://api.github.com/users/zero-24/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-24/subscriptions","organizations_url":"https://api.github.com/users/zero-24/orgs","repos_url":"https://api.github.com/users/zero-24/repos","events_url":"https://api.github.com/users/zero-24/events{/privacy}","received_events_url":"https://api.github.com/users/zero-24/received_events","type":"User","site_admin":false},"body":"Ah ok :) I have learned something again ;) Thanks","created_at":"2015-08-19T14:10:33Z","updated_at":"2015-08-19T14:10:33Z","html_url":"https://github.com/joomla-extensions/jstats-server/pull/10#discussion_r37418258","pull_request_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/comments/37418258"},"html":{"href":"https://github.com/joomla-extensions/jstats-server/pull/10#discussion_r37418258"},"pull_request":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10","id":42549651,"html_url":"https://github.com/joomla-extensions/jstats-server/pull/10","diff_url":"https://github.com/joomla-extensions/jstats-server/pull/10.diff","patch_url":"https://github.com/joomla-extensions/jstats-server/pull/10.patch","issue_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/10","number":10,"state":"open","locked":false,"title":"Architectural Overhaul","user":{"login":"mbabker","id":368545,"avatar_url":"https://avatars.githubusercontent.com/u/368545?v=3","gravatar_id":"","url":"https://api.github.com/users/mbabker","html_url":"https://github.com/mbabker","followers_url":"https://api.github.com/users/mbabker/followers","following_url":"https://api.github.com/users/mbabker/following{/other_user}","gists_url":"https://api.github.com/users/mbabker/gists{/gist_id}","starred_url":"https://api.github.com/users/mbabker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbabker/subscriptions","organizations_url":"https://api.github.com/users/mbabker/orgs","repos_url":"https://api.github.com/users/mbabker/repos","events_url":"https://api.github.com/users/mbabker/events{/privacy}","received_events_url":"https://api.github.com/users/mbabker/received_events","type":"User","site_admin":false},"body":"To sum it up:\r\n\r\n### Application is converted into a RESTful web service which returns machine readable JSON data strings\r\n\r\nHTML rendering is fully removed; a module should be written to display chart based statistics instead\r\n\r\n### Defaults to returning \"sanitized\" data with ability to request raw data\r\n\r\nBy default, a sanitized string similar to the one below is returned:\r\n\r\n```json\r\n{\"data\":{\"php_version\":{\"5.5\":100},\"db_type\":{\"mysql\":100},\"db_version\":{\"5.6\":100},\"cms_version\":{\"3.4.3\":100},\"server_os\":{\"Darwin\":100},\"total\":1}}\r\n```\r\n\r\nThis represents grouped data based on a characteristic of each type (for version groups it's based on a minor version branch for example) and the returned value is a float representing a percentage of the total tracked data.  The total number is appended always to the response to represent the total number of unique sites for which data is collected.\r\n\r\nThe raw data may be requested by sending a `Joomla-Raw` header with the request with the correct header value (defined in the configuration).\r\n\r\n### Better Dependency Injection\r\n\r\nEverything is built by the DI Container and the classes are registered as services.  This better declares the object dependencies and should make it a bit easier to unit test this code.\r\n\r\n### Model/Table Consolidated\r\n\r\nThe table classes are overkill for this app.  The save function is consolidated into the stats model.  If this thing grows and the code becomes useful again, it's always available from the CMS (original source) or the issue tracker repo (slightly modified version of JTable).\r\n\r\n### Ability to Limit on a Single Source\r\n\r\nA request to `/php_version` will only return the PHP version data.  Invalid sources will cause a 404 error.\r\n\r\n### Plugin Changes Required\r\n\r\nShould be none, I honestly didn't test, but absolutely nothing was changed in the POST handler that would require an update.","created_at":"2015-08-17T02:26:28Z","updated_at":"2015-08-19T14:10:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d39230f9ed7f6eff513428cd6ac888c2df81ebf6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10/commits","review_comments_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10/comments","review_comment_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/10/comments","statuses_url":"https://api.github.com/repos/joomla-extensions/jstats-server/statuses/473a651b10036fb1ad779e7b10af45ad4e0f9dfc","head":{"label":"joomla-extensions:REST","ref":"REST","sha":"473a651b10036fb1ad779e7b10af45ad4e0f9dfc","user":{"login":"joomla-extensions","id":6154991,"avatar_url":"https://avatars.githubusercontent.com/u/6154991?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-extensions","html_url":"https://github.com/joomla-extensions","followers_url":"https://api.github.com/users/joomla-extensions/followers","following_url":"https://api.github.com/users/joomla-extensions/following{/other_user}","gists_url":"https://api.github.com/users/joomla-extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-extensions/subscriptions","organizations_url":"https://api.github.com/users/joomla-extensions/orgs","repos_url":"https://api.github.com/users/joomla-extensions/repos","events_url":"https://api.github.com/users/joomla-extensions/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-extensions/received_events","type":"Organization","site_admin":false},"repo":{"id":36957249,"name":"jstats-server","full_name":"joomla-extensions/jstats-server","owner":{"login":"joomla-extensions","id":6154991,"avatar_url":"https://avatars.githubusercontent.com/u/6154991?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-extensions","html_url":"https://github.com/joomla-extensions","followers_url":"https://api.github.com/users/joomla-extensions/followers","following_url":"https://api.github.com/users/joomla-extensions/following{/other_user}","gists_url":"https://api.github.com/users/joomla-extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-extensions/subscriptions","organizations_url":"https://api.github.com/users/joomla-extensions/orgs","repos_url":"https://api.github.com/users/joomla-extensions/repos","events_url":"https://api.github.com/users/joomla-extensions/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-extensions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla-extensions/jstats-server","description":"Server for collecting environment stats for Joomla Installations","fork":true,"url":"https://api.github.com/repos/joomla-extensions/jstats-server","forks_url":"https://api.github.com/repos/joomla-extensions/jstats-server/forks","keys_url":"https://api.github.com/repos/joomla-extensions/jstats-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla-extensions/jstats-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla-extensions/jstats-server/teams","hooks_url":"https://api.github.com/repos/joomla-extensions/jstats-server/hooks","issue_events_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/events{/number}","events_url":"https://api.github.com/repos/joomla-extensions/jstats-server/events","assignees_url":"https://api.github.com/repos/joomla-extensions/jstats-server/assignees{/user}","branches_url":"https://api.github.com/repos/joomla-extensions/jstats-server/branches{/branch}","tags_url":"https://api.github.com/repos/joomla-extensions/jstats-server/tags","blobs_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla-extensions/jstats-server/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla-extensions/jstats-server/languages","stargazers_url":"https://api.github.com/repos/joomla-extensions/jstats-server/stargazers","contributors_url":"https://api.github.com/repos/joomla-extensions/jstats-server/contributors","subscribers_url":"https://api.github.com/repos/joomla-extensions/jstats-server/subscribers","subscription_url":"https://api.github.com/repos/joomla-extensions/jstats-server/subscription","commits_url":"https://api.github.com/repos/joomla-extensions/jstats-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla-extensions/jstats-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla-extensions/jstats-server/contents/{+path}","compare_url":"https://api.github.com/repos/joomla-extensions/jstats-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla-extensions/jstats-server/merges","archive_url":"https://api.github.com/repos/joomla-extensions/jstats-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla-extensions/jstats-server/downloads","issues_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues{/number}","pulls_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla-extensions/jstats-server/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla-extensions/jstats-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla-extensions/jstats-server/labels{/name}","releases_url":"https://api.github.com/repos/joomla-extensions/jstats-server/releases{/id}","created_at":"2015-06-05T21:54:15Z","updated_at":"2015-06-07T15:01:53Z","pushed_at":"2015-08-17T02:26:28Z","git_url":"git://github.com/joomla-extensions/jstats-server.git","ssh_url":"git@github.com:joomla-extensions/jstats-server.git","clone_url":"https://github.com/joomla-extensions/jstats-server.git","svn_url":"https://github.com/joomla-extensions/jstats-server","homepage":"","size":371,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"joomla-extensions:master","ref":"master","sha":"28c71e960a23ffc0f6616f8cd5d566b8546f4ba2","user":{"login":"joomla-extensions","id":6154991,"avatar_url":"https://avatars.githubusercontent.com/u/6154991?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-extensions","html_url":"https://github.com/joomla-extensions","followers_url":"https://api.github.com/users/joomla-extensions/followers","following_url":"https://api.github.com/users/joomla-extensions/following{/other_user}","gists_url":"https://api.github.com/users/joomla-extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-extensions/subscriptions","organizations_url":"https://api.github.com/users/joomla-extensions/orgs","repos_url":"https://api.github.com/users/joomla-extensions/repos","events_url":"https://api.github.com/users/joomla-extensions/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-extensions/received_events","type":"Organization","site_admin":false},"repo":{"id":36957249,"name":"jstats-server","full_name":"joomla-extensions/jstats-server","owner":{"login":"joomla-extensions","id":6154991,"avatar_url":"https://avatars.githubusercontent.com/u/6154991?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-extensions","html_url":"https://github.com/joomla-extensions","followers_url":"https://api.github.com/users/joomla-extensions/followers","following_url":"https://api.github.com/users/joomla-extensions/following{/other_user}","gists_url":"https://api.github.com/users/joomla-extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-extensions/subscriptions","organizations_url":"https://api.github.com/users/joomla-extensions/orgs","repos_url":"https://api.github.com/users/joomla-extensions/repos","events_url":"https://api.github.com/users/joomla-extensions/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-extensions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla-extensions/jstats-server","description":"Server for collecting environment stats for Joomla Installations","fork":true,"url":"https://api.github.com/repos/joomla-extensions/jstats-server","forks_url":"https://api.github.com/repos/joomla-extensions/jstats-server/forks","keys_url":"https://api.github.com/repos/joomla-extensions/jstats-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla-extensions/jstats-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla-extensions/jstats-server/teams","hooks_url":"https://api.github.com/repos/joomla-extensions/jstats-server/hooks","issue_events_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/events{/number}","events_url":"https://api.github.com/repos/joomla-extensions/jstats-server/events","assignees_url":"https://api.github.com/repos/joomla-extensions/jstats-server/assignees{/user}","branches_url":"https://api.github.com/repos/joomla-extensions/jstats-server/branches{/branch}","tags_url":"https://api.github.com/repos/joomla-extensions/jstats-server/tags","blobs_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla-extensions/jstats-server/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla-extensions/jstats-server/languages","stargazers_url":"https://api.github.com/repos/joomla-extensions/jstats-server/stargazers","contributors_url":"https://api.github.com/repos/joomla-extensions/jstats-server/contributors","subscribers_url":"https://api.github.com/repos/joomla-extensions/jstats-server/subscribers","subscription_url":"https://api.github.com/repos/joomla-extensions/jstats-server/subscription","commits_url":"https://api.github.com/repos/joomla-extensions/jstats-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla-extensions/jstats-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla-extensions/jstats-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla-extensions/jstats-server/contents/{+path}","compare_url":"https://api.github.com/repos/joomla-extensions/jstats-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla-extensions/jstats-server/merges","archive_url":"https://api.github.com/repos/joomla-extensions/jstats-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla-extensions/jstats-server/downloads","issues_url":"https://api.github.com/repos/joomla-extensions/jstats-server/issues{/number}","pulls_url":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla-extensions/jstats-server/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla-extensions/jstats-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla-extensions/jstats-server/labels{/name}","releases_url":"https://api.github.com/repos/joomla-extensions/jstats-server/releases{/id}","created_at":"2015-06-05T21:54:15Z","updated_at":"2015-06-07T15:01:53Z","pushed_at":"2015-08-17T02:26:28Z","git_url":"git://github.com/joomla-extensions/jstats-server.git","ssh_url":"git@github.com:joomla-extensions/jstats-server.git","clone_url":"https://github.com/joomla-extensions/jstats-server.git","svn_url":"https://github.com/joomla-extensions/jstats-server","homepage":"","size":371,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10"},"html":{"href":"https://github.com/joomla-extensions/jstats-server/pull/10"},"issue":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/10"},"comments":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/joomla-extensions/jstats-server/statuses/473a651b10036fb1ad779e7b10af45ad4e0f9dfc"}}}}