{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/33859737","id":33859737,"diff_hunk":"@@ -0,0 +1,36 @@\n+<?php\n+\n+/*\n+ * This file is part of the Symfony package.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Symfony\\Component\\Profiler\\DataCollector;\n+\n+/**\n+ * DataCollectorInterface.\n+ *\n+ * @author Jelte Steijaert <jelte@khepri.be>\n+ */\n+interface DataCollectorInterface\n+{\n+    /**\n+     * Set the Token of the active profile.\n+     *\n+     * @param $token\n+     */\n+    public function setToken($token);\n+\n+    /**\n+     * Returns the name of the collector.\n+     *\n+     * @return string The collector name\n+     *\n+     * @api\n+     */\n+    public function getName();","path":"src/Symfony/Component/Profiler/DataCollector/DataCollectorInterface.php","position":35,"original_position":35,"commit_id":"ea93389d4f17ea6d42ebc9c0fdf15575955d25e8","original_commit_id":"ea93389d4f17ea6d42ebc9c0fdf15575955d25e8","user":{"login":"webmozart","id":176399,"avatar_url":"https://avatars.githubusercontent.com/u/176399?v=3","gravatar_id":"","url":"https://api.github.com/users/webmozart","html_url":"https://github.com/webmozart","followers_url":"https://api.github.com/users/webmozart/followers","following_url":"https://api.github.com/users/webmozart/following{/other_user}","gists_url":"https://api.github.com/users/webmozart/gists{/gist_id}","starred_url":"https://api.github.com/users/webmozart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webmozart/subscriptions","organizations_url":"https://api.github.com/users/webmozart/orgs","repos_url":"https://api.github.com/users/webmozart/repos","events_url":"https://api.github.com/users/webmozart/events{/privacy}","received_events_url":"https://api.github.com/users/webmozart/received_events","type":"User","site_admin":false},"body":"Why do Data collectors need names? What's the use case for accessing collectors by name? I think that this method should be moved to ProfileDataInterface.","created_at":"2015-07-03T12:16:06Z","updated_at":"2015-07-03T12:16:06Z","html_url":"https://github.com/symfony/symfony/pull/14809#discussion_r33859737","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/14809","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/33859737"},"html":{"href":"https://github.com/symfony/symfony/pull/14809#discussion_r33859737"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14809"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/14809","id":36585512,"html_url":"https://github.com/symfony/symfony/pull/14809","diff_url":"https://github.com/symfony/symfony/pull/14809.diff","patch_url":"https://github.com/symfony/symfony/pull/14809.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/14809","number":14809,"state":"open","locked":false,"title":"Extract the profiler to a new component","user":{"login":"jelte","id":799841,"avatar_url":"https://avatars.githubusercontent.com/u/799841?v=3","gravatar_id":"","url":"https://api.github.com/users/jelte","html_url":"https://github.com/jelte","followers_url":"https://api.github.com/users/jelte/followers","following_url":"https://api.github.com/users/jelte/following{/other_user}","gists_url":"https://api.github.com/users/jelte/gists{/gist_id}","starred_url":"https://api.github.com/users/jelte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelte/subscriptions","organizations_url":"https://api.github.com/users/jelte/orgs","repos_url":"https://api.github.com/users/jelte/repos","events_url":"https://api.github.com/users/jelte/events{/privacy}","received_events_url":"https://api.github.com/users/jelte/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | yes\r\n| Tests pass?   | yes\r\n| Fixed tickets | https://github.com/symfony/symfony/issues/11263\r\n| License       | MIT\r\n| Doc PR        | https://github.com/symfony/symfony-docs/pull/5422\r\n\r\n**This pull request is a replacement for https://github.com/symfony/symfony/pull/10374**\r\n\r\nThis pull request extracts the HTTP profiler from the HttpKernel component to a new dedicated component: Profiler.\r\n\r\nThe goals are to improve the general architecture and usability of the component as stated by @webmozart ( https://github.com/symfony/symfony/pull/10374#issuecomment-36616624 )\r\nas it stands now no BC is broken as the original DataCollectors are still supported by the new Profiler.\r\n\r\nNew DataCollectors and Profiler no longer require a Request.\r\nDataCollectors are should be able to collect data from other sources, which will prevent some ugly hacks that were previously required, they will still require to listen to events to collect the data, I don't see a way around this, but this doesn't seem a big issue.\r\n\r\nIf a DataCollector requires the Request, it should have the RequestStack and get it from there, the Responses can be added just like Controllers are added, by subscribing to the Kernel Events.\r\n\r\n*Profile HTTP Request*\r\n```php\r\n$profiler = new Profiler($storageInterface);\r\n$profiler->addCollector(new RequestDataCollector($requestStack));\r\n$profiler->addCollector(new ExceptionDataCollector());\r\n$profiler->addCollector(new FormDataCollector());\r\n\r\n// Runtime data is collected\r\n$profile = $profiler->profileRequest($request, $response);\r\n\r\n$requestData = $profile->get('request');\r\n\r\n// Late data is collected\r\n$profiler->save($profile);\r\n```\r\n\r\n*Profile Console Command*\r\n```php\r\n$profiler = new Profiler($storageInterface);\r\n$profiler->addCollector(new ExceptionDataCollector());\r\n\r\n// Runtime data is collected\r\n$profile = $profiler->profileCommand($command, $input, $exitCode);\r\n\r\n$exceptionData = $profile->get('exception');\r\n\r\n// Late data is collected\r\n$profiler->save($profile);\r\n```\r\n\r\n**Todo's**\r\n- [x] add additional tests to increase coverage.\r\n- [x] add README.md\r\n- [x] Test with Symfony demo\r\n- [x] Convert Bundle & Bridge DataCollectors (if that does not break BC)\r\n- [x] ConsoleProfiler\r\n- [x] Move DataCollector to their related Component or Bridge\r\n- [x] DoctrineDataCollector: Move collected data from DoctrineBundle to DoctrineBridge\r\n- [x] Refactor FormDataCollector\r\n- [x] Refactor DumpDataCollector as it has to many responsibilities\r\n- [x] add tests for MysqlProfileStorage\r\n- [x] add phpdocs where missing\r\n- [x] squash pull request\r\n- [x] submit changes to the documentation\r\n\r\nSpecial thanks to @stof & @dosten for helping me out on the initial pull request ( https://github.com/symfony/symfony/pull/14763 ) ","created_at":"2015-05-31T17:09:46Z","updated_at":"2015-07-03T12:16:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5648ad0f19bd00bcad8c698a130d2b8c07ec5c8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/14809/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/14809/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/14809/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/ea93389d4f17ea6d42ebc9c0fdf15575955d25e8","head":{"label":"jelte:profiler","ref":"profiler","sha":"ea93389d4f17ea6d42ebc9c0fdf15575955d25e8","user":{"login":"jelte","id":799841,"avatar_url":"https://avatars.githubusercontent.com/u/799841?v=3","gravatar_id":"","url":"https://api.github.com/users/jelte","html_url":"https://github.com/jelte","followers_url":"https://api.github.com/users/jelte/followers","following_url":"https://api.github.com/users/jelte/following{/other_user}","gists_url":"https://api.github.com/users/jelte/gists{/gist_id}","starred_url":"https://api.github.com/users/jelte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelte/subscriptions","organizations_url":"https://api.github.com/users/jelte/orgs","repos_url":"https://api.github.com/users/jelte/repos","events_url":"https://api.github.com/users/jelte/events{/privacy}","received_events_url":"https://api.github.com/users/jelte/received_events","type":"User","site_admin":false},"repo":{"id":35941838,"name":"symfony","full_name":"jelte/symfony","owner":{"login":"jelte","id":799841,"avatar_url":"https://avatars.githubusercontent.com/u/799841?v=3","gravatar_id":"","url":"https://api.github.com/users/jelte","html_url":"https://github.com/jelte","followers_url":"https://api.github.com/users/jelte/followers","following_url":"https://api.github.com/users/jelte/following{/other_user}","gists_url":"https://api.github.com/users/jelte/gists{/gist_id}","starred_url":"https://api.github.com/users/jelte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelte/subscriptions","organizations_url":"https://api.github.com/users/jelte/orgs","repos_url":"https://api.github.com/users/jelte/repos","events_url":"https://api.github.com/users/jelte/events{/privacy}","received_events_url":"https://api.github.com/users/jelte/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jelte/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/jelte/symfony","forks_url":"https://api.github.com/repos/jelte/symfony/forks","keys_url":"https://api.github.com/repos/jelte/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jelte/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jelte/symfony/teams","hooks_url":"https://api.github.com/repos/jelte/symfony/hooks","issue_events_url":"https://api.github.com/repos/jelte/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/jelte/symfony/events","assignees_url":"https://api.github.com/repos/jelte/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/jelte/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/jelte/symfony/tags","blobs_url":"https://api.github.com/repos/jelte/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jelte/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jelte/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/jelte/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jelte/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/jelte/symfony/languages","stargazers_url":"https://api.github.com/repos/jelte/symfony/stargazers","contributors_url":"https://api.github.com/repos/jelte/symfony/contributors","subscribers_url":"https://api.github.com/repos/jelte/symfony/subscribers","subscription_url":"https://api.github.com/repos/jelte/symfony/subscription","commits_url":"https://api.github.com/repos/jelte/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/jelte/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/jelte/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/jelte/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/jelte/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/jelte/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jelte/symfony/merges","archive_url":"https://api.github.com/repos/jelte/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jelte/symfony/downloads","issues_url":"https://api.github.com/repos/jelte/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/jelte/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/jelte/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/jelte/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jelte/symfony/labels{/name}","releases_url":"https://api.github.com/repos/jelte/symfony/releases{/id}","created_at":"2015-05-20T10:37:38Z","updated_at":"2015-05-20T10:37:55Z","pushed_at":"2015-06-28T21:53:07Z","git_url":"git://github.com/jelte/symfony.git","ssh_url":"git@github.com:jelte/symfony.git","clone_url":"https://github.com/jelte/symfony.git","svn_url":"https://github.com/jelte/symfony","homepage":"symfony.com","size":58319,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"2.8"}},"base":{"label":"symfony:2.8","ref":"2.8","sha":"268210bcece1814b48c2633747865bc96feb6d7a","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","created_at":"2010-01-04T14:21:21Z","updated_at":"2015-07-03T09:48:51Z","pushed_at":"2015-07-03T12:14:29Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":1194939,"stargazers_count":10416,"watchers_count":10416,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4135,"mirror_url":null,"open_issues_count":857,"forks":4135,"open_issues":857,"watchers":10416,"default_branch":"2.8"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14809"},"html":{"href":"https://github.com/symfony/symfony/pull/14809"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/14809"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/14809/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14809/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14809/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/ea93389d4f17ea6d42ebc9c0fdf15575955d25e8"}}}}