Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[HttpProfiler] renamed some Profiler methods
  • Loading branch information
fabpot committed Mar 4, 2014
commit 7798ecfdb68533e1bd00ffdb93e13a20bb03ff61
31 changes: 31 additions & 0 deletions src/Symfony/Component/HttpKernel/Profiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,40 @@

namespace Symfony\Component\HttpKernel\Profiler;

use Symfony\Component\HttpFoundation\Response;

/**
* @deprecated Deprecated in 2.5, to be removed in 3.0. Use the HttpProfiler component instead.
*/
class Profiler extends \Symfony\Component\HttpProfiler\Profiler
{
/**
* This method has been renamed to loadFromResponse() in HttpProfiler.
*
* @deprecated Deprecated in 2.5, to be removed in 3.0. Use loadFromResponse() instead.
*/
public function loadProfileFromResponse(Response $response)
{
return $this->loadFromResponse($response);
}

/**
* This method has been renamed to load() in HttpProfiler.
*
* @deprecated Deprecated in 2.5, to be removed in 3.0. Use load() instead.
*/
public function loadProfile($token)
{
return $this->load($token);
}

/**
* This method has been renamed to save() in HttpProfiler.
*
* @deprecated Deprecated in 2.5, to be removed in 3.0. Use save() instead.
*/
public function saveProfile(Profile $profile)
{
return $this->save($profile);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function onKernelTerminate(PostResponseEvent $event)

// save profiles
foreach ($this->profiles as $request) {
$this->profiler->saveProfile($this->profiles[$request]);
$this->profiler->save($this->profiles[$request]);
}

$this->profiles = new \SplObjectStorage();
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/HttpProfiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function enable()
*
* @return Profile A Profile instance
*/
public function loadProfileFromResponse(Response $response)
public function loadFromResponse(Response $response)
{
if (!$token = $response->headers->get('X-Debug-Token')) {
return false;
}

return $this->loadProfile($token);
return $this->load($token);
}

/**
Expand All @@ -96,7 +96,7 @@ public function loadProfileFromResponse(Response $response)
*
* @return Profile A Profile instance
*/
public function loadProfile($token)
public function load($token)
{
return $this->storage->read($token);
}
Expand All @@ -108,7 +108,7 @@ public function loadProfile($token)
*
* @return Boolean
*/
public function saveProfile(Profile $profile)
public function save(Profile $profile)
{
// late collect
foreach ($profile->getCollectors() as $collector) {
Expand Down Expand Up @@ -159,7 +159,7 @@ public function import($data)
return false;
}

$this->saveProfile($profile);
$this->save($profile);

return $profile;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpProfiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ explore problems after the fact.
// profiles are uniquely identified by a token
$token = $profile->getToken();

$profiler->saveProfile($profile);
$profiler->save($profile);

// in another process, get back a profile
$profile = $profiler->loadProfile($token);
$profile = $profiler->load($token);

Resources
---------
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpProfiler/Tests/ProfilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testCollect()
$profiler->add($collector);
$profile = $profiler->collect($request, $response);

$profile = $profiler->loadProfile($profile->getToken());
$profile = $profiler->load($profile->getToken());
$this->assertEquals(array('foo' => 'bar'), $profiler->get('request')->getRequestQuery()->all());

@unlink($tmp);
Expand Down