Shortcut for increased performance for the vast majority of simple cases

This commit is contained in:
Adrien Crivelli 2021-04-13 11:33:37 +09:00
parent d85eaacfa3
commit 33ec70668b
No known key found for this signature in database
GPG Key ID: 16D79B903B4B5874
1 changed files with 8 additions and 0 deletions

View File

@ -1174,6 +1174,14 @@ class Worksheet implements IComparable
*/
public function getCell(string $coordinate): Cell
{
// Shortcut for increased performance for the vast majority of simple cases
if ($this->cellCollection->has($coordinate)) {
/** @var Cell $cell */
$cell = $this->cellCollection->get($coordinate);
return $cell;
}
/** @var Worksheet $sheet */
[$sheet, $finalCoordinate] = $this->getWorksheetAndCoordinate($coordinate);
$cell = $sheet->cellCollection->get($finalCoordinate);