src/Bridge/PropelCollector.php
protected function parseAndLogSqlQuery($message)
    {
        $parts = explode('|', $message, 4);
        $sql   = trim($parts[3]);

        $duration = 0;
        if (preg_match('/([0-9]+\.[0-9]+)/', $parts[1], $matches)) {
            $duration = (float) $matches[1];
        }

        $memory = 0;
        if (preg_match('/([0-9]+\.[0-9]+) ([A-Z]{1,2})/', $parts[2], $matches)) {
            $memory = (float) $matches[1];
            if ($matches[2] == 'KB') {
                $memory *= 1024;
            } elseif ($matches[2] == 'MB') {
                $memory *= 1024 * 1024;
            }
        }

        $this->statements[]    = [
            'sql'          => $sql,
            'is_success'   => true,
            'duration'     => $duration,
            'duration_str' => $this->formatDuration($duration),
            'memory'       => $memory,
            'memory_str'   => $this->formatBytes($memory),
        ];
        $this->accumulatedTime += $duration;
        $this->peakMemory      = max($this->peakMemory, $memory);
        return [$sql, $this->formatDuration($duration)];
    }
protected function parseAndLogSqlQuery($message)
    {
        $parts = explode('|', $message, 4);
        $sql   = trim($parts[3]);

        $duration = 0;
        if (preg_match('/([0-9]+\.[0-9]+)/', $parts[1], $matches)) {
            $duration = (float) $matches[1];
        }

        $memory = 0;
        if (preg_match('/([0-9]+\.[0-9]+) ([A-Z]{1,2})/', $parts[2], $matches)) {
            $memory = (float) $matches[1];
            if ($matches[2] == 'KB') {
                $memory *= 1024;
            } elseif ($matches[2] == 'MB') {
                $memory *= 1024 * 1024;
            }
        }

        $this->statements[]    = [
            'sql'          => $sql,
            'is_success'   => true,
            'duration'     => $duration,
            'duration_str' => $this->formatDuration($duration),
            'memory'       => $memory,
            'memory_str'   => $this->formatBytes($memory),
        ];
        $this->accumulatedTime += $duration;
        $this->peakMemory      = max($this->peakMemory, $memory);
        return [$sql, $this->formatDuration($duration)];
    }
protected function parseAndLogSqlQuery ( $ message ) { $ parts = explode ( '|' , $ message , 4 ) ; $ sql = trim ( $ parts [ 3 ] ) ; $ duration = 0 ; if ( preg_match ( '/([0-9]+\.[0-9]+)/' , $ parts [ 1 ] , $ matches ) ) { $ duration = ( float ) $ matches [ 1 ] ; } $ memory = 0 ; if ( preg_match ( '/([0-9]+\.[0-9]+) ([A-Z]{1,2})/' , $ parts [ 2 ] , $ matches ) ) { $ memory = ( float ) $ matches [ 1 ] ; if ( $ matches [ 2 ] == 'KB' ) { $ memory *= 1024 ; } elseif ( $ matches [ 2 ] == 'MB' ) { $ memory *= 1024 * 1024 ; } } $ this -> statements [ ] = [ 'sql' => $ sql , 'is_success' => true , 'duration' => $ duration , 'duration_str' => $ this -> formatDuration ( $ duration ) , 'memory' => $ memory , 'memory_str' => $ this -> formatBytes ( $ memory ) , ] ; $ this -> accumulatedTime += $ duration ; $ this -> peakMemory = max ( $ this -> peakMemory , $ memory ) ; return [ $ sql , $ this -> formatDuration ( $ duration ) ] ; }
Parse a log line to extract query information

@param string $message

@return array
Parse a log line to extract query information