You are here

public function Stopwatch::openSection in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Stopwatch.php \Drupal\webprofiler\Stopwatch::openSection()
  2. 8.2 webprofiler/src/Stopwatch.php \Drupal\webprofiler\Stopwatch::openSection()
  3. 4.x webprofiler/src/Stopwatch.php \Drupal\webprofiler\Stopwatch::openSection()

Creates a new section or re-opens an existing section.

Parameters

string|null $id The id of the session to re-open, null to create a new one:

Throws

\LogicException When the section to re-open is not reachable

File

webprofiler/src/Stopwatch.php, line 44

Class

Stopwatch
Class Stopwatch

Namespace

Drupal\webprofiler

Code

public function openSection($id = NULL) {
  $current = end($this->activeSections);
  if (NULL !== $id && NULL === $current
    ->get($id)) {
    throw new \LogicException(sprintf('The section "%s" has been started at an other level and can not be opened.', $id));
  }
  $this
    ->start('__section__.child', 'section');
  $this->activeSections[] = $current
    ->open($id);
  $this
    ->start('__section__');
}