You are here

public function ProfilerListener::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/ProfilerListener.php \Symfony\Component\HttpKernel\EventListener\ProfilerListener::__construct()

Constructor.

Parameters

Profiler $profiler A Profiler instance:

RequestMatcherInterface|null $matcher A RequestMatcher instance:

bool $onlyException true if the profiler only collects data when an exception occurs, false otherwise:

bool $onlyMasterRequests true if the profiler only collects data when the request is a master request, false otherwise:

RequestStack|null $requestStack A RequestStack instance:

File

vendor/symfony/http-kernel/EventListener/ProfilerListener.php, line 50

Class

ProfilerListener
ProfilerListener collects data for the current request by listening to the kernel events.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function __construct(Profiler $profiler, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false, RequestStack $requestStack = null) {
  if (null === $requestStack) {

    // Prevent the deprecation notice to be triggered all the time.
    // The onKernelRequest() method fires some logic only when the
    // RequestStack instance is not provided as a dependency.
    @trigger_error('Since version 2.4, the ' . __METHOD__ . ' method must accept a RequestStack instance to get the request instead of using the ' . __CLASS__ . '::onKernelRequest method that will be removed in 3.0.', E_USER_DEPRECATED);
  }
  $this->profiler = $profiler;
  $this->matcher = $matcher;
  $this->onlyException = (bool) $onlyException;
  $this->onlyMasterRequests = (bool) $onlyMasterRequests;
  $this->profiles = new \SplObjectStorage();
  $this->parents = new \SplObjectStorage();
  $this->requestStack = $requestStack;
}