protected function traverseColumn(Matrix $matrix) { $rotatedMatrix = []; for ($rowIndex = 0, $height = $matrix->getHeight(); $rowIndex < $height; $rowIndex++) { $rotatedMatrix = $this->traverseRow($matrix, $rotatedMatrix, $rowIndex); } return new Matrix($rotatedMatrix); }
protected function traverseColumn(Matrix $matrix) { $rotatedMatrix = []; for ($rowIndex = $matrix->getHeight() - 1; $rowIndex >= 0; $rowIndex--) { $rotatedMatrix = $this->traverseRow($matrix, $rotatedMatrix, $rowIndex); } return new Matrix($rotatedMatrix); }