added Row::getCellAtIndex method
This commit is contained in:
parent
21e0e9e6b1
commit
29cf6245a1
@ -54,8 +54,7 @@ class Row
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Cell $cell
|
* @param Cell $cell
|
||||||
* @param mixed $cellIndex
|
* @param int $cellIndex
|
||||||
* @parma int $cellIndex
|
|
||||||
* @return Row
|
* @return Row
|
||||||
*/
|
*/
|
||||||
public function setCellAtIndex(Cell $cell, $cellIndex)
|
public function setCellAtIndex(Cell $cell, $cellIndex)
|
||||||
@ -65,6 +64,15 @@ class Row
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $cellIndex
|
||||||
|
* @return Cell|null
|
||||||
|
*/
|
||||||
|
public function getCellAtIndex($cellIndex)
|
||||||
|
{
|
||||||
|
return isset($this->cells[$cellIndex]) ? $this->cells[$cellIndex] : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Cell $cell
|
* @param Cell $cell
|
||||||
* @return Row
|
* @return Row
|
||||||
|
@ -70,6 +70,18 @@ class RowTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertEquals(2, $row->getNumCells());
|
$this->assertEquals(2, $row->getNumCells());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetCellAtIndex()
|
||||||
|
{
|
||||||
|
$row = new Row([], null);
|
||||||
|
$cellMock = $this->getCellMock();
|
||||||
|
$row->setCellAtIndex($cellMock, 3);
|
||||||
|
$this->assertEquals($cellMock, $row->getCellAtIndex(3));
|
||||||
|
$this->assertNull($row->getCellAtIndex(10));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user