From 9926c643141ee0b03aa480835989be2b29fe53a8 Mon Sep 17 00:00:00 2001 From: Dominik Bonsch Date: Tue, 22 Jan 2013 20:12:12 +0100 Subject: [PATCH] added the requested index to the out of bounds exception --- Classes/PHPExcel.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel.php index 8f40bd6..8304b18 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel.php @@ -227,7 +227,9 @@ class PHPExcel public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL) { if ($this->sheetNameExists($pSheet->getTitle())) { - throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."); + throw new PHPExcel_Exception( + "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first." + ); } if($iSheetIndex === NULL) { @@ -264,7 +266,9 @@ class PHPExcel $numSheets = count($this->_workSheetCollection); if ($pIndex > count($this->_workSheetCollection) - 1) { - throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}"); + throw new PHPExcel_Exception( + "The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}" + ); } else { array_splice($this->_workSheetCollection, $pIndex, 1); } @@ -289,7 +293,9 @@ class PHPExcel $numSheets = count($this->_workSheetCollection); if ($pIndex > $numSheets - 1) { - throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}"); + throw new PHPExcel_Exception( + "The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}" + ); } else { return $this->_workSheetCollection[$pIndex]; }