Ejemplo n.º 1
0
 protected function traverseRow(Matrix $matrix, $rotatedMatrix, $rowIndex)
 {
     for ($columnIndex = 0, $width = $matrix->getWidth(); $columnIndex < $width; $columnIndex++) {
         if (!isset($rotatedMatrix[$rowIndex]) || !isset($rotatedMatrix[$columnIndex])) {
             $rotatedMatrix[$columnIndex] = [];
         }
         $rotatedMatrix[$columnIndex] = $this->addValueToRow($rotatedMatrix[$columnIndex], $this->getMatrixValue($matrix, $rowIndex, $columnIndex));
     }
     return $rotatedMatrix;
 }
 protected function getMatrixValue(Matrix $matrix, $rowIndex, $columnIndex)
 {
     return $matrix->getValue($rowIndex, $matrix->getWidth() - $columnIndex - 1);
 }