public function send(Result $result = null)
    {
        if ($result) {
            // stop timer and add to meta
            if ($this->di->get('config')['application']['debugApp'] == true) {
                $timer = $this->di->get('stopwatch');
                $timer->end();

                $summary = [
                    'total_run_time' => round(($timer->endTime - $timer->startTime) * 1000, 2) . ' ms',
                    'laps' => []
                ];
                foreach ($timer->laps as $lap) {
                    $summary['laps'][$lap['name']] = round(($lap['end'] - $lap['start']) * 1000, 2) . ' ms';
                }
                $result->addMeta('stopwatch', $summary);
            }

            $this->_send($result->outputJSON());
        } else {
            $this->setStatusCode(204);
            $this->_send('');
        }

        // shouldn't we get out now?
        exit();
    }
public function send(Result $result = null)
    {
        if ($result) {
            // stop timer and add to meta
            if ($this->di->get('config')['application']['debugApp'] == true) {
                $timer = $this->di->get('stopwatch');
                $timer->end();

                $summary = [
                    'total_run_time' => round(($timer->endTime - $timer->startTime) * 1000, 2) . ' ms',
                    'laps' => []
                ];
                foreach ($timer->laps as $lap) {
                    $summary['laps'][$lap['name']] = round(($lap['end'] - $lap['start']) * 1000, 2) . ' ms';
                }
                $result->addMeta('stopwatch', $summary);
            }

            $this->_send($result->outputJSON());
        } else {
            $this->setStatusCode(204);
            $this->_send('');
        }

        // shouldn't we get out now?
        exit();
    }
public function send ( Result $ result = null ) { if ( $ result ) { // stop timer and add to meta if ( $ this -> di -> get ( 'config' ) [ 'application' ] [ 'debugApp' ] == true ) { $ timer = $ this -> di -> get ( 'stopwatch' ) ; $ timer -> end ( ) ; $ summary = [ 'total_run_time' => round ( ( $ timer -> endTime - $ timer -> startTime ) * 1000 , 2 ) . ' ms' , 'laps' => [ ] ] ; foreach ( $ timer -> laps as $ lap ) { $ summary [ 'laps' ] [ $ lap [ 'name' ] ] = round ( ( $ lap [ 'end' ] - $ lap [ 'start' ] ) * 1000 , 2 ) . ' ms' ; } $ result -> addMeta ( 'stopwatch' , $ summary ) ; } $ this -> _send ( $ result -> outputJSON ( ) ) ; } else { $ this -> setStatusCode ( 204 ) ; $ this -> _send ( '' ) ; } // shouldn't we get out now? exit ( ) ; }
format result set for output to web browser
add any final meta data

@param Result $result Could be null in case of 204 results
@return void
format result set for output to web browser add any final meta data