public function stop($message = 'Stop', $context = [], $lap = true)
    {
        // Check if method was called only with $context
        if (is_array($message)) {
            $lap     = $context;
            $context = $message;
            $message = 'Stop';
        } elseif (is_bool($message)) {
            $lap     = $message;
            $context = [];
            $message = 'Stop';
        } elseif (is_bool($context)) {
            $lap     = $context;
            $context = [];
        }

        if (!$this->isRunning()) {
            throw new Exception("Profile {$this->getName()} not running.");
        }

        // Skip saving and logging lap for single lap profiles
        if ($lap && count($this->laps) > 1) {
            $this->lap();
        }

        // Stop counter
        $this->stop = $this->timeCurrent();

        // Add total runtime to context
        $context['runtime'] = $this->timeTotal();

        // Log
        $this->note($message, $context);

        return $this;
    }
public function stop($message = 'Stop', $context = [], $lap = true)
    {
        // Check if method was called only with $context
        if (is_array($message)) {
            $lap     = $context;
            $context = $message;
            $message = 'Stop';
        } elseif (is_bool($message)) {
            $lap     = $message;
            $context = [];
            $message = 'Stop';
        } elseif (is_bool($context)) {
            $lap     = $context;
            $context = [];
        }

        if (!$this->isRunning()) {
            throw new Exception("Profile {$this->getName()} not running.");
        }

        // Skip saving and logging lap for single lap profiles
        if ($lap && count($this->laps) > 1) {
            $this->lap();
        }

        // Stop counter
        $this->stop = $this->timeCurrent();

        // Add total runtime to context
        $context['runtime'] = $this->timeTotal();

        // Log
        $this->note($message, $context);

        return $this;
    }
public function stop ( $ message = 'Stop' , $ context = [ ] , $ lap = true ) { // Check if method was called only with $context if ( is_array ( $ message ) ) { $ lap = $ context ; $ context = $ message ; $ message = 'Stop' ; } elseif ( is_bool ( $ message ) ) { $ lap = $ message ; $ context = [ ] ; $ message = 'Stop' ; } elseif ( is_bool ( $ context ) ) { $ lap = $ context ; $ context = [ ] ; } if ( ! $ this -> isRunning ( ) ) { throw new Exception ( "Profile {$this->getName()} not running." ) ; } // Skip saving and logging lap for single lap profiles if ( $ lap && count ( $ this -> laps ) > 1 ) { $ this -> lap ( ) ; } // Stop counter $ this -> stop = $ this -> timeCurrent ( ) ; // Add total runtime to context $ context [ 'runtime' ] = $ this -> timeTotal ( ) ; // Log $ this -> note ( $ message , $ context ) ; return $ this ; }
Stop this profile.

Usage:
- <code>$profiler->stop("Msg")</code><br>
Simple message with only default context => if set via <code>context()</code>
- <code>$profiler->stop("Msg", ['key' => 'value'])</code><br>
Message and (additional) context
- <code>$profiler->stop("Msg", ['key' => 'value'], false)</code><br>
For "no lap" before stop
- <code>$profiler->stop(['key' => 'value'])</code><br>
Default message and (additional) context
- <code>$profiler->stop(['key' => 'value'], false)</code><br>
Context, but "no lap" before stop
- <code>$profiler->stop("Msg", false)</code><br>
No (additional) context and "no lap" before stop
- <code>$profiler->stop(false)</code><br>
Default message, no (additional) context and "no lap" before stop
- <code>$profiler->stop(null)</code><br>
Stop without logging
- <code>$profiler->stop(null, false)</code><br>
Stop without logging and "no lap" before stop

@param string $message [optional]
@param array  $context [optional]
@param bool   $lap     [optional]

@return $this
@throws Exception
Stop this profile .