You are here

public function Stopwatch::stopSection in Devel 8.3

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

Stops the last started section.

The id parameter is used to retrieve the events from this section.

Parameters

string $id: The identifier of the section.

Throws

\LogicException When there's no started section to be stopped.

See also

getSectionEvents

File

webprofiler/src/Stopwatch.php, line 73

Class

Stopwatch
Class Stopwatch.

Namespace

Drupal\webprofiler

Code

public function stopSection($id) {
  $this
    ->stop('__section__');
  if (1 == count($this->activeSections)) {
    throw new \LogicException('There is no started section to stop.');
  }
  $this->sections[$id] = array_pop($this->activeSections)
    ->setId($id);
  $this
    ->stop('__section__.child');
}