public function getColumnValues($column) { if ($column >= $this->columns) { throw MatrixException::columnOutOfRange(); } $values = []; for ($i = 0; $i < $this->rows; ++$i) { $values[] = $this->matrix[$i][$column]; } return $values; }
/** * @expectedException \Phpml\Exception\MatrixException */ public function testThrowExceptionOnInvalidColumnNumber() { $matrix = new Matrix([[1, 2, 3], [4, 5, 6]]); $matrix->getColumnValues(4); }