Skip to content

[WIP] Master profiler component #20502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
added licence file to the new interface. changed collector collectDat…
…a signature to take an instance of profile interface
  • Loading branch information
yjv committed Nov 13, 2016
commit f42468d50dcebc68393fe0de126f798e27e950d0
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Component\Profiler\DataCollector;

use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\Context\RequestContext;
use Symfony\Component\Profiler\ProfileInterface;

/**
* AjaxDataCollector.
Expand All @@ -22,7 +22,7 @@
*/
class AjaxDataCollector extends DataCollector
{
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
return $context instanceof RequestContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\ProfileInterface;

/**
* ConfigDataCollector.
Expand Down Expand Up @@ -56,7 +56,7 @@ public function setKernel(KernelInterface $kernel = null)
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
$this->data = array(
'app_name' => $this->name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Profiler\DataCollector;

use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Caster\LinkStub;
use Symfony\Component\VarDumper\Caster\StubCaster;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\ProfileInterface;

/**
* DataCollectorInterface.
Expand All @@ -25,10 +26,10 @@ interface DataCollectorInterface
* Collects data for the given Request and Response.
*
* @param ContextInterface $context
* @param Profile $profile
* @param ProfileInterface|Profile $profile
* @return
*/
public function collectData(ContextInterface $context, Profile $profile);
public function collectData(ContextInterface $context, ProfileInterface $profile);

/**
* Returns the name of the collector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\Context\RequestContext;
use Symfony\Component\Profiler\ProfileInterface;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\VarCloner;
Expand Down Expand Up @@ -140,7 +140,7 @@ public function dump(Data $data)
}
}

public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
// Sub-requests and programmatic calls stay in the collected profile.
if ($this->dumper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\ProfileInterface;

/**
Expand All @@ -34,7 +33,7 @@ public function __construct(EventDispatcherInterface $dispatcher = null)
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
$this->data = array(
'called_listeners' => array(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\ProfileInterface;

/**
* ExceptionDataCollector.
Expand All @@ -25,7 +25,7 @@ class ExceptionDataCollector extends DataCollector
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
if (null !== $context->getException()) {
$this->data = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($logger = null)
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
$this->updateMemoryUsage();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\Context\RequestContext;
use Symfony\Component\Profiler\ProfileInterface;
use Symfony\Component\Routing\Route;

/**
Expand All @@ -43,7 +44,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
if (!$context instanceof RequestContext) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\Context\RequestContext;
use Symfony\Component\Profiler\ProfileInterface;

/**
* RouterDataCollector.
Expand All @@ -41,7 +41,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
if (!$context instanceof RequestContext) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Profiler\Context\ContextInterface;
use Symfony\Component\Profiler\Profile;
use Symfony\Component\Profiler\Context\RequestContext;
use Symfony\Component\Profiler\ProfileInterface;
use Symfony\Component\Stopwatch\Stopwatch;
Expand All @@ -38,7 +37,7 @@ public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch
/**
* {@inheritdoc}
*/
public function collectData(ContextInterface $context, Profile $profile)
public function collectData(ContextInterface $context, ProfileInterface $profile)
{
if (null !== $this->kernel) {
$startTime = $this->kernel->getStartTime();
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Profiler/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class Profile implements ProfileInterface
private $type;

/**
* @var Profile
* @var ProfileInterface
*/
private $parent;

/**
* @var Profile[]
* @var ProfileInterface[]
*/
private $children = array();

Expand Down Expand Up @@ -77,9 +77,9 @@ public function getToken()
/**
* Sets the parent token.
*
* @param Profile $parent The parent Profile
* @param ProfileInterface $parent The parent Profile
*/
public function setParent(Profile $parent)
public function setParent(ProfileInterface $parent)
{
$this->parent = $parent;
}
Expand Down
29 changes: 9 additions & 20 deletions src/Symfony/Component/Profiler/ProfileInterface.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php
/**
* Created by PhpStorm.
* User: yosefderay
* Date: 11/12/16
* Time: 7:41 PM
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Profiler;

use Symfony\Component\Profiler\DataCollector\DataCollectorInterface;
Expand All @@ -13,7 +16,7 @@
/**
* Profile.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Yosef Deray <yderay@gmail.com>
*/
interface ProfileInterface
{
Expand All @@ -24,27 +27,13 @@ interface ProfileInterface
*/
public function getToken();

/**
* Sets the parent token.
*
* @param Profile $parent The parent Profile
*/
public function setParent(Profile $parent);

/**
* Returns the parent profile.
*
* @return Profile The parent profile
*/
public function getParent();

/**
* Returns the parent token.
*
* @return null|string The parent token
*/
public function getParentToken();

/**
* Returns the name.
*
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy