N98\Magento\Command\Database\AbstractShowCommand::generateRows PHP Method

generateRows() protected method

protected generateRows ( array $outputVars, boolean $hasDescription ) : array
$outputVars array
$hasDescription boolean
return array
    protected function generateRows(array $outputVars, $hasDescription)
    {
        $rows = array();
        $i = 0;
        foreach ($outputVars as $variableName => $variableValue) {
            $rows[$i] = array($variableName, $variableValue);
            if (true === $hasDescription && isset($this->_importantVars[$variableName], $this->_importantVars[$variableName]['desc'])) {
                $rows[$i][] = $this->formatDesc($this->_importantVars[$variableName]['desc']);
            }
            $i++;
        }
        // when searching no every variable has a description so fill the missing ones with blanks
        if (false === $hasDescription) {
            return $rows;
        }
        foreach ($rows as $k => $r) {
            if (2 === count($r)) {
                $rows[$k] = $this->getVariableDescription($r);
            }
        }
        return $rows;
    }

Usage Example

Example #1
0
 /**
  * @param array $outputVars
  * @param bool  $hasDescription
  *
  * @return array
  */
 protected function generateRows(array $outputVars, $hasDescription)
 {
     $rows = parent::generateRows($outputVars, $hasDescription);
     if (false === $hasDescription) {
         return $rows;
     }
     if (isset($this->_allVariables['Handler_read_rnd_next'])) {
         $tableScanRate = ($this->_allVariables['Handler_read_rnd_next'] + $this->_allVariables['Handler_read_rnd']) / ($this->_allVariables['Handler_read_rnd_next'] + $this->_allVariables['Handler_read_rnd'] + $this->_allVariables['Handler_read_first'] + $this->_allVariables['Handler_read_next'] + $this->_allVariables['Handler_read_key'] + $this->_allVariables['Handler_read_prev']);
         $rows[] = array('Full table scans', sprintf('%.2f', $tableScanRate * 100) . '%', $this->formatDesc('HINT: "Handler_read_rnd_next" is reset to zero when reached the value of 2^32 (4G).'));
     }
     if (isset($this->_allVariables['Innodb_buffer_pool_read_requests'])) {
         $bufferHitRate = $this->_allVariables['Innodb_buffer_pool_read_requests'] / ($this->_allVariables['Innodb_buffer_pool_read_requests'] + $this->_allVariables['Innodb_buffer_pool_reads']);
         $rows[] = array('InnoDB Buffer Pool hit', sprintf('%.2f', $bufferHitRate * 100) . '%', $this->formatDesc('An InnoDB Buffer Pool hit ratio below 99.9% is a weak indicator that
             your InnoDB Buffer Pool could be increased.'));
     }
     return $rows;
 }