More namespacing work

This commit is contained in:
MarkBaker 2015-05-30 12:25:17 +01:00
parent 0dafaea059
commit 54d2f72a0a
31 changed files with 641 additions and 647 deletions

View File

@ -781,7 +781,7 @@ class Worksheet implements IComparable
* @param PHPExcel $parent * @param PHPExcel $parent
* @return Worksheet * @return Worksheet
*/ */
public function rebindParent(PHPExcel $parent) public function rebindParent(Spreadsheet $parent)
{ {
if ($this->parent !== null) { if ($this->parent !== null) {
$namedRanges = $this->parent->getNamedRanges(); $namedRanges = $this->parent->getNamedRanges();

View File

@ -32,7 +32,7 @@ class AutoFilter
/** /**
* Autofilter Worksheet * Autofilter Worksheet
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
private $workSheet; private $workSheet;
@ -48,16 +48,16 @@ class AutoFilter
/** /**
* Autofilter Column Ruleset * Autofilter Column Ruleset
* *
* @var array of PHPExcel_Worksheet_AutoFilter_Column * @var AutoFilter\Column[]
*/ */
private $columns = array(); private $columns = array();
/** /**
* Create a new PHPExcel_Worksheet_AutoFilter * Create a new AutoFilter
* *
* @param string $pRange Cell range (i.e. A1:E10) * @param string $pRange Cell range (i.e. A1:E10)
* @param PHPExcel_Worksheet $pSheet * @param \PHPExcel\Worksheet $pSheet
*/ */
public function __construct($pRange = '', \PHPExcel\Worksheet $pSheet = null) public function __construct($pRange = '', \PHPExcel\Worksheet $pSheet = null)
{ {
@ -68,7 +68,7 @@ class AutoFilter
/** /**
* Get AutoFilter Parent Worksheet * Get AutoFilter Parent Worksheet
* *
* @return PHPExcel_Worksheet * @return \PHPExcel\Worksheet
*/ */
public function getParent() public function getParent()
{ {
@ -78,8 +78,8 @@ class AutoFilter
/** /**
* Set AutoFilter Parent Worksheet * Set AutoFilter Parent Worksheet
* *
* @param PHPExcel_Worksheet $pSheet * @param \PHPExcel\Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function setParent(\PHPExcel\Worksheet $pSheet = null) public function setParent(\PHPExcel\Worksheet $pSheet = null)
{ {
@ -102,8 +102,8 @@ class AutoFilter
* Set AutoFilter Range * Set AutoFilter Range
* *
* @param string $pRange Cell range (i.e. A1:E10) * @param string $pRange Cell range (i.e. A1:E10)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function setRange($pRange = '') public function setRange($pRange = '')
{ {
@ -118,7 +118,7 @@ class AutoFilter
} elseif (empty($pRange)) { } elseif (empty($pRange)) {
$this->range = ''; $this->range = '';
} else { } else {
throw new PHPExcel_Exception('Autofilter must be set on a range of cells.'); throw new \PHPExcel\Exception('Autofilter must be set on a range of cells.');
} }
if (empty($pRange)) { if (empty($pRange)) {
@ -126,9 +126,9 @@ class AutoFilter
$this->columns = array(); $this->columns = array();
} else { } else {
// Discard any column rules that are no longer valid within this range // Discard any column rules that are no longer valid within this range
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); list($rangeStart, $rangeEnd) = \PHPExcel\Cell::rangeBoundaries($this->range);
foreach ($this->columns as $key => $value) { foreach ($this->columns as $key => $value) {
$colIndex = PHPExcel_Cell::columnIndexFromString($key); $colIndex = \PHPExcel\Cell::columnIndexFromString($key);
if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
unset($this->columns[$key]); unset($this->columns[$key]);
} }
@ -141,8 +141,8 @@ class AutoFilter
/** /**
* Get all AutoFilter Columns * Get all AutoFilter Columns
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column * @return AutoFilter\Column[]
*/ */
public function getColumns() public function getColumns()
{ {
@ -153,19 +153,19 @@ class AutoFilter
* Validate that the specified column is in the AutoFilter range * Validate that the specified column is in the AutoFilter range
* *
* @param string $column Column name (e.g. A) * @param string $column Column name (e.g. A)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return integer The column offset within the autofilter range * @return integer The column offset within the autofilter range
*/ */
public function testColumnInRange($column) public function testColumnInRange($column)
{ {
if (empty($this->range)) { if (empty($this->range)) {
throw new PHPExcel_Exception("No autofilter range is defined."); throw new \PHPExcel\Exception("No autofilter range is defined.");
} }
$columnIndex = PHPExcel_Cell::columnIndexFromString($column); $columnIndex = \PHPExcel\Cell::columnIndexFromString($column);
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); list($rangeStart, $rangeEnd) = \PHPExcel\Cell::rangeBoundaries($this->range);
if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
throw new PHPExcel_Exception("Column is outside of current autofilter range."); throw new \PHPExcel\Exception("Column is outside of current autofilter range.");
} }
return $columnIndex - $rangeStart[0]; return $columnIndex - $rangeStart[0];
@ -175,7 +175,7 @@ class AutoFilter
* Get a specified AutoFilter Column Offset within the defined AutoFilter range * Get a specified AutoFilter Column Offset within the defined AutoFilter range
* *
* @param string $pColumn Column name (e.g. A) * @param string $pColumn Column name (e.g. A)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return integer The offset of the specified column within the autofilter range * @return integer The offset of the specified column within the autofilter range
*/ */
public function getColumnOffset($pColumn) public function getColumnOffset($pColumn)
@ -187,15 +187,15 @@ class AutoFilter
* Get a specified AutoFilter Column * Get a specified AutoFilter Column
* *
* @param string $pColumn Column name (e.g. A) * @param string $pColumn Column name (e.g. A)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return AutoFilter\Column
*/ */
public function getColumn($pColumn) public function getColumn($pColumn)
{ {
$this->testColumnInRange($pColumn); $this->testColumnInRange($pColumn);
if (!isset($this->columns[$pColumn])) { if (!isset($this->columns[$pColumn])) {
$this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); $this->columns[$pColumn] = new AutoFilter\Column($pColumn, $this);
} }
return $this->columns[$pColumn]; return $this->columns[$pColumn];
@ -205,13 +205,13 @@ class AutoFilter
* Get a specified AutoFilter Column by it's offset * Get a specified AutoFilter Column by it's offset
* *
* @param integer $pColumnOffset Column offset within range (starting from 0) * @param integer $pColumnOffset Column offset within range (starting from 0)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return AutoFilter\Column
*/ */
public function getColumnByOffset($pColumnOffset = 0) public function getColumnByOffset($pColumnOffset = 0)
{ {
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); list($rangeStart, $rangeEnd) = \PHPExcel\Cell::rangeBoundaries($this->range);
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); $pColumn = \PHPExcel\Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
return $this->getColumn($pColumn); return $this->getColumn($pColumn);
} }
@ -219,25 +219,25 @@ class AutoFilter
/** /**
* Set AutoFilter * Set AutoFilter
* *
* @param PHPExcel_Worksheet_AutoFilter_Column|string $pColumn * @param AutoFilter\Column|string $pColumn
* A simple string containing a Column ID like 'A' is permitted * A simple string containing a Column ID like 'A' is permitted
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function setColumn($pColumn) public function setColumn($pColumn)
{ {
if ((is_string($pColumn)) && (!empty($pColumn))) { if ((is_string($pColumn)) && (!empty($pColumn))) {
$column = $pColumn; $column = $pColumn;
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) { } elseif (is_object($pColumn) && ($pColumn instanceof AutoFilter\Column)) {
$column = $pColumn->getColumnIndex(); $column = $pColumn->getColumnIndex();
} else { } else {
throw new PHPExcel_Exception("Column is not within the autofilter range."); throw new \PHPExcel\Exception("Column is not within the autofilter range.");
} }
$this->testColumnInRange($column); $this->testColumnInRange($column);
if (is_string($pColumn)) { if (is_string($pColumn)) {
$this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); $this->columns[$pColumn] = new AutoFilter\Column($pColumn, $this);
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) { } elseif (is_object($pColumn) && ($pColumn instanceof AutoFilter\Column)) {
$pColumn->setParent($this); $pColumn->setParent($this);
$this->columns[$column] = $pColumn; $this->columns[$column] = $pColumn;
} }
@ -250,8 +250,8 @@ class AutoFilter
* Clear a specified AutoFilter Column * Clear a specified AutoFilter Column
* *
* @param string $pColumn Column name (e.g. A) * @param string $pColumn Column name (e.g. A)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function clearColumn($pColumn) public function clearColumn($pColumn)
{ {
@ -273,7 +273,7 @@ class AutoFilter
* *
* @param string $fromColumn Column name (e.g. A) * @param string $fromColumn Column name (e.g. A)
* @param string $toColumn Column name (e.g. B) * @param string $toColumn Column name (e.g. B)
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function shiftColumn($fromColumn = null, $toColumn = null) public function shiftColumn($fromColumn = null, $toColumn = null)
{ {
@ -327,7 +327,7 @@ class AutoFilter
} }
if (is_numeric($cellValue)) { if (is_numeric($cellValue)) {
$dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue); $dateValue = \PHPExcel\Shared\Date::ExcelToPHP($cellValue);
if ($cellValue < 1) { if ($cellValue < 1) {
// Just the time part // Just the time part
$dtVal = date('His', $dateValue); $dtVal = date('His', $dateValue);
@ -370,36 +370,36 @@ class AutoFilter
return false; return false;
} }
} }
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); $returnVal = ($join == AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
foreach ($dataSet as $rule) { foreach ($dataSet as $rule) {
if (is_numeric($rule['value'])) { if (is_numeric($rule['value'])) {
// Numeric values are tested using the appropriate operator // Numeric values are tested using the appropriate operator
switch ($rule['operator']) { switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
$retVal = ($cellValue == $rule['value']); $retVal = ($cellValue == $rule['value']);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
$retVal = ($cellValue != $rule['value']); $retVal = ($cellValue != $rule['value']);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN:
$retVal = ($cellValue > $rule['value']); $retVal = ($cellValue > $rule['value']);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL:
$retVal = ($cellValue >= $rule['value']); $retVal = ($cellValue >= $rule['value']);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN:
$retVal = ($cellValue < $rule['value']); $retVal = ($cellValue < $rule['value']);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL:
$retVal = ($cellValue <= $rule['value']); $retVal = ($cellValue <= $rule['value']);
break; break;
} }
} elseif ($rule['value'] == '') { } elseif ($rule['value'] == '') {
switch ($rule['operator']) { switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
$retVal = (($cellValue == '') || ($cellValue === null)); $retVal = (($cellValue == '') || ($cellValue === null));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL: case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
$retVal = (($cellValue != '') && ($cellValue !== null)); $retVal = (($cellValue != '') && ($cellValue !== null));
break; break;
default: default:
@ -412,7 +412,7 @@ class AutoFilter
} }
// If there are multiple conditions, then we need to test both using the appropriate join operator // If there are multiple conditions, then we need to test both using the appropriate join operator
switch ($join) { switch ($join) {
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR: case AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR:
$returnVal = $returnVal || $retVal; $returnVal = $returnVal || $retVal;
// Break as soon as we have a TRUE match for OR joins, // Break as soon as we have a TRUE match for OR joins,
// to avoid unnecessary additional code execution // to avoid unnecessary additional code execution
@ -420,7 +420,7 @@ class AutoFilter
return $returnVal; return $returnVal;
} }
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND: case AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND:
$returnVal = $returnVal && $retVal; $returnVal = $returnVal && $retVal;
break; break;
} }
@ -444,7 +444,7 @@ class AutoFilter
} }
if (is_numeric($cellValue)) { if (is_numeric($cellValue)) {
$dateValue = date('m', PHPExcel_Shared_Date::ExcelToPHP($cellValue)); $dateValue = date('m', \PHPExcel\Shared\Date::ExcelToPHP($cellValue));
if (in_array($dateValue, $monthSet)) { if (in_array($dateValue, $monthSet)) {
return true; return true;
} }
@ -466,95 +466,95 @@ class AutoFilter
* Convert a dynamic rule daterange to a custom filter range expression for ease of calculation * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation
* *
* @param string $dynamicRuleType * @param string $dynamicRuleType
* @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn * @param AutoFilter\Column &$filterColumn
* @return mixed[] * @return mixed[]
*/ */
private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn) private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn)
{ {
$rDateType = PHPExcel_Calculation_Functions::getReturnDateType(); $rDateType = \PHPExcel\Calculation\Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC);
$val = $maxVal = null; $val = $maxVal = null;
$ruleValues = array(); $ruleValues = array();
$baseDate = PHPExcel_Calculation_DateTime::DATENOW(); $baseDate = \PHPExcel\Calculation\DateTime::DATENOW();
// Calculate start/end dates for the required date range based on current date // Calculate start/end dates for the required date range based on current date
switch ($dynamicRuleType) { switch ($dynamicRuleType) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
$baseDate = strtotime('-7 days', $baseDate); $baseDate = strtotime('-7 days', $baseDate);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
$baseDate = strtotime('-7 days', $baseDate); $baseDate = strtotime('-7 days', $baseDate);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
$baseDate = strtotime('-1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('-1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
$baseDate = strtotime('+1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('+1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
$baseDate = strtotime('-3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('-3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
$baseDate = strtotime('+3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('+3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
$baseDate = strtotime('-1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('-1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
$baseDate = strtotime('+1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $baseDate = strtotime('+1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
} }
switch ($dynamicRuleType) { switch ($dynamicRuleType) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate)); $maxVal = (int) \PHPExcel\Shared\Date::PHPtoExcel(strtotime('+1 day', $baseDate));
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate); $val = (int) \PHPExcel\Shared\Date::PHPToExcel($baseDate);
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE:
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate)); $maxVal = (int) \PHPExcel\Shared\Date::PHPtoExcel(strtotime('+1 day', $baseDate));
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate))); $val = (int) \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
$maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate))); $maxVal = (int) \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate))); $val = (int) \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
$thisMonth = date('m', $baseDate); $thisMonth = date('m', $baseDate);
$thisQuarter = floor(--$thisMonth / 3); $thisQuarter = floor(--$thisMonth / 3);
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate))); $maxVal = (int) \PHPExcel\Shared\Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate))); $val = (int) \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate))); $maxVal = (int) \PHPExcel\Shared\Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate)));
++$maxVal; ++$maxVal;
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); $val = (int) \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
$dayOfWeek = date('w', $baseDate); $dayOfWeek = date('w', $baseDate);
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek; $val = (int) \PHPExcel\Shared\Date::PHPToExcel($baseDate) - $dayOfWeek;
$maxVal = $val + 7; $maxVal = $val + 7;
break; break;
} }
switch ($dynamicRuleType) { switch ($dynamicRuleType) {
// Adjust Today dates for Yesterday and Tomorrow // Adjust Today dates for Yesterday and Tomorrow
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
--$maxVal; --$maxVal;
--$val; --$val;
break; break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW: case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
++$maxVal; ++$maxVal;
++$val; ++$val;
break; break;
@ -564,20 +564,20 @@ class AutoFilter
$filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal)); $filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
// Set the rules for identifying rows for hide/show // Set the rules for identifying rows for hide/show
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val); $ruleValues[] = array('operator' => AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal); $ruleValues[] = array('operator' => AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
PHPExcel_Calculation_Functions::setReturnDateType($rDateType); \PHPExcel\Calculation\Functions::setReturnDateType($rDateType);
return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)); return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND));
} }
private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue)
{ {
$range = $columnID.$startRow.':'.$columnID.$endRow; $range = $columnID.$startRow.':'.$columnID.$endRow;
$dataValues = PHPExcel_Calculation_Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false)); $dataValues = \PHPExcel\Calculation\Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false));
$dataValues = array_filter($dataValues); $dataValues = array_filter($dataValues);
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { if ($ruleType == AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
rsort($dataValues); rsort($dataValues);
} else { } else {
sort($dataValues); sort($dataValues);
@ -589,12 +589,12 @@ class AutoFilter
/** /**
* Apply the AutoFilter rules to the AutoFilter Range * Apply the AutoFilter rules to the AutoFilter Range
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter * @return AutoFilter
*/ */
public function showHideRows() public function showHideRows()
{ {
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); list($rangeStart, $rangeEnd) = \PHPExcel\Cell::rangeBoundaries($this->range);
// The heading row should always be visible // The heading row should always be visible
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL; // echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
@ -604,7 +604,7 @@ class AutoFilter
foreach ($this->columns as $columnID => $filterColumn) { foreach ($this->columns as $columnID => $filterColumn) {
$rules = $filterColumn->getRules(); $rules = $filterColumn->getRules();
switch ($filterColumn->getFilterType()) { switch ($filterColumn->getFilterType()) {
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER: case AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER:
$ruleValues = array(); $ruleValues = array();
// Build a list of the filter value selections // Build a list of the filter value selections
foreach ($rules as $rule) { foreach ($rules as $rule) {
@ -617,7 +617,7 @@ class AutoFilter
if (count($ruleValues) != count($ruleDataSet)) { if (count($ruleValues) != count($ruleDataSet)) {
$blanks = true; $blanks = true;
} }
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) { if ($ruleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values // Filter on absolute values
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => 'filterTestInSimpleDataSet', 'method' => 'filterTestInSimpleDataSet',
@ -632,29 +632,29 @@ class AutoFilter
); );
foreach ($ruleDataSet as $ruleValue) { foreach ($ruleDataSet as $ruleValue) {
$date = $time = ''; $date = $time = '';
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) {
$date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]); $date .= sprintf('%04d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
} }
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) {
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]); $date .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
} }
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) {
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]); $date .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
} }
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) {
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]); $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
} }
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) {
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]); $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
} }
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) && if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) { ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) {
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]); $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
} }
$dateTime = $date . $time; $dateTime = $date . $time;
$arguments['date'][] = $date; $arguments['date'][] = $date;
@ -671,7 +671,7 @@ class AutoFilter
); );
} }
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER: case AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER:
$customRuleForBlanks = false; $customRuleForBlanks = false;
$ruleValues = array(); $ruleValues = array();
// Build a list of the filter value selections // Build a list of the filter value selections
@ -695,27 +695,27 @@ class AutoFilter
'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks) 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
); );
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER: case AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER:
$ruleValues = array(); $ruleValues = array();
foreach ($rules as $rule) { foreach ($rules as $rule) {
// We should only ever have one Dynamic Filter Rule anyway // We should only ever have one Dynamic Filter Rule anyway
$dynamicRuleType = $rule->getGrouping(); $dynamicRuleType = $rule->getGrouping();
if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) || if (($dynamicRuleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ||
($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) { ($dynamicRuleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) {
// Number (Average) based // Number (Average) based
// Calculate the average // Calculate the average
$averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')'; $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1')); $average = \PHPExcel\Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1'));
// Set above/below rule based on greaterThan or LessTan // Set above/below rule based on greaterThan or LessTan
$operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) $operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
$ruleValues[] = array('operator' => $operator, $ruleValues[] = array('operator' => $operator,
'value' => $average 'value' => $average
); );
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => 'filterTestInCustomDataSet', 'method' => 'filterTestInCustomDataSet',
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR) 'arguments' => array('filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR)
); );
} else { } else {
// Date based // Date based
@ -743,7 +743,7 @@ class AutoFilter
} }
} }
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER: case AutoFilter\Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER:
$ruleValues = array(); $ruleValues = array();
$dataRowCount = $rangeEnd[1] - $rangeStart[1]; $dataRowCount = $rangeEnd[1] - $rangeStart[1];
foreach ($rules as $rule) { foreach ($rules as $rule) {
@ -752,7 +752,7 @@ class AutoFilter
$ruleValue = $rule->getValue(); $ruleValue = $rule->getValue();
$ruleOperator = $rule->getOperator(); $ruleOperator = $rule->getOperator();
} }
if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) { if ($ruleOperator === AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) {
$ruleValue = floor($ruleValue * ($dataRowCount / 100)); $ruleValue = floor($ruleValue * ($dataRowCount / 100));
} }
if ($ruleValue < 1) { if ($ruleValue < 1) {
@ -764,13 +764,13 @@ class AutoFilter
$maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue); $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) $operator = ($toptenRuleType == AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
$ruleValues[] = array('operator' => $operator, 'value' => $maxVal); $ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => 'filterTestInCustomDataSet', 'method' => 'filterTestInCustomDataSet',
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR) 'arguments' => array('filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR)
); );
$filterColumn->setAttributes(array('maxVal' => $maxVal)); $filterColumn->setAttributes(array('maxVal' => $maxVal));
break; break;
@ -791,7 +791,7 @@ class AutoFilter
// Execute the filter test // Execute the filter test
$result = $result && $result = $result &&
call_user_func_array( call_user_func_array(
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']), array('\\PHPExcel\\Worksheet\\AutoFilter', $columnFilterTest['method']),
array($cellValue, $columnFilterTest['arguments']) array($cellValue, $columnFilterTest['arguments'])
); );
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL; // echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
@ -824,7 +824,7 @@ class AutoFilter
$this->{$key} = clone $value; $this->{$key} = clone $value;
} }
} elseif ((is_array($value)) && ($key == 'columns')) { } elseif ((is_array($value)) && ($key == 'columns')) {
// The columns array of PHPExcel_Worksheet_AutoFilter objects // The columns array of \PHPExcel\Worksheet\AutoFilter objects
$this->{$key} = array(); $this->{$key} = array();
foreach ($value as $k => $v) { foreach ($value as $k => $v) {
$this->{$key}[$k] = clone $v; $this->{$key}[$k] = clone $v;

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Worksheet\AutoFilter;
/** /**
* PHPExcel_Worksheet_AutoFilter_Column * PHPExcel_Worksheet_AutoFilter_Column
* *
@ -25,7 +27,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_AutoFilter_Column class Column
{ {
const AUTOFILTER_FILTERTYPE_FILTER = 'filters'; const AUTOFILTER_FILTERTYPE_FILTER = 'filters';
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters'; const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters';
@ -69,7 +71,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Autofilter * Autofilter
* *
* @var PHPExcel_Worksheet_AutoFilter * @var \PHPExcel\Worksheet\AutoFilter
*/ */
private $parent; private $parent;
@ -101,7 +103,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Autofilter Column Rules * Autofilter Column Rules
* *
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule * @var array of Column\Rule
*/ */
private $ruleset = array(); private $ruleset = array();
@ -115,12 +117,12 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Create a new PHPExcel_Worksheet_AutoFilter_Column * Create a new Column
* *
* @param string $pColumn Column (e.g. A) * @param string $pColumn Column (e.g. A)
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column * @param \PHPExcel\Worksheet\AutoFilter $pParent Autofilter for this column
*/ */
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = null) public function __construct($pColumn, \PHPExcel\Worksheet\AutoFilter $pParent = null)
{ {
$this->columnIndex = $pColumn; $this->columnIndex = $pColumn;
$this->parent = $pParent; $this->parent = $pParent;
@ -140,8 +142,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* Set AutoFilter Column Index * Set AutoFilter Column Index
* *
* @param string $pColumn Column (e.g. A) * @param string $pColumn Column (e.g. A)
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setColumnIndex($pColumn) public function setColumnIndex($pColumn)
{ {
@ -159,7 +161,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Get this Column's AutoFilter Parent * Get this Column's AutoFilter Parent
* *
* @return PHPExcel_Worksheet_AutoFilter * @return \PHPExcel\Worksheet\AutoFilter
*/ */
public function getParent() public function getParent()
{ {
@ -169,10 +171,10 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Set this Column's AutoFilter Parent * Set this Column's AutoFilter Parent
* *
* @param PHPExcel_Worksheet_AutoFilter * @param \PHPExcel\Worksheet\AutoFilter
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null) public function setParent(\PHPExcel\Worksheet\AutoFilter $pParent = null)
{ {
$this->parent = $pParent; $this->parent = $pParent;
@ -193,13 +195,13 @@ class PHPExcel_Worksheet_AutoFilter_Column
* Set AutoFilter Type * Set AutoFilter Type
* *
* @param string $pFilterType * @param string $pFilterType
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
{ {
if (!in_array($pFilterType, self::$filterTypes)) { if (!in_array($pFilterType, self::$filterTypes)) {
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.'); throw new \PHPExcel\Exception('Invalid filter type for column AutoFilter.');
} }
$this->filterType = $pFilterType; $this->filterType = $pFilterType;
@ -221,15 +223,15 @@ class PHPExcel_Worksheet_AutoFilter_Column
* Set AutoFilter Multiple Rules And/Or * Set AutoFilter Multiple Rules And/Or
* *
* @param string $pJoin And/Or * @param string $pJoin And/Or
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
{ {
// Lowercase And/Or // Lowercase And/Or
$pJoin = strtolower($pJoin); $pJoin = strtolower($pJoin);
if (!in_array($pJoin, self::$ruleJoins)) { if (!in_array($pJoin, self::$ruleJoins)) {
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.'); throw new \PHPExcel\Exception('Invalid rule connection for column AutoFilter.');
} }
$this->join = $pJoin; $this->join = $pJoin;
@ -241,8 +243,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* Set AutoFilter Attributes * Set AutoFilter Attributes
* *
* @param string[] $pAttributes * @param string[] $pAttributes
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setAttributes($pAttributes = array()) public function setAttributes($pAttributes = array())
{ {
@ -256,8 +258,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* *
* @param string $pName Attribute Name * @param string $pName Attribute Name
* @param string $pValue Attribute Value * @param string $pValue Attribute Value
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function setAttribute($pName, $pValue) public function setAttribute($pName, $pValue)
{ {
@ -293,8 +295,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Get all AutoFilter Column Rules * Get all AutoFilter Column Rules
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Column\Rule[]
*/ */
public function getRules() public function getRules()
{ {
@ -305,12 +307,12 @@ class PHPExcel_Worksheet_AutoFilter_Column
* Get a specified AutoFilter Column Rule * Get a specified AutoFilter Column Rule
* *
* @param integer $pIndex Rule index in the ruleset array * @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Column\Rule
*/ */
public function getRule($pIndex) public function getRule($pIndex)
{ {
if (!isset($this->ruleset[$pIndex])) { if (!isset($this->ruleset[$pIndex])) {
$this->ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); $this->ruleset[$pIndex] = new Column\Rule($this);
} }
return $this->ruleset[$pIndex]; return $this->ruleset[$pIndex];
} }
@ -318,11 +320,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Create a new AutoFilter Column Rule in the ruleset * Create a new AutoFilter Column Rule in the ruleset
* *
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Column\Rule
*/ */
public function createRule() public function createRule()
{ {
$this->ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); $this->ruleset[] = new Column\Rule($this);
return end($this->ruleset); return end($this->ruleset);
} }
@ -330,11 +332,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Add a new AutoFilter Column Rule to the ruleset * Add a new AutoFilter Column Rule to the ruleset
* *
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule * @param Column\Rule $pRule
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned * @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Column|Column\Rule
*/ */
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true) public function addRule(Column\Rule $pRule, $returnRule = true)
{ {
$pRule->setParent($this); $pRule->setParent($this);
$this->ruleset[] = $pRule; $this->ruleset[] = $pRule;
@ -347,7 +349,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
* If the number of rules is reduced to 1, then we reset And/Or logic to Or * If the number of rules is reduced to 1, then we reset And/Or logic to Or
* *
* @param integer $pIndex Rule index in the ruleset array * @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function deleteRule($pIndex) public function deleteRule($pIndex)
{ {
@ -365,7 +367,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
/** /**
* Delete all AutoFilter Column Rules * Delete all AutoFilter Column Rules
* *
* @return PHPExcel_Worksheet_AutoFilter_Column * @return Column
*/ */
public function clearRules() public function clearRules()
{ {
@ -390,7 +392,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
$this->$key = clone $value; $this->$key = clone $value;
} }
} elseif ((is_array($value)) && ($key == 'ruleset')) { } elseif ((is_array($value)) && ($key == 'ruleset')) {
// The columns array of PHPExcel_Worksheet_AutoFilter objects // The columns array of \PHPExcel\Worksheet\AutoFilter objects
$this->$key = array(); $this->$key = array();
foreach ($value as $k => $v) { foreach ($value as $k => $v) {
$this->$key[$k] = clone $v; $this->$key[$k] = clone $v;

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Worksheet\AutoFilter\Column;
/** /**
* PHPExcel_Worksheet_AutoFilter_Column_Rule * PHPExcel_Worksheet_AutoFilter_Column_Rule
* *
@ -25,7 +27,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_AutoFilter_Column_Rule class Rule
{ {
const AUTOFILTER_RULETYPE_FILTER = 'filter'; const AUTOFILTER_RULETYPE_FILTER = 'filter';
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem'; const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem';
@ -224,7 +226,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/** /**
* Autofilter Column * Autofilter Column
* *
* @var PHPExcel_Worksheet_AutoFilter_Column * @var \PHPExcel\Worksheet\AutoFilter\Column
*/ */
private $parent = null; private $parent = null;
@ -260,11 +262,11 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/** /**
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule * Create a new Rule
* *
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent * @param \PHPExcel\Worksheet\AutoFilter\Column $pParent
*/ */
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null) public function __construct(\PHPExcel\Worksheet\AutoFilter\Column $pParent = null)
{ {
$this->parent = $pParent; $this->parent = $pParent;
} }
@ -283,13 +285,13 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* Set AutoFilter Rule Type * Set AutoFilter Rule Type
* *
* @param string $pRuleType * @param string $pRuleType
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return \PHPExcel\Worksheet\AutoFilter\Column
*/ */
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER)
{ {
if (!in_array($pRuleType, self::$ruleTypes)) { if (!in_array($pRuleType, self::$ruleTypes)) {
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); throw new \PHPExcel\Exception('Invalid rule type for column AutoFilter Rule.');
} }
$this->ruleType = $pRuleType; $this->ruleType = $pRuleType;
@ -311,8 +313,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* Set AutoFilter Rule Value * Set AutoFilter Rule Value
* *
* @param string|string[] $pValue * @param string|string[] $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Rule
*/ */
public function setValue($pValue = '') public function setValue($pValue = '')
{ {
@ -329,7 +331,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
} }
} }
if (count($pValue) == 0) { if (count($pValue) == 0) {
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.'); throw new \PHPExcel\Exception('Invalid rule value for column AutoFilter Rule.');
} }
// Set the dateTime grouping that we've anticipated // Set the dateTime grouping that we've anticipated
$this->setGrouping(self::$dateTimeGroups[$grouping]); $this->setGrouping(self::$dateTimeGroups[$grouping]);
@ -353,8 +355,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* Set AutoFilter Rule Operator * Set AutoFilter Rule Operator
* *
* @param string $pOperator * @param string $pOperator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Rule
*/ */
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL)
{ {
@ -363,7 +365,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
} }
if ((!in_array($pOperator, self::$operators)) && if ((!in_array($pOperator, self::$operators)) &&
(!in_array($pOperator, self::$topTenValue))) { (!in_array($pOperator, self::$topTenValue))) {
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.'); throw new \PHPExcel\Exception('Invalid operator for column AutoFilter Rule.');
} }
$this->operator = $pOperator; $this->operator = $pOperator;
@ -384,8 +386,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* Set AutoFilter Rule Grouping * Set AutoFilter Rule Grouping
* *
* @param string $pGrouping * @param string $pGrouping
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Rule
*/ */
public function setGrouping($pGrouping = null) public function setGrouping($pGrouping = null)
{ {
@ -393,7 +395,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
(!in_array($pGrouping, self::$dateTimeGroups)) && (!in_array($pGrouping, self::$dateTimeGroups)) &&
(!in_array($pGrouping, self::$dynamicTypes)) && (!in_array($pGrouping, self::$dynamicTypes)) &&
(!in_array($pGrouping, self::$topTenType))) { (!in_array($pGrouping, self::$topTenType))) {
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); throw new \PHPExcel\Exception('Invalid rule type for column AutoFilter Rule.');
} }
$this->grouping = $pGrouping; $this->grouping = $pGrouping;
@ -406,8 +408,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @param string $pOperator * @param string $pOperator
* @param string|string[] $pValue * @param string|string[] $pValue
* @param string $pGrouping * @param string $pGrouping
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Rule
*/ */
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null) public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null)
{ {
@ -426,7 +428,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/** /**
* Get this Rule's AutoFilter Column Parent * Get this Rule's AutoFilter Column Parent
* *
* @return PHPExcel_Worksheet_AutoFilter_Column * @return \PHPExcel\Worksheet\AutoFilter\Column
*/ */
public function getParent() public function getParent()
{ {
@ -436,10 +438,10 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/** /**
* Set this Rule's AutoFilter Column Parent * Set this Rule's AutoFilter Column Parent
* *
* @param PHPExcel_Worksheet_AutoFilter_Column * @param \PHPExcel\Worksheet\AutoFilter\Column
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule * @return Rule
*/ */
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null) public function setParent(\PHPExcel\Worksheet\AutoFilter\Column $pParent = null)
{ {
$this->parent = $pParent; $this->parent = $pParent;

View File

@ -60,7 +60,7 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Worksheet * Worksheet
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
protected $worksheet; protected $worksheet;
@ -116,12 +116,12 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Shadow * Shadow
* *
* @var PHPExcel_Worksheet_Drawing_Shadow * @var Drawing\Shadow
*/ */
protected $shadow; protected $shadow;
/** /**
* Create a new PHPExcel_Worksheet_BaseDrawing * Create a new BaseDrawing
*/ */
public function __construct() public function __construct()
{ {
@ -136,7 +136,7 @@ class BaseDrawing implements \PHPExcel\IComparable
$this->height = 0; $this->height = 0;
$this->resizeProportional = true; $this->resizeProportional = true;
$this->rotation = 0; $this->rotation = 0;
$this->shadow = new PHPExcel_Worksheet_Drawing_Shadow(); $this->shadow = new Drawing\Shadow();
// Set image index // Set image index
self::$imageCounter++; self::$imageCounter++;
@ -167,7 +167,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Name * Set Name
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setName($pValue = '') public function setName($pValue = '')
{ {
@ -189,7 +189,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Description * Set Description
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setDescription($pValue = '') public function setDescription($pValue = '')
{ {
@ -200,7 +200,7 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Get Worksheet * Get Worksheet
* *
* @return PHPExcel_Worksheet * @return \PHPExcel\Worksheet
*/ */
public function getWorksheet() public function getWorksheet()
{ {
@ -210,21 +210,21 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Set Worksheet * Set Worksheet
* *
* @param PHPExcel_Worksheet $pValue * @param \PHPExcel\Worksheet $pValue
* @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? * @param boolean $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) public function setWorksheet(\PHPExcel\Worksheet $pValue = null, $pOverrideOld = false)
{ {
if (is_null($this->worksheet)) { if (is_null($this->worksheet)) {
// Add drawing to PHPExcel_Worksheet // Add drawing to \PHPExcel\Worksheet
$this->worksheet = $pValue; $this->worksheet = $pValue;
$this->worksheet->getCell($this->coordinates); $this->worksheet->getCell($this->coordinates);
$this->worksheet->getDrawingCollection()->append($this); $this->worksheet->getDrawingCollection()->append($this);
} else { } else {
if ($pOverrideOld) { if ($pOverrideOld) {
// Remove drawing from old PHPExcel_Worksheet // Remove drawing from old \PHPExcel\Worksheet
$iterator = $this->worksheet->getDrawingCollection()->getIterator(); $iterator = $this->worksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) { while ($iterator->valid()) {
@ -235,10 +235,10 @@ class BaseDrawing implements \PHPExcel\IComparable
} }
} }
// Set new PHPExcel_Worksheet // Set new \PHPExcel\Worksheet
$this->setWorksheet($pValue); $this->setWorksheet($pValue);
} else { } else {
throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); throw new \PHPExcel\Exception("A \PHPExcel\Worksheet has already been assigned. Drawings can only exist on one \PHPExcel\Worksheet.");
} }
} }
return $this; return $this;
@ -258,7 +258,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Coordinates * Set Coordinates
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setCoordinates($pValue = 'A1') public function setCoordinates($pValue = 'A1')
{ {
@ -280,7 +280,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set OffsetX * Set OffsetX
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setOffsetX($pValue = 0) public function setOffsetX($pValue = 0)
{ {
@ -302,7 +302,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set OffsetY * Set OffsetY
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setOffsetY($pValue = 0) public function setOffsetY($pValue = 0)
{ {
@ -324,7 +324,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Width * Set Width
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setWidth($pValue = 0) public function setWidth($pValue = 0)
{ {
@ -354,7 +354,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Height * Set Height
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setHeight($pValue = 0) public function setHeight($pValue = 0)
{ {
@ -381,7 +381,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* @author Vincent@luo MSN:kele_100@hotmail.com * @author Vincent@luo MSN:kele_100@hotmail.com
* @param int $width * @param int $width
* @param int $height * @param int $height
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setWidthAndHeight($width = 0, $height = 0) public function setWidthAndHeight($width = 0, $height = 0)
{ {
@ -417,7 +417,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set ResizeProportional * Set ResizeProportional
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setResizeProportional($pValue = true) public function setResizeProportional($pValue = true)
{ {
@ -439,7 +439,7 @@ class BaseDrawing implements \PHPExcel\IComparable
* Set Rotation * Set Rotation
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setRotation($pValue = 0) public function setRotation($pValue = 0)
{ {
@ -450,7 +450,7 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Get Shadow * Get Shadow
* *
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Drawing\Shadow
*/ */
public function getShadow() public function getShadow()
{ {
@ -460,11 +460,11 @@ class BaseDrawing implements \PHPExcel\IComparable
/** /**
* Set Shadow * Set Shadow
* *
* @param PHPExcel_Worksheet_Drawing_Shadow $pValue * @param Drawing\Shadow $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_BaseDrawing * @return BaseDrawing
*/ */
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) public function setShadow(Drawing\Shadow $pValue = null)
{ {
$this->shadow = $pValue; $this->shadow = $pValue;
return $this; return $this;

View File

@ -30,9 +30,9 @@ namespace PHPExcel\Worksheet;
abstract class CellIterator abstract class CellIterator
{ {
/** /**
* PHPExcel_Worksheet to iterate * \PHPExcel\Worksheet to iterate
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
protected $subject; protected $subject;
@ -71,7 +71,7 @@ abstract class CellIterator
/** /**
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
abstract protected function adjustForExistingOnlyRange(); abstract protected function adjustForExistingOnlyRange();
@ -79,7 +79,7 @@ abstract class CellIterator
* Set the iterator to loop only existing cells * Set the iterator to loop only existing cells
* *
* @param boolean $value * @param boolean $value
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function setIterateOnlyExistingCells($value = true) public function setIterateOnlyExistingCells($value = true)
{ {

View File

@ -30,9 +30,9 @@ namespace PHPExcel\Worksheet;
class Column class Column
{ {
/** /**
* PHPExcel_Worksheet * \PHPExcel\Worksheet
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
private $parent; private $parent;
@ -46,10 +46,10 @@ class Column
/** /**
* Create a new column * Create a new column
* *
* @param PHPExcel_Worksheet $parent * @param \PHPExcel\Worksheet $parent
* @param string $columnIndex * @param string $columnIndex
*/ */
public function __construct(PHPExcel_Worksheet $parent = null, $columnIndex = 'A') public function __construct(\PHPExcel\Worksheet $parent = null, $columnIndex = 'A')
{ {
// Set parent and column index // Set parent and column index
$this->parent = $parent; $this->parent = $parent;
@ -79,10 +79,10 @@ class Column
* *
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @param integer $endRow Optionally, the row number at which to stop iterating * @param integer $endRow Optionally, the row number at which to stop iterating
* @return PHPExcel_Worksheet_CellIterator * @return ColumnCellIterator
*/ */
public function getCellIterator($startRow = 1, $endRow = null) public function getCellIterator($startRow = 1, $endRow = null)
{ {
return new PHPExcel_Worksheet_ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow); return new ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow);
} }
} }

View File

@ -53,16 +53,16 @@ class ColumnCellIterator extends CellIterator implements \Iterator
/** /**
* Create a new row iterator * Create a new row iterator
* *
* @param PHPExcel_Worksheet $subject The worksheet to iterate over * @param \PHPExcel\Worksheet $subject The worksheet to iterate over
* @param string $columnIndex The column that we want to iterate * @param string $columnIndex The column that we want to iterate
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @param integer $endRow Optionally, the row number at which to stop iterating * @param integer $endRow Optionally, the row number at which to stop iterating
*/ */
public function __construct(PHPExcel_Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null) public function __construct(\PHPExcel\Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null)
{ {
// Set subject // Set subject
$this->subject = $subject; $this->subject = $subject;
$this->columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1; $this->columnIndex = \PHPExcel\Cell::columnIndexFromString($columnIndex) - 1;
$this->resetEnd($endRow); $this->resetEnd($endRow);
$this->resetStart($startRow); $this->resetStart($startRow);
} }
@ -79,8 +79,8 @@ class ColumnCellIterator extends CellIterator implements \Iterator
* (Re)Set the start row and the current row pointer * (Re)Set the start row and the current row pointer
* *
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @return PHPExcel_Worksheet_ColumnCellIterator * @return ColumnCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function resetStart($startRow = 1) public function resetStart($startRow = 1)
{ {
@ -95,8 +95,8 @@ class ColumnCellIterator extends CellIterator implements \Iterator
* (Re)Set the end row * (Re)Set the end row
* *
* @param integer $endRow The row number at which to stop iterating * @param integer $endRow The row number at which to stop iterating
* @return PHPExcel_Worksheet_ColumnCellIterator * @return ColumnCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function resetEnd($endRow = null) public function resetEnd($endRow = null)
{ {
@ -110,15 +110,15 @@ class ColumnCellIterator extends CellIterator implements \Iterator
* Set the row pointer to the selected row * Set the row pointer to the selected row
* *
* @param integer $row The row number to set the current pointer at * @param integer $row The row number to set the current pointer at
* @return PHPExcel_Worksheet_ColumnCellIterator * @return ColumnCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function seek($row = 1) public function seek($row = 1)
{ {
if (($row < $this->startRow) || ($row > $this->endRow)) { if (($row < $this->startRow) || ($row > $this->endRow)) {
throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})"); throw new \PHPExcel\Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) { } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) {
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist'); throw new \PHPExcel\Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
} }
$this->position = $row; $this->position = $row;
@ -136,7 +136,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator
/** /**
* Return the current cell in this worksheet column * Return the current cell in this worksheet column
* *
* @return PHPExcel_Worksheet_Row * @return Row
*/ */
public function current() public function current()
{ {
@ -171,7 +171,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator
public function prev() public function prev()
{ {
if ($this->position <= $this->startRow) { if ($this->position <= $this->startRow) {
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})"); throw new \PHPExcel\Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
} }
do { do {
@ -194,7 +194,7 @@ class ColumnCellIterator extends CellIterator implements \Iterator
/** /**
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
protected function adjustForExistingOnlyRange() protected function adjustForExistingOnlyRange()
{ {
@ -204,14 +204,14 @@ class ColumnCellIterator extends CellIterator implements \Iterator
++$this->startRow; ++$this->startRow;
} }
if ($this->startRow > $this->endRow) { if ($this->startRow > $this->endRow) {
throw new PHPExcel_Exception('No cells exist within the specified range'); throw new \PHPExcel\Exception('No cells exist within the specified range');
} }
while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) && while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) &&
($this->endRow >= $this->startRow)) { ($this->endRow >= $this->startRow)) {
--$this->endRow; --$this->endRow;
} }
if ($this->endRow < $this->startRow) { if ($this->endRow < $this->startRow) {
throw new PHPExcel_Exception('No cells exist within the specified range'); throw new \PHPExcel\Exception('No cells exist within the specified range');
} }
} }
} }

View File

@ -53,7 +53,7 @@ class ColumnDimension extends Dimension
private $autoSize = false; private $autoSize = false;
/** /**
* Create a new PHPExcel_Worksheet_ColumnDimension * Create a new ColumnDimension
* *
* @param string $pIndex Character column index * @param string $pIndex Character column index
*/ */
@ -80,7 +80,7 @@ class ColumnDimension extends Dimension
* Set ColumnIndex * Set ColumnIndex
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_ColumnDimension * @return ColumnDimension
*/ */
public function setColumnIndex($pValue) public function setColumnIndex($pValue)
{ {
@ -102,7 +102,7 @@ class ColumnDimension extends Dimension
* Set Width * Set Width
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_ColumnDimension * @return ColumnDimension
*/ */
public function setWidth($pValue = -1) public function setWidth($pValue = -1)
{ {
@ -124,7 +124,7 @@ class ColumnDimension extends Dimension
* Set Auto Size * Set Auto Size
* *
* @param bool $pValue * @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension * @return ColumnDimension
*/ */
public function setAutoSize($pValue = false) public function setAutoSize($pValue = false)
{ {

View File

@ -30,9 +30,9 @@ namespace PHPExcel\Worksheet;
class ColumnIterator implements \Iterator class ColumnIterator implements \Iterator
{ {
/** /**
* PHPExcel_Worksheet to iterate * \PHPExcel\Worksheet to iterate
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
private $subject; private $subject;
@ -62,11 +62,11 @@ class ColumnIterator implements \Iterator
/** /**
* Create a new column iterator * Create a new column iterator
* *
* @param PHPExcel_Worksheet $subject The worksheet to iterate over * @param \PHPExcel\Worksheet $subject The worksheet to iterate over
* @param string $startColumn The column address at which to start iterating * @param string $startColumn The column address at which to start iterating
* @param string $endColumn Optionally, the column address at which to stop iterating * @param string $endColumn Optionally, the column address at which to stop iterating
*/ */
public function __construct(PHPExcel_Worksheet $subject = null, $startColumn = 'A', $endColumn = null) public function __construct(\PHPExcel\Worksheet $subject = null, $startColumn = 'A', $endColumn = null)
{ {
// Set subject // Set subject
$this->subject = $subject; $this->subject = $subject;
@ -86,11 +86,11 @@ class ColumnIterator implements \Iterator
* (Re)Set the start column and the current column pointer * (Re)Set the start column and the current column pointer
* *
* @param integer $startColumn The column address at which to start iterating * @param integer $startColumn The column address at which to start iterating
* @return PHPExcel_Worksheet_ColumnIterator * @return ColumnIterator
*/ */
public function resetStart($startColumn = 'A') public function resetStart($startColumn = 'A')
{ {
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; $startColumnIndex = \PHPExcel\Cell::columnIndexFromString($startColumn) - 1;
$this->startColumn = $startColumnIndex; $this->startColumn = $startColumnIndex;
$this->seek($startColumn); $this->seek($startColumn);
@ -101,12 +101,12 @@ class ColumnIterator implements \Iterator
* (Re)Set the end column * (Re)Set the end column
* *
* @param string $endColumn The column address at which to stop iterating * @param string $endColumn The column address at which to stop iterating
* @return PHPExcel_Worksheet_ColumnIterator * @return ColumnIterator
*/ */
public function resetEnd($endColumn = null) public function resetEnd($endColumn = null)
{ {
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn(); $endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; $this->endColumn = \PHPExcel\Cell::columnIndexFromString($endColumn) - 1;
return $this; return $this;
} }
@ -115,14 +115,14 @@ class ColumnIterator implements \Iterator
* Set the column pointer to the selected column * Set the column pointer to the selected column
* *
* @param string $column The column address to set the current pointer at * @param string $column The column address to set the current pointer at
* @return PHPExcel_Worksheet_ColumnIterator * @return ColumnIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function seek($column = 'A') public function seek($column = 'A')
{ {
$column = PHPExcel_Cell::columnIndexFromString($column) - 1; $column = \PHPExcel\Cell::columnIndexFromString($column) - 1;
if (($column < $this->startColumn) || ($column > $this->endColumn)) { if (($column < $this->startColumn) || ($column > $this->endColumn)) {
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})"); throw new \PHPExcel\Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
} }
$this->position = $column; $this->position = $column;
@ -140,11 +140,11 @@ class ColumnIterator implements \Iterator
/** /**
* Return the current column in this worksheet * Return the current column in this worksheet
* *
* @return PHPExcel_Worksheet_Column * @return Column
*/ */
public function current() public function current()
{ {
return new PHPExcel_Worksheet_Column($this->subject, PHPExcel_Cell::stringFromColumnIndex($this->position)); return new Column($this->subject, \PHPExcel\Cell::stringFromColumnIndex($this->position));
} }
/** /**
@ -154,7 +154,7 @@ class ColumnIterator implements \Iterator
*/ */
public function key() public function key()
{ {
return PHPExcel_Cell::stringFromColumnIndex($this->position); return \PHPExcel\Cell::stringFromColumnIndex($this->position);
} }
/** /**
@ -168,15 +168,15 @@ class ColumnIterator implements \Iterator
/** /**
* Set the iterator to its previous value * Set the iterator to its previous value
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function prev() public function prev()
{ {
if ($this->position <= $this->startColumn) { if ($this->position <= $this->startColumn) {
throw new PHPExcel_Exception( throw new \PHPExcel\Exception(
"Column is already at the beginning of range (" . "Column is already at the beginning of range (" .
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " . \PHPExcel\Cell::stringFromColumnIndex($this->endColumn) . " - " .
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")" \PHPExcel\Cell::stringFromColumnIndex($this->endColumn) . ")"
); );
} }

View File

@ -58,7 +58,7 @@ abstract class Dimension
private $xfIndex; private $xfIndex;
/** /**
* Create a new PHPExcel_Worksheet_Dimension * Create a new Dimension
* *
* @param int $pIndex Numeric row index * @param int $pIndex Numeric row index
*/ */
@ -82,7 +82,7 @@ abstract class Dimension
* Set Visible * Set Visible
* *
* @param bool $pValue * @param bool $pValue
* @return PHPExcel_Worksheet_Dimension * @return Dimension
*/ */
public function setVisible($pValue = true) public function setVisible($pValue = true)
{ {
@ -105,14 +105,14 @@ abstract class Dimension
* *
* Value must be between 0 and 7 * Value must be between 0 and 7
* *
* @param int $pValue * @param integer $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_Dimension * @return Dimension
*/ */
public function setOutlineLevel($pValue) public function setOutlineLevel($pValue)
{ {
if ($pValue < 0 || $pValue > 7) { if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7."); throw new \PHPExcel\Exception("Outline level must range between 0 and 7.");
} }
$this->outlineLevel = $pValue; $this->outlineLevel = $pValue;
@ -132,8 +132,8 @@ abstract class Dimension
/** /**
* Set Collapsed * Set Collapsed
* *
* @param bool $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Dimension * @return Dimension
*/ */
public function setCollapsed($pValue = true) public function setCollapsed($pValue = true)
{ {
@ -154,8 +154,8 @@ abstract class Dimension
/** /**
* Set index to cellXf * Set index to cellXf
* *
* @param int $pValue * @param integer $pValue
* @return PHPExcel_Worksheet_Dimension * @return Dimension
*/ */
public function setXfIndex($pValue = 0) public function setXfIndex($pValue = 0)
{ {

View File

@ -37,7 +37,7 @@ class Drawing extends BaseDrawing implements \PHPExcel\IComparable
private $path; private $path;
/** /**
* Create a new PHPExcel_Worksheet_Drawing * Create a new Drawing
*/ */
public function __construct() public function __construct()
{ {
@ -96,8 +96,8 @@ class Drawing extends BaseDrawing implements \PHPExcel\IComparable
* *
* @param string $pValue File path * @param string $pValue File path
* @param boolean $pVerifyFile Verify file * @param boolean $pVerifyFile Verify file
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_Drawing * @return Drawing
*/ */
public function setPath($pValue = '', $pVerifyFile = true) public function setPath($pValue = '', $pVerifyFile = true)
{ {
@ -110,7 +110,7 @@ class Drawing extends BaseDrawing implements \PHPExcel\IComparable
list($this->width, $this->height) = getimagesize($pValue); list($this->width, $this->height) = getimagesize($pValue);
} }
} else { } else {
throw new PHPExcel_Exception("File $pValue not found!"); throw new \PHPExcel\Exception("File $pValue not found!");
} }
} else { } else {
$this->path = $pValue; $this->path = $pValue;

View File

@ -1,5 +1,7 @@
<?php <?php
namespace PHPExcel\Worksheet\Drawing;
/** /**
* PHPExcel_Worksheet_Drawing_Shadow * PHPExcel_Worksheet_Drawing_Shadow
* *
@ -25,7 +27,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable class Shadow implements \PHPExcel\IComparable
{ {
/* Shadow alignment */ /* Shadow alignment */
const SHADOW_BOTTOM = 'b'; const SHADOW_BOTTOM = 'b';
@ -79,7 +81,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/** /**
* Color * Color
* *
* @var PHPExcel_Style_Color * @var \PHPExcel\Style\Color
*/ */
private $color; private $color;
@ -91,7 +93,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
private $alpha; private $alpha;
/** /**
* Create a new PHPExcel_Worksheet_Drawing_Shadow * Create a new Shadow
*/ */
public function __construct() public function __construct()
{ {
@ -100,8 +102,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
$this->blurRadius = 6; $this->blurRadius = 6;
$this->distance = 2; $this->distance = 2;
$this->direction = 0; $this->direction = 0;
$this->alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; $this->alignment = self::SHADOW_BOTTOM_RIGHT;
$this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); $this->color = new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_BLACK);
$this->alpha = 50; $this->alpha = 50;
} }
@ -119,7 +121,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Visible * Set Visible
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setVisible($pValue = false) public function setVisible($pValue = false)
{ {
@ -141,7 +143,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Blur radius * Set Blur radius
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setBlurRadius($pValue = 6) public function setBlurRadius($pValue = 6)
{ {
@ -163,7 +165,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Shadow distance * Set Shadow distance
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setDistance($pValue = 2) public function setDistance($pValue = 2)
{ {
@ -185,7 +187,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Shadow direction (in degrees) * Set Shadow direction (in degrees)
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setDirection($pValue = 0) public function setDirection($pValue = 0)
{ {
@ -207,7 +209,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Shadow alignment * Set Shadow alignment
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setAlignment($pValue = 0) public function setAlignment($pValue = 0)
{ {
@ -218,7 +220,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/** /**
* Get Color * Get Color
* *
* @return PHPExcel_Style_Color * @return \PHPExcel\Style\Color
*/ */
public function getColor() public function getColor()
{ {
@ -228,11 +230,11 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/** /**
* Set Color * Set Color
* *
* @param PHPExcel_Style_Color $pValue * @param \PHPExcel\Style_Color $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setColor(PHPExcel_Style_Color $pValue = null) public function setColor(\PHPExcel\Style\Color $pValue = null)
{ {
$this->color = $pValue; $this->color = $pValue;
return $this; return $this;
@ -252,7 +254,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* Set Alpha * Set Alpha
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return Shadow
*/ */
public function setAlpha($pValue = 0) public function setAlpha($pValue = 0)
{ {

View File

@ -171,12 +171,12 @@ class HeaderFooter
/** /**
* Header/footer images * Header/footer images
* *
* @var PHPExcel_Worksheet_HeaderFooterDrawing[] * @var HeaderFooterDrawing[]
*/ */
private $headerFooterImages = array(); private $headerFooterImages = array();
/** /**
* Create a new PHPExcel_Worksheet_HeaderFooter * Create a new HeaderFooter
*/ */
public function __construct() public function __construct()
{ {
@ -196,7 +196,7 @@ class HeaderFooter
* Set OddHeader * Set OddHeader
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setOddHeader($pValue) public function setOddHeader($pValue)
{ {
@ -218,7 +218,7 @@ class HeaderFooter
* Set OddFooter * Set OddFooter
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setOddFooter($pValue) public function setOddFooter($pValue)
{ {
@ -240,7 +240,7 @@ class HeaderFooter
* Set EvenHeader * Set EvenHeader
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setEvenHeader($pValue) public function setEvenHeader($pValue)
{ {
@ -262,7 +262,7 @@ class HeaderFooter
* Set EvenFooter * Set EvenFooter
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setEvenFooter($pValue) public function setEvenFooter($pValue)
{ {
@ -284,7 +284,7 @@ class HeaderFooter
* Set FirstHeader * Set FirstHeader
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setFirstHeader($pValue) public function setFirstHeader($pValue)
{ {
@ -306,7 +306,7 @@ class HeaderFooter
* Set FirstFooter * Set FirstFooter
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setFirstFooter($pValue) public function setFirstFooter($pValue)
{ {
@ -328,7 +328,7 @@ class HeaderFooter
* Set DifferentOddEven * Set DifferentOddEven
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setDifferentOddEven($pValue = false) public function setDifferentOddEven($pValue = false)
{ {
@ -350,7 +350,7 @@ class HeaderFooter
* Set DifferentFirst * Set DifferentFirst
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setDifferentFirst($pValue = false) public function setDifferentFirst($pValue = false)
{ {
@ -372,7 +372,7 @@ class HeaderFooter
* Set ScaleWithDocument * Set ScaleWithDocument
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setScaleWithDocument($pValue = true) public function setScaleWithDocument($pValue = true)
{ {
@ -394,7 +394,7 @@ class HeaderFooter
* Set AlignWithMargins * Set AlignWithMargins
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setAlignWithMargins($pValue = true) public function setAlignWithMargins($pValue = true)
{ {
@ -405,12 +405,12 @@ class HeaderFooter
/** /**
* Add header/footer image * Add header/footer image
* *
* @param PHPExcel_Worksheet_HeaderFooterDrawing $image * @param HeaderFooterDrawing $image
* @param string $location * @param string $location
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) public function addImage(HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
{ {
$this->headerFooterImages[$location] = $image; $this->headerFooterImages[$location] = $image;
return $this; return $this;
@ -420,8 +420,8 @@ class HeaderFooter
* Remove header/footer image * Remove header/footer image
* *
* @param string $location * @param string $location
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function removeImage($location = self::IMAGE_HEADER_LEFT) public function removeImage($location = self::IMAGE_HEADER_LEFT)
{ {
@ -434,14 +434,14 @@ class HeaderFooter
/** /**
* Set header/footer images * Set header/footer images
* *
* @param PHPExcel_Worksheet_HeaderFooterDrawing[] $images * @param HeaderFooterDrawing[] $images
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setImages($images) public function setImages($images)
{ {
if (!is_array($images)) { if (!is_array($images)) {
throw new PHPExcel_Exception('Invalid parameter!'); throw new \PHPExcel\Exception('Invalid parameter!');
} }
$this->headerFooterImages = $images; $this->headerFooterImages = $images;
@ -451,7 +451,7 @@ class HeaderFooter
/** /**
* Get header/footer images * Get header/footer images
* *
* @return PHPExcel_Worksheet_HeaderFooterDrawing[] * @return HeaderFooterDrawing[]
*/ */
public function getImages() public function getImages()
{ {

View File

@ -79,7 +79,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
protected $resizeProportional; protected $resizeProportional;
/** /**
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing * Create a new HeaderFooterDrawing
*/ */
public function __construct() public function __construct()
{ {
@ -107,7 +107,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set Name * Set Name
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setName($pValue = '') public function setName($pValue = '')
{ {
@ -129,7 +129,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set OffsetX * Set OffsetX
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setOffsetX($pValue = 0) public function setOffsetX($pValue = 0)
{ {
@ -151,7 +151,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set OffsetY * Set OffsetY
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setOffsetY($pValue = 0) public function setOffsetY($pValue = 0)
{ {
@ -173,7 +173,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set Width * Set Width
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setWidth($pValue = 0) public function setWidth($pValue = 0)
{ {
@ -203,7 +203,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set Height * Set Height
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setHeight($pValue = 0) public function setHeight($pValue = 0)
{ {
@ -230,7 +230,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* @author Vincent@luo MSN:kele_100@hotmail.com * @author Vincent@luo MSN:kele_100@hotmail.com
* @param int $width * @param int $width
* @param int $height * @param int $height
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setWidthAndHeight($width = 0, $height = 0) public function setWidthAndHeight($width = 0, $height = 0)
{ {
@ -262,7 +262,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* Set ResizeProportional * Set ResizeProportional
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setResizeProportional($pValue = true) public function setResizeProportional($pValue = true)
{ {
@ -306,8 +306,8 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
* *
* @param string $pValue File path * @param string $pValue File path
* @param boolean $pVerifyFile Verify file * @param boolean $pVerifyFile Verify file
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_HeaderFooterDrawing * @return HeaderFooterDrawing
*/ */
public function setPath($pValue = '', $pVerifyFile = true) public function setPath($pValue = '', $pVerifyFile = true)
{ {
@ -320,7 +320,7 @@ class HeaderFooterDrawing extends Drawing implements \PHPExcel\IComparable
list($this->width, $this->height) = getimagesize($pValue); list($this->width, $this->height) = getimagesize($pValue);
} }
} else { } else {
throw new PHPExcel_Exception("File $pValue not found!"); throw new \PHPExcel\Exception("File $pValue not found!");
} }
} else { } else {
$this->path = $pValue; $this->path = $pValue;

View File

@ -70,7 +70,7 @@ class MemoryDrawing extends BaseDrawing implements \PHPExcel\IComparable
private $uniqueName; private $uniqueName;
/** /**
* Create a new PHPExcel_Worksheet_MemoryDrawing * Create a new MemoryDrawing
*/ */
public function __construct() public function __construct()
{ {
@ -98,7 +98,7 @@ class MemoryDrawing extends BaseDrawing implements \PHPExcel\IComparable
* Set image resource * Set image resource
* *
* @param $value resource * @param $value resource
* @return PHPExcel_Worksheet_MemoryDrawing * @return MemoryDrawing
*/ */
public function setImageResource($value = null) public function setImageResource($value = null)
{ {
@ -126,9 +126,9 @@ class MemoryDrawing extends BaseDrawing implements \PHPExcel\IComparable
* Set rendering function * Set rendering function
* *
* @param string $value * @param string $value
* @return PHPExcel_Worksheet_MemoryDrawing * @return MemoryDrawing
*/ */
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) public function setRenderingFunction($value = self::RENDERING_DEFAULT)
{ {
$this->renderingFunction = $value; $this->renderingFunction = $value;
return $this; return $this;
@ -148,9 +148,9 @@ class MemoryDrawing extends BaseDrawing implements \PHPExcel\IComparable
* Set mime type * Set mime type
* *
* @param string $value * @param string $value
* @return PHPExcel_Worksheet_MemoryDrawing * @return MemoryDrawing
*/ */
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) public function setMimeType($value = self::MIMETYPE_DEFAULT)
{ {
$this->mimeType = $value; $this->mimeType = $value;
return $this; return $this;

View File

@ -72,7 +72,7 @@ class PageMargins
private $footer = 0.3; private $footer = 0.3;
/** /**
* Create a new PHPExcel_Worksheet_PageMargins * Create a new PageMargins
*/ */
public function __construct() public function __construct()
{ {
@ -92,7 +92,7 @@ class PageMargins
* Set Left * Set Left
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setLeft($pValue) public function setLeft($pValue)
{ {
@ -114,7 +114,7 @@ class PageMargins
* Set Right * Set Right
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setRight($pValue) public function setRight($pValue)
{ {
@ -136,7 +136,7 @@ class PageMargins
* Set Top * Set Top
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setTop($pValue) public function setTop($pValue)
{ {
@ -158,7 +158,7 @@ class PageMargins
* Set Bottom * Set Bottom
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setBottom($pValue) public function setBottom($pValue)
{ {
@ -180,7 +180,7 @@ class PageMargins
* Set Header * Set Header
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setHeader($pValue) public function setHeader($pValue)
{ {
@ -202,7 +202,7 @@ class PageMargins
* Set Footer * Set Footer
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_PageMargins * @return PageMargins
*/ */
public function setFooter($pValue) public function setFooter($pValue)
{ {

View File

@ -590,7 +590,7 @@ class PageSetup
* Default behaviour, or a index value of 0, will return all ranges as a comma-separated string * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string
* Otherwise, the specific range identified by the value of $index will be returned * Otherwise, the specific range identified by the value of $index will be returned
* Print areas are numbered from 1 * Print areas are numbered from 1
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return string * @return string
*/ */
public function getPrintArea($index = 0) public function getPrintArea($index = 0)
@ -602,7 +602,7 @@ class PageSetup
if (isset($printAreas[$index-1])) { if (isset($printAreas[$index-1])) {
return $printAreas[$index-1]; return $printAreas[$index-1];
} }
throw new PHPExcel_Exception("Requested Print Area does not exist"); throw new \PHPExcel\Exception("Requested Print Area does not exist");
} }
/** /**
@ -670,11 +670,11 @@ class PageSetup
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{ {
if (strpos($value, '!') !== false) { if (strpos($value, '!') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.'); throw new \PHPExcel\Exception('Cell coordinate must not specify a worksheet.');
} elseif (strpos($value, ':') === false) { } elseif (strpos($value, ':') === false) {
throw new PHPExcel_Exception('Cell coordinate must be a range of cells.'); throw new \PHPExcel\Exception('Cell coordinate must be a range of cells.');
} elseif (strpos($value, '$') !== false) { } elseif (strpos($value, '$') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); throw new \PHPExcel\Exception('Cell coordinate must not be absolute.');
} }
$value = strtoupper($value); $value = strtoupper($value);
@ -687,7 +687,7 @@ class PageSetup
$index = count($printAreas) - abs($index) + 1; $index = count($printAreas) - abs($index) + 1;
} }
if (($index <= 0) || ($index > count($printAreas))) { if (($index <= 0) || ($index > count($printAreas))) {
throw new PHPExcel_Exception('Invalid index for setting print range.'); throw new \PHPExcel\Exception('Invalid index for setting print range.');
} }
$printAreas[$index-1] = $value; $printAreas[$index-1] = $value;
$this->printArea = implode(',', $printAreas); $this->printArea = implode(',', $printAreas);
@ -701,13 +701,13 @@ class PageSetup
$index = abs($index) - 1; $index = abs($index) - 1;
} }
if ($index > count($printAreas)) { if ($index > count($printAreas)) {
throw new PHPExcel_Exception('Invalid index for setting print range.'); throw new \PHPExcel\Exception('Invalid index for setting print range.');
} }
$printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index)); $printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index));
$this->printArea = implode(',', $printAreas); $this->printArea = implode(',', $printAreas);
} }
} else { } else {
throw new PHPExcel_Exception('Invalid method for setting print range.'); throw new \PHPExcel\Exception('Invalid method for setting print range.');
} }
return $this; return $this;
@ -757,7 +757,7 @@ class PageSetup
public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{ {
return $this->setPrintArea( return $this->setPrintArea(
PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, \PHPExcel\Cell::stringFromColumnIndex($column1) . $row1 . ':' . \PHPExcel\Cell::stringFromColumnIndex($column2) . $row2,
$index, $index,
$method $method
); );
@ -782,7 +782,7 @@ class PageSetup
public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1)
{ {
return $this->setPrintArea( return $this->setPrintArea(
PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, \PHPExcel\Cell::stringFromColumnIndex($column1) . $row1 . ':' . \PHPExcel\Cell::stringFromColumnIndex($column2) . $row2,
$index, $index,
self::SETPRINTRANGE_INSERT self::SETPRINTRANGE_INSERT
); );
@ -802,7 +802,7 @@ class PageSetup
* Set first page number * Set first page number
* *
* @param int $value * @param int $value
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function setFirstPageNumber($value = null) public function setFirstPageNumber($value = null)
{ {
@ -813,7 +813,7 @@ class PageSetup
/** /**
* Reset first page number * Reset first page number
* *
* @return PHPExcel_Worksheet_HeaderFooter * @return HeaderFooter
*/ */
public function resetFirstPageNumber() public function resetFirstPageNumber()
{ {

View File

@ -149,7 +149,7 @@ class Protection
private $password = ''; private $password = '';
/** /**
* Create a new PHPExcel_Worksheet_Protection * Create a new Protection
*/ */
public function __construct() public function __construct()
{ {
@ -194,7 +194,7 @@ class Protection
* Set Sheet * Set Sheet
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setSheet($pValue = false) public function setSheet($pValue = false)
{ {
@ -216,7 +216,7 @@ class Protection
* Set Objects * Set Objects
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setObjects($pValue = false) public function setObjects($pValue = false)
{ {
@ -238,7 +238,7 @@ class Protection
* Set Scenarios * Set Scenarios
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setScenarios($pValue = false) public function setScenarios($pValue = false)
{ {
@ -260,7 +260,7 @@ class Protection
* Set FormatCells * Set FormatCells
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setFormatCells($pValue = false) public function setFormatCells($pValue = false)
{ {
@ -282,7 +282,7 @@ class Protection
* Set FormatColumns * Set FormatColumns
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setFormatColumns($pValue = false) public function setFormatColumns($pValue = false)
{ {
@ -304,7 +304,7 @@ class Protection
* Set FormatRows * Set FormatRows
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setFormatRows($pValue = false) public function setFormatRows($pValue = false)
{ {
@ -326,7 +326,7 @@ class Protection
* Set InsertColumns * Set InsertColumns
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setInsertColumns($pValue = false) public function setInsertColumns($pValue = false)
{ {
@ -348,7 +348,7 @@ class Protection
* Set InsertRows * Set InsertRows
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setInsertRows($pValue = false) public function setInsertRows($pValue = false)
{ {
@ -370,7 +370,7 @@ class Protection
* Set InsertHyperlinks * Set InsertHyperlinks
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setInsertHyperlinks($pValue = false) public function setInsertHyperlinks($pValue = false)
{ {
@ -392,7 +392,7 @@ class Protection
* Set DeleteColumns * Set DeleteColumns
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setDeleteColumns($pValue = false) public function setDeleteColumns($pValue = false)
{ {
@ -414,7 +414,7 @@ class Protection
* Set DeleteRows * Set DeleteRows
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setDeleteRows($pValue = false) public function setDeleteRows($pValue = false)
{ {
@ -436,7 +436,7 @@ class Protection
* Set SelectLockedCells * Set SelectLockedCells
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setSelectLockedCells($pValue = false) public function setSelectLockedCells($pValue = false)
{ {
@ -458,7 +458,7 @@ class Protection
* Set Sort * Set Sort
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setSort($pValue = false) public function setSort($pValue = false)
{ {
@ -480,7 +480,7 @@ class Protection
* Set AutoFilter * Set AutoFilter
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setAutoFilter($pValue = false) public function setAutoFilter($pValue = false)
{ {
@ -502,7 +502,7 @@ class Protection
* Set PivotTables * Set PivotTables
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setPivotTables($pValue = false) public function setPivotTables($pValue = false)
{ {
@ -524,7 +524,7 @@ class Protection
* Set SelectUnlockedCells * Set SelectUnlockedCells
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setSelectUnlockedCells($pValue = false) public function setSelectUnlockedCells($pValue = false)
{ {
@ -547,12 +547,12 @@ class Protection
* *
* @param string $pValue * @param string $pValue
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection * @return Protection
*/ */
public function setPassword($pValue = '', $pAlreadyHashed = false) public function setPassword($pValue = '', $pAlreadyHashed = false)
{ {
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = \PHPExcel\Shared\PasswordHasher::hashPassword($pValue);
} }
$this->password = $pValue; $this->password = $pValue;
return $this; return $this;

View File

@ -30,9 +30,9 @@ namespace PHPExcel\Worksheet;
class Row class Row
{ {
/** /**
* PHPExcel_Worksheet * \PHPExcel\Worksheet
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
private $parent; private $parent;
@ -46,10 +46,10 @@ class Row
/** /**
* Create a new row * Create a new row
* *
* @param PHPExcel_Worksheet $parent * @param \PHPExcel\Worksheet $parent
* @param int $rowIndex * @param int $rowIndex
*/ */
public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1) public function __construct(\PHPExcel\Worksheet $parent = null, $rowIndex = 1)
{ {
// Set parent and row index // Set parent and row index
$this->parent = $parent; $this->parent = $parent;
@ -79,10 +79,10 @@ class Row
* *
* @param string $startColumn The column address at which to start iterating * @param string $startColumn The column address at which to start iterating
* @param string $endColumn Optionally, the column address at which to stop iterating * @param string $endColumn Optionally, the column address at which to stop iterating
* @return PHPExcel_Worksheet_CellIterator * @return RowCellIterator
*/ */
public function getCellIterator($startColumn = 'A', $endColumn = null) public function getCellIterator($startColumn = 'A', $endColumn = null)
{ {
return new PHPExcel_Worksheet_RowCellIterator($this->parent, $this->rowIndex, $startColumn, $endColumn); return new RowCellIterator($this->parent, $this->rowIndex, $startColumn, $endColumn);
} }
} }

View File

@ -53,12 +53,12 @@ class RowCellIterator extends CellIterator implements \Iterator
/** /**
* Create a new column iterator * Create a new column iterator
* *
* @param PHPExcel_Worksheet $subject The worksheet to iterate over * @param \PHPExcel\Worksheet $subject The worksheet to iterate over
* @param integer $rowIndex The row that we want to iterate * @param integer $rowIndex The row that we want to iterate
* @param string $startColumn The column address at which to start iterating * @param string $startColumn The column address at which to start iterating
* @param string $endColumn Optionally, the column address at which to stop iterating * @param string $endColumn Optionally, the column address at which to stop iterating
*/ */
public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) public function __construct(\PHPExcel\Worksheet $subject = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null)
{ {
// Set subject and row index // Set subject and row index
$this->subject = $subject; $this->subject = $subject;
@ -79,15 +79,15 @@ class RowCellIterator extends CellIterator implements \Iterator
* (Re)Set the start column and the current column pointer * (Re)Set the start column and the current column pointer
* *
* @param integer $startColumn The column address at which to start iterating * @param integer $startColumn The column address at which to start iterating
* @return PHPExcel_Worksheet_RowCellIterator * @return RowCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function resetStart($startColumn = 'A') public function resetStart($startColumn = 'A')
{ {
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; $startColumnIndex = \PHPExcel\Cell::columnIndexFromString($startColumn) - 1;
$this->startColumn = $startColumnIndex; $this->startColumn = $startColumnIndex;
$this->adjustForExistingOnlyRange(); $this->adjustForExistingOnlyRange();
$this->seek(PHPExcel_Cell::stringFromColumnIndex($this->startColumn)); $this->seek(\PHPExcel\Cell::stringFromColumnIndex($this->startColumn));
return $this; return $this;
} }
@ -96,13 +96,13 @@ class RowCellIterator extends CellIterator implements \Iterator
* (Re)Set the end column * (Re)Set the end column
* *
* @param string $endColumn The column address at which to stop iterating * @param string $endColumn The column address at which to stop iterating
* @return PHPExcel_Worksheet_RowCellIterator * @return RowCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function resetEnd($endColumn = null) public function resetEnd($endColumn = null)
{ {
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn(); $endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; $this->endColumn = \PHPExcel\Cell::columnIndexFromString($endColumn) - 1;
$this->adjustForExistingOnlyRange(); $this->adjustForExistingOnlyRange();
return $this; return $this;
@ -112,16 +112,16 @@ class RowCellIterator extends CellIterator implements \Iterator
* Set the column pointer to the selected column * Set the column pointer to the selected column
* *
* @param string $column The column address to set the current pointer at * @param string $column The column address to set the current pointer at
* @return PHPExcel_Worksheet_RowCellIterator * @return RowCellIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function seek($column = 'A') public function seek($column = 'A')
{ {
$column = PHPExcel_Cell::columnIndexFromString($column) - 1; $column = \PHPExcel\Cell::columnIndexFromString($column) - 1;
if (($column < $this->startColumn) || ($column > $this->endColumn)) { if (($column < $this->startColumn) || ($column > $this->endColumn)) {
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})"); throw new \PHPExcel\Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) { } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) {
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist'); throw new \PHPExcel\Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
} }
$this->position = $column; $this->position = $column;
@ -139,7 +139,7 @@ class RowCellIterator extends CellIterator implements \Iterator
/** /**
* Return the current cell in this worksheet row * Return the current cell in this worksheet row
* *
* @return PHPExcel_Cell * @return \PHPExcel\Cell
*/ */
public function current() public function current()
{ {
@ -153,7 +153,7 @@ class RowCellIterator extends CellIterator implements \Iterator
*/ */
public function key() public function key()
{ {
return PHPExcel_Cell::stringFromColumnIndex($this->position); return \PHPExcel\Cell::stringFromColumnIndex($this->position);
} }
/** /**
@ -171,15 +171,15 @@ class RowCellIterator extends CellIterator implements \Iterator
/** /**
* Set the iterator to its previous value * Set the iterator to its previous value
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function prev() public function prev()
{ {
if ($this->position <= $this->startColumn) { if ($this->position <= $this->startColumn) {
throw new PHPExcel_Exception( throw new \PHPExcel\Exception(
"Column is already at the beginning of range (" . "Column is already at the beginning of range (" .
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " . \PHPExcel\Cell::stringFromColumnIndex($this->endColumn) . " - " .
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")" \PHPExcel\Cell::stringFromColumnIndex($this->endColumn) . ")"
); );
} }
@ -203,7 +203,7 @@ class RowCellIterator extends CellIterator implements \Iterator
/** /**
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
* *
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
protected function adjustForExistingOnlyRange() protected function adjustForExistingOnlyRange()
{ {
@ -213,14 +213,14 @@ class RowCellIterator extends CellIterator implements \Iterator
++$this->startColumn; ++$this->startColumn;
} }
if ($this->startColumn > $this->endColumn) { if ($this->startColumn > $this->endColumn) {
throw new PHPExcel_Exception('No cells exist within the specified range'); throw new \PHPExcel\Exception('No cells exist within the specified range');
} }
while ((!$this->subject->cellExistsByColumnAndRow($this->endColumn, $this->rowIndex)) && while ((!$this->subject->cellExistsByColumnAndRow($this->endColumn, $this->rowIndex)) &&
($this->endColumn >= $this->startColumn)) { ($this->endColumn >= $this->startColumn)) {
--$this->endColumn; --$this->endColumn;
} }
if ($this->endColumn < $this->startColumn) { if ($this->endColumn < $this->startColumn) {
throw new PHPExcel_Exception('No cells exist within the specified range'); throw new \PHPExcel\Exception('No cells exist within the specified range');
} }
} }
} }

View File

@ -53,7 +53,7 @@ class RowDimension extends Dimension
private $zeroHeight = false; private $zeroHeight = false;
/** /**
* Create a new PHPExcel_Worksheet_RowDimension * Create a new RowDimension
* *
* @param int $pIndex Numeric row index * @param int $pIndex Numeric row index
*/ */
@ -80,7 +80,7 @@ class RowDimension extends Dimension
* Set Row Index * Set Row Index
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_RowDimension * @return RowDimension
*/ */
public function setRowIndex($pValue) public function setRowIndex($pValue)
{ {
@ -102,7 +102,7 @@ class RowDimension extends Dimension
* Set Row Height * Set Row Height
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Worksheet_RowDimension * @return RowDimension
*/ */
public function setRowHeight($pValue = -1) public function setRowHeight($pValue = -1)
{ {
@ -124,7 +124,7 @@ class RowDimension extends Dimension
* Set ZeroHeight * Set ZeroHeight
* *
* @param bool $pValue * @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension * @return RowDimension
*/ */
public function setZeroHeight($pValue = false) public function setZeroHeight($pValue = false)
{ {

View File

@ -30,9 +30,9 @@ namespace PHPExcel\Worksheet;
class RowIterator implements \Iterator class RowIterator implements \Iterator
{ {
/** /**
* PHPExcel_Worksheet to iterate * \PHPExcel\Worksheet to iterate
* *
* @var PHPExcel_Worksheet * @var \PHPExcel\Worksheet
*/ */
private $subject; private $subject;
@ -62,11 +62,11 @@ class RowIterator implements \Iterator
/** /**
* Create a new row iterator * Create a new row iterator
* *
* @param PHPExcel_Worksheet $subject The worksheet to iterate over * @param \PHPExcel\Worksheet $subject The worksheet to iterate over
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @param integer $endRow Optionally, the row number at which to stop iterating * @param integer $endRow Optionally, the row number at which to stop iterating
*/ */
public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1, $endRow = null) public function __construct(\PHPExcel\Worksheet $subject = null, $startRow = 1, $endRow = null)
{ {
// Set subject // Set subject
$this->subject = $subject; $this->subject = $subject;
@ -86,7 +86,7 @@ class RowIterator implements \Iterator
* (Re)Set the start row and the current row pointer * (Re)Set the start row and the current row pointer
* *
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @return PHPExcel_Worksheet_RowIterator * @return RowIterator
*/ */
public function resetStart($startRow = 1) public function resetStart($startRow = 1)
{ {
@ -100,7 +100,7 @@ class RowIterator implements \Iterator
* (Re)Set the end row * (Re)Set the end row
* *
* @param integer $endRow The row number at which to stop iterating * @param integer $endRow The row number at which to stop iterating
* @return PHPExcel_Worksheet_RowIterator * @return RowIterator
*/ */
public function resetEnd($endRow = null) public function resetEnd($endRow = null)
{ {
@ -113,13 +113,13 @@ class RowIterator implements \Iterator
* Set the row pointer to the selected row * Set the row pointer to the selected row
* *
* @param integer $row The row number to set the current pointer at * @param integer $row The row number to set the current pointer at
* @return PHPExcel_Worksheet_RowIterator * @return RowIterator
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
*/ */
public function seek($row = 1) public function seek($row = 1)
{ {
if (($row < $this->startRow) || ($row > $this->endRow)) { if (($row < $this->startRow) || ($row > $this->endRow)) {
throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})"); throw new \PHPExcel\Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
} }
$this->position = $row; $this->position = $row;
@ -137,11 +137,11 @@ class RowIterator implements \Iterator
/** /**
* Return the current row in this worksheet * Return the current row in this worksheet
* *
* @return PHPExcel_Worksheet_Row * @return Row
*/ */
public function current() public function current()
{ {
return new PHPExcel_Worksheet_Row($this->subject, $this->position); return new Row($this->subject, $this->position);
} }
/** /**
@ -164,11 +164,13 @@ class RowIterator implements \Iterator
/** /**
* Set the iterator to its previous value * Set the iterator to its previous value
*
* @throws \PHPExcel\Exception
*/ */
public function prev() public function prev()
{ {
if ($this->position <= $this->startRow) { if ($this->position <= $this->startRow) {
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})"); throw new \PHPExcel\Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
} }
--$this->position; --$this->position;

View File

@ -69,7 +69,7 @@ class SheetView
private $sheetviewType = self::SHEETVIEW_NORMAL; private $sheetviewType = self::SHEETVIEW_NORMAL;
/** /**
* Create a new PHPExcel_Worksheet_SheetView * Create a new SheetView
*/ */
public function __construct() public function __construct()
{ {
@ -91,8 +91,8 @@ class SheetView
* Valid values range from 10 to 400. * Valid values range from 10 to 400.
* *
* @param int $pValue * @param int $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_SheetView * @return SheetView
*/ */
public function setZoomScale($pValue = 100) public function setZoomScale($pValue = 100)
{ {
@ -101,7 +101,7 @@ class SheetView
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->zoomScale = $pValue; $this->zoomScale = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new \PHPExcel\Exception("Scale must be greater than or equal to 1.");
} }
return $this; return $this;
} }
@ -122,15 +122,15 @@ class SheetView
* Valid values range from 10 to 400. * Valid values range from 10 to 400.
* *
* @param int $pValue * @param int $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_SheetView * @return SheetView
*/ */
public function setZoomScaleNormal($pValue = 100) public function setZoomScaleNormal($pValue = 100)
{ {
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->zoomScaleNormal = $pValue; $this->zoomScaleNormal = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new \PHPExcel\Exception("Scale must be greater than or equal to 1.");
} }
return $this; return $this;
} }
@ -154,8 +154,8 @@ class SheetView
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
* *
* @param string $pValue * @param string $pValue
* @throws PHPExcel_Exception * @throws \PHPExcel\Exception
* @return PHPExcel_Worksheet_SheetView * @return SheetView
*/ */
public function setView($pValue = null) public function setView($pValue = null)
{ {
@ -166,7 +166,7 @@ class SheetView
if (in_array($pValue, self::$sheetViewTypes)) { if (in_array($pValue, self::$sheetViewTypes)) {
$this->sheetviewType = $pValue; $this->sheetviewType = $pValue;
} else { } else {
throw new PHPExcel_Exception("Invalid sheetview layout type."); throw new \PHPExcel\Exception("Invalid sheetview layout type.");
} }
return $this; return $this;

View File

@ -2,7 +2,6 @@
namespace PHPExcel; namespace PHPExcel;
require_once 'testDataFileIterator.php'; require_once 'testDataFileIterator.php';
class CalculationTest extends \PHPUnit_Framework_TestCase class CalculationTest extends \PHPUnit_Framework_TestCase

View File

@ -2,7 +2,6 @@
namespace PHPExcel; namespace PHPExcel;
require_once 'testDataFileIterator.php'; require_once 'testDataFileIterator.php';
class CellTest extends \PHPUnit_Framework_TestCase class CellTest extends \PHPUnit_Framework_TestCase

View File

@ -1,9 +1,7 @@
<?php <?php
namespace PHPExcel; namespace PHPExcel;
class ReferenceHelperTest extends \PHPUnit_Framework_TestCase class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,80 +1,78 @@
<?php <?php
namespace PHPExcel\Worksheet;
class AutoFilterTest extends PHPUnit_Framework_TestCase class AutoFilterTest extends \PHPUnit_Framework_TestCase
{ {
private $_testInitialRange = 'H2:O256'; private $testInitialRange = 'H2:O256';
private $_testAutoFilterObject; private $testAutoFilterObject;
private $mockWorksheetObject;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { $this->mockWorksheetObject = $this->getMockBuilder('\\PHPExcel\\Worksheet')
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->_mockWorksheetObject = $this->getMockBuilder('PHPExcel_Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockCacheController = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory') $this->_mockCacheController = $this->getMockBuilder('\\PHPExcel\\CachedObjectStorage\\Memory')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->_mockWorksheetObject->expects($this->any()) $this->mockWorksheetObject->expects($this->any())
->method('getCellCacheController') ->method('getCellCacheController')
->will($this->returnValue($this->_mockCacheController)); ->will($this->returnValue($this->_mockCacheController));
$this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter( $this->testAutoFilterObject = new AutoFilter(
$this->_testInitialRange, $this->testInitialRange,
$this->_mockWorksheetObject $this->mockWorksheetObject
); );
} }
public function testToString() public function testToString()
{ {
$expectedResult = $this->_testInitialRange; $expectedResult = $this->testInitialRange;
// magic __toString should return the active autofilter range // magic __toString should return the active autofilter range
$result = $this->_testAutoFilterObject; $result = $this->testAutoFilterObject;
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testGetParent() public function testGetParent()
{ {
$result = $this->_testAutoFilterObject->getParent(); $result = $this->testAutoFilterObject->getParent();
$this->assertInstanceOf('PHPExcel_Worksheet', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet', $result);
} }
public function testSetParent() public function testSetParent()
{ {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject); $result = $this->testAutoFilterObject->setParent($this->mockWorksheetObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
} }
public function testGetRange() public function testGetRange()
{ {
$expectedResult = $this->_testInitialRange; $expectedResult = $this->testInitialRange;
// Result should be the active autofilter range // Result should be the active autofilter range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetRange() public function testSetRange()
{ {
$ranges = array('G1:J512' => 'Worksheet1!G1:J512', $ranges = [
'G1:J512' => 'Worksheet1!G1:J512',
'K1:N20' => 'K1:N20' 'K1:N20' => 'K1:N20'
); ];
foreach ($ranges as $actualRange => $fullRange) { foreach ($ranges as $actualRange => $fullRange) {
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange($fullRange); $result = $this->testAutoFilterObject->setRange($fullRange);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
// Result should be the new autofilter range // Result should be the new autofilter range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->testAutoFilterObject->getRange();
$this->assertEquals($actualRange, $result); $this->assertEquals($actualRange, $result);
} }
} }
@ -84,55 +82,56 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
$expectedResult = ''; $expectedResult = '';
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange(); $result = $this->testAutoFilterObject->setRange();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
// Result should be a clear range // Result should be a clear range
$result = $this->_testAutoFilterObject->getRange(); $result = $this->testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSetRangeInvalidRange() public function testSetRangeInvalidRange()
{ {
$expectedResult = 'A1'; $expectedResult = 'A1';
$result = $this->_testAutoFilterObject->setRange($expectedResult); $result = $this->testAutoFilterObject->setRange($expectedResult);
} }
public function testGetColumnsEmpty() public function testGetColumnsEmpty()
{ {
// There should be no columns yet defined // There should be no columns yet defined
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(0, count($result)); $this->assertEquals(0, count($result));
} }
public function testGetColumnOffset() public function testGetColumnOffset()
{ {
$columnIndexes = array( 'H' => 0, $columnIndexes = [
'H' => 0,
'K' => 3, 'K' => 3,
'M' => 5 'M' => 5
); ];
// If we request a specific column by its column ID, we should get an // If we request a specific column by its column ID, we should get an
// integer returned representing the column offset within the range // integer returned representing the column offset within the range
foreach ($columnIndexes as $columnIndex => $columnOffset) { foreach ($columnIndexes as $columnIndex => $columnOffset) {
$result = $this->_testAutoFilterObject->getColumnOffset($columnIndex); $result = $this->testAutoFilterObject->getColumnOffset($columnIndex);
$this->assertEquals($columnOffset, $result); $this->assertEquals($columnOffset, $result);
} }
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testGetInvalidColumnOffset() public function testGetInvalidColumnOffset()
{ {
$invalidColumn = 'G'; $invalidColumn = 'G';
$result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn); $result = $this->testAutoFilterObject->getColumnOffset($invalidColumn);
} }
public function testSetColumnWithString() public function testSetColumnWithString()
@ -140,84 +139,84 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
$expectedResult = 'L'; $expectedResult = 'L';
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setColumn($expectedResult); $result = $this->testAutoFilterObject->setColumn($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(1, count($result)); $this->assertEquals(1, count($result));
$this->assertArrayHasKey($expectedResult, $result); $this->assertArrayHasKey($expectedResult, $result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$expectedResult]);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSetInvalidColumnWithString() public function testSetInvalidColumnWithString()
{ {
$invalidColumn = 'A'; $invalidColumn = 'A';
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->testAutoFilterObject->setColumn($invalidColumn);
} }
public function testSetColumnWithColumnObject() public function testSetColumnWithColumnObject()
{ {
$expectedResult = 'M'; $expectedResult = 'M';
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult); $columnObject = new AutoFilter\Column($expectedResult);
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setColumn($columnObject); $result = $this->testAutoFilterObject->setColumn($columnObject);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(1, count($result)); $this->assertEquals(1, count($result));
$this->assertArrayHasKey($expectedResult, $result); $this->assertArrayHasKey($expectedResult, $result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$expectedResult]);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSetInvalidColumnWithObject() public function testSetInvalidColumnWithObject()
{ {
$invalidColumn = 'E'; $invalidColumn = 'E';
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn); $columnObject = new AutoFilter\Column($invalidColumn);
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->testAutoFilterObject->setColumn($invalidColumn);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSetColumnWithInvalidDataType() public function testSetColumnWithInvalidDataType()
{ {
$invalidColumn = 123.456; $invalidColumn = 123.456;
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn); $columnObject = new AutoFilter\Column($invalidColumn);
$result = $this->_testAutoFilterObject->setColumn($invalidColumn); $result = $this->testAutoFilterObject->setColumn($invalidColumn);
} }
public function testGetColumns() public function testGetColumns()
{ {
$columnIndexes = array('L','M'); $columnIndexes = ['L','M'];
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column // Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
// objects for each column we set indexed by the column ID // objects for each column we set indexed by the column ID
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(count($columnIndexes), count($result)); $this->assertEquals(count($columnIndexes), count($result));
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->assertArrayHasKey($columnIndex, $result); $this->assertArrayHasKey($columnIndex, $result);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$columnIndex]);
} }
} }
@ -226,29 +225,30 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
$columnIndexes = array('L','M'); $columnIndexes = array('L','M');
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
// If we request a specific column by its column ID, we should // If we request a specific column by its column ID, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a \PHPExcel\Worksheet\AutoFilter\Column object returned
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$result = $this->_testAutoFilterObject->getColumn($columnIndex); $result = $this->testAutoFilterObject->getColumn($columnIndex);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
} }
} }
public function testGetColumnByOffset() public function testGetColumnByOffset()
{ {
$columnIndexes = array( 0 => 'H', $columnIndexes = [
0 => 'H',
3 => 'K', 3 => 'K',
5 => 'M' 5 => 'M'
); ];
// If we request a specific column by its offset, we should // If we request a specific column by its offset, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a \PHPExcel\Worksheet\AutoFilter\Column object returned
foreach ($columnIndexes as $columnIndex => $columnID) { foreach ($columnIndexes as $columnIndex => $columnID) {
$result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex); $result = $this->testAutoFilterObject->getColumnByOffset($columnIndex);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
$this->assertEquals($result->getColumnIndex(), $columnID); $this->assertEquals($result->getColumnIndex(), $columnID);
} }
} }
@ -256,41 +256,40 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
public function testGetColumnIfNotSet() public function testGetColumnIfNotSet()
{ {
// If we request a specific column by its column ID, we should // If we request a specific column by its column ID, we should
// get a PHPExcel_Worksheet_AutoFilter_Column object returned // get a \PHPExcel\Worksheet\AutoFilter\Column object returned
$result = $this->_testAutoFilterObject->getColumn('K'); $result = $this->testAutoFilterObject->getColumn('K');
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testGetColumnWithoutRangeSet() public function testGetColumnWithoutRangeSet()
{ {
// Clear the range // Clear the range
$result = $this->_testAutoFilterObject->setRange(); $result = $this->testAutoFilterObject->setRange();
$result = $this->testAutoFilterObject->getColumn('A');
$result = $this->_testAutoFilterObject->getColumn('A');
} }
public function testClearRangeWithExistingColumns() public function testClearRangeWithExistingColumns()
{ {
$expectedResult = ''; $expectedResult = '';
$columnIndexes = array('L','M','N'); $columnIndexes = ['L','M','N'];
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange(); $result = $this->testAutoFilterObject->setRange();
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
// Range should be cleared // Range should be cleared
$result = $this->_testAutoFilterObject->getRange(); $result = $this->testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
// Column array should be cleared // Column array should be cleared
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(0, count($result)); $this->assertEquals(0, count($result));
} }
@ -300,40 +299,40 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
$expectedResult = 'G1:J512'; $expectedResult = 'G1:J512';
// These columns should be retained // These columns should be retained
$columnIndexes1 = array('I','J'); $columnIndexes1 = ['I','J'];
foreach ($columnIndexes1 as $columnIndex) { foreach ($columnIndexes1 as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
// These columns should be discarded // These columns should be discarded
$columnIndexes2 = array('K','L','M'); $columnIndexes2 = ['K','L','M'];
foreach ($columnIndexes2 as $columnIndex) { foreach ($columnIndexes2 as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
// Setters return the instance to implement the fluent interface // Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterObject->setRange($expectedResult); $result = $this->testAutoFilterObject->setRange($expectedResult);
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
// Range should be correctly set // Range should be correctly set
$result = $this->_testAutoFilterObject->getRange(); $result = $this->testAutoFilterObject->getRange();
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
// Only columns that existed in the original range and that // Only columns that existed in the original range and that
// still fall within the new range should be retained // still fall within the new range should be retained
$result = $this->_testAutoFilterObject->getColumns(); $result = $this->testAutoFilterObject->getColumns();
$this->assertInternalType('array', $result); $this->assertInternalType('array', $result);
$this->assertEquals(count($columnIndexes1), count($result)); $this->assertEquals(count($columnIndexes1), count($result));
} }
public function testClone() public function testClone()
{ {
$columnIndexes = array('L','M'); $columnIndexes = ['L','M'];
foreach ($columnIndexes as $columnIndex) { foreach ($columnIndexes as $columnIndex) {
$this->_testAutoFilterObject->setColumn($columnIndex); $this->testAutoFilterObject->setColumn($columnIndex);
} }
$result = clone $this->_testAutoFilterObject; $result = clone $this->testAutoFilterObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
} }
} }

View File

@ -1,29 +1,26 @@
<?php <?php
class CellCollectionTest extends PHPUnit_Framework_TestCase namespace PHPExcel\Worksheet;
class CellCollectionTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
public function testCacheLastCell() public function testCacheLastCell()
{ {
$methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods(); $methods = \PHPExcel\CachedObjectStorageFactory::getCacheStorageMethods();
foreach ($methods as $method) { foreach ($methods as $method) {
PHPExcel_CachedObjectStorageFactory::initialize($method); \PHPExcel\CachedObjectStorageFactory::initialize($method);
$workbook = new PHPExcel(); $workbook = new \PHPExcel();
$cells = array('A1', 'A2'); $cells = ['A1', 'A2'];
$worksheet = $workbook->getActiveSheet(); $worksheet = $workbook->getActiveSheet();
$worksheet->setCellValue('A1', 1); $worksheet->setCellValue('A1', 1);
$worksheet->setCellValue('A2', 2); $worksheet->setCellValue('A2', 2);
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\"."); $this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
PHPExcel_CachedObjectStorageFactory::finalize(); \PHPExcel\CachedObjectStorageFactory::finalize();
} }
} }
} }

View File

@ -1,22 +1,19 @@
<?php <?php
class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase namespace PHPExcel\Worksheet;
class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
{ {
public $mockWorksheet; public $mockWorksheet;
public $mockColumnCell; public $mockColumnCell;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { $this->mockCell = $this->getMockBuilder('\\PHPExcel\\Cell')
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') $this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -31,31 +28,31 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
public function testIteratorFullRange() public function testIteratorFullRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A'); $iterator = new ColumnCellIterator($this->mockWorksheet, 'A');
$ColumnCellIndexResult = 1; $ColumnCellIndexResult = 1;
$this->assertEquals($ColumnCellIndexResult, $iterator->key()); $this->assertEquals($ColumnCellIndexResult, $iterator->key());
foreach ($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
$this->assertEquals($ColumnCellIndexResult++, $key); $this->assertEquals($ColumnCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell); $this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$ColumnCellIndexResult = 2; $ColumnCellIndexResult = 2;
$this->assertEquals($ColumnCellIndexResult, $iterator->key()); $this->assertEquals($ColumnCellIndexResult, $iterator->key());
foreach ($iterator as $key => $ColumnCell) { foreach ($iterator as $key => $ColumnCell) {
$this->assertEquals($ColumnCellIndexResult++, $key); $this->assertEquals($ColumnCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell); $this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$columnIndexResult = 4; $columnIndexResult = 4;
$iterator->seek(4); $iterator->seek(4);
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
@ -67,20 +64,20 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSeekOutOfRange() public function testSeekOutOfRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->seek(1); $iterator->seek(1);
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testPrevOutOfRange() public function testPrevOutOfRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->prev(); $iterator->prev();
} }
} }

View File

@ -1,22 +1,19 @@
<?php <?php
class ColumnIteratorTest extends PHPUnit_Framework_TestCase namespace PHPExcel\Worksheet;
class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
{ {
public $mockWorksheet; public $mockWorksheet;
public $mockColumn; public $mockColumn;
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { $this->mockColumn = $this->getMockBuilder('\\PHPExcel\\Worksheet\\Column')
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
$this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') $this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -31,32 +28,32 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
public function testIteratorFullRange() public function testIteratorFullRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet); $iterator = new ColumnIterator($this->mockWorksheet);
$columnIndexResult = 'A'; $columnIndexResult = 'A';
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
foreach ($iterator as $key => $column) { foreach ($iterator as $key => $column) {
$this->assertEquals($columnIndexResult++, $key); $this->assertEquals($columnIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column);
} }
} }
public function testIteratorStartEndRange() public function testIteratorStartEndRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$columnIndexResult = 'B'; $columnIndexResult = 'B';
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
foreach ($iterator as $key => $column) { foreach ($iterator as $key => $column) {
$this->assertEquals($columnIndexResult++, $key); $this->assertEquals($columnIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column);
} }
} }
public function testIteratorSeekAndPrev() public function testIteratorSeekAndPrev()
{ {
$ranges = range('A', 'E'); $ranges = range('A', 'E');
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$columnIndexResult = 'D'; $columnIndexResult = 'D';
$iterator->seek('D'); $iterator->seek('D');
$this->assertEquals($columnIndexResult, $iterator->key()); $this->assertEquals($columnIndexResult, $iterator->key());
@ -69,20 +66,20 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testSeekOutOfRange() public function testSeekOutOfRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$iterator->seek('A'); $iterator->seek('A');
} }
/** /**
* @expectedException PHPExcel_Exception * @expectedException \PHPExcel\Exception
*/ */
public function testPrevOutOfRange() public function testPrevOutOfRange()
{ {
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D');
$iterator->prev(); $iterator->prev();
} }
} }