PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-15 13:36:15 +02:00
parent 5508013569
commit 121eccd4c8
11 changed files with 283 additions and 212 deletions

View File

@ -40,7 +40,7 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_workSheet = NULL; private $_workSheet = null;
/** /**
@ -65,7 +65,7 @@ class PHPExcel_Worksheet_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)
{ {
$this->_range = $pRange; $this->_range = $pRange;
$this->_workSheet = $pSheet; $this->_workSheet = $pSheet;
@ -76,7 +76,8 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function getParent() { public function getParent()
{
return $this->_workSheet; return $this->_workSheet;
} }
@ -86,7 +87,8 @@ class PHPExcel_Worksheet_AutoFilter
* @param PHPExcel_Worksheet $pSheet * @param PHPExcel_Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function setParent(PHPExcel_Worksheet $pSheet = NULL) { public function setParent(PHPExcel_Worksheet $pSheet = null)
{
$this->_workSheet = $pSheet; $this->_workSheet = $pSheet;
return $this; return $this;
@ -97,7 +99,8 @@ class PHPExcel_Worksheet_AutoFilter
* *
* @return string * @return string
*/ */
public function getRange() { public function getRange()
{
return $this->_range; return $this->_range;
} }
@ -108,14 +111,15 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function setRange($pRange = '') { public function setRange($pRange = '')
{
// Uppercase coordinate // Uppercase coordinate
$cellAddress = explode('!',strtoupper($pRange)); $cellAddress = explode('!',strtoupper($pRange));
if (count($cellAddress) > 1) { if (count($cellAddress) > 1) {
list($worksheet, $pRange) = $cellAddress; list($worksheet, $pRange) = $cellAddress;
} }
if (strpos($pRange,':') !== FALSE) { if (strpos($pRange, ':') !== false) {
$this->_range = $pRange; $this->_range = $pRange;
} elseif (empty($pRange)) { } elseif (empty($pRange)) {
$this->_range = ''; $this->_range = '';
@ -146,7 +150,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column * @return array of PHPExcel_Worksheet_AutoFilter_Column
*/ */
public function getColumns() { public function getColumns()
{
return $this->_columns; return $this->_columns;
} }
@ -157,7 +162,8 @@ class PHPExcel_Worksheet_AutoFilter
* @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.");
} }
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_AutoFilter
* @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)
{
return $this->testColumnInRange($pColumn); return $this->testColumnInRange($pColumn);
} }
@ -189,7 +196,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return PHPExcel_Worksheet_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])) {
@ -206,7 +214,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column * @return PHPExcel_Worksheet_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);
@ -250,7 +259,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function clearColumn($pColumn) { public function clearColumn($pColumn)
{
$this->testColumnInRange($pColumn); $this->testColumnInRange($pColumn);
if (isset($this->_columns[$pColumn])) { if (isset($this->_columns[$pColumn])) {
@ -271,11 +281,12 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $toColumn Column name (e.g. B) * @param string $toColumn Column name (e.g. B)
* @return PHPExcel_Worksheet_AutoFilter * @return PHPExcel_Worksheet_AutoFilter
*/ */
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) { public function shiftColumn($fromColumn = null, $toColumn = null)
{
$fromColumn = strtoupper($fromColumn); $fromColumn = strtoupper($fromColumn);
$toColumn = strtoupper($toColumn); $toColumn = strtoupper($toColumn);
if (($fromColumn !== NULL) && (isset($this->_columns[$fromColumn])) && ($toColumn !== NULL)) { if (($fromColumn !== null) && (isset($this->_columns[$fromColumn])) && ($toColumn !== null)) {
$this->_columns[$fromColumn]->setParent(); $this->_columns[$fromColumn]->setParent();
$this->_columns[$fromColumn]->setColumnIndex($toColumn); $this->_columns[$fromColumn]->setColumnIndex($toColumn);
$this->_columns[$toColumn] = $this->_columns[$fromColumn]; $this->_columns[$toColumn] = $this->_columns[$fromColumn];
@ -300,7 +311,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dataSetValues = $dataSet['filterValues']; $dataSetValues = $dataSet['filterValues'];
$blanks = $dataSet['blanks']; $blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return $blanks; return $blanks;
} }
return in_array($cellValue, $dataSetValues); return in_array($cellValue, $dataSetValues);
@ -317,7 +328,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dateSet = $dataSet['filterValues']; $dateSet = $dataSet['filterValues'];
$blanks = $dataSet['blanks']; $blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return $blanks; return $blanks;
} }
@ -338,12 +349,12 @@ class PHPExcel_Worksheet_AutoFilter
} }
foreach ($dateSet as $dateValue) { foreach ($dateSet as $dateValue) {
// Use of substr to extract value at the appropriate group level // Use of substr to extract value at the appropriate group level
if (substr($dtVal,0,strlen($dateValue)) == $dateValue) if (substr($dtVal,0,strlen($dateValue)) == $dateValue) {
return TRUE; return true;
} }
} }
}
return FALSE; return false;
} }
/** /**
@ -357,12 +368,12 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$dataSet = $ruleSet['filterRules']; $dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join']; $join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : FALSE; $customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
if (!$customRuleForBlanks) { if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE // Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return FALSE; return false;
} }
} }
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); $returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
@ -392,13 +403,13 @@ class PHPExcel_Worksheet_AutoFilter
} elseif ($rule['value'] == '') { } elseif ($rule['value'] == '') {
switch ($rule['operator']) { switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL : case PHPExcel_Worksheet_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 PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL :
$retVal = (($cellValue != '') && ($cellValue !== NULL)); $retVal = (($cellValue != '') && ($cellValue !== null));
break; break;
default : default :
$retVal = TRUE; $retVal = true;
break; break;
} }
} else { } else {
@ -411,8 +422,9 @@ class PHPExcel_Worksheet_AutoFilter
$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
if ($returnVal) if ($returnVal) {
return $returnVal; return $returnVal;
}
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND : case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND :
$returnVal = $returnVal && $retVal; $returnVal = $returnVal && $retVal;
@ -433,18 +445,18 @@ class PHPExcel_Worksheet_AutoFilter
private static function _filterTestInPeriodDateSet($cellValue, $monthSet) private static function _filterTestInPeriodDateSet($cellValue, $monthSet)
{ {
// Blank cells are always ignored, so return a FALSE // Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) { if (($cellValue == '') || ($cellValue === null)) {
return FALSE; return false;
} }
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;
} }
} }
return FALSE; return false;
} }
/** /**
@ -467,7 +479,7 @@ class PHPExcel_Worksheet_AutoFilter
{ {
$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();
@ -555,33 +567,20 @@ class PHPExcel_Worksheet_AutoFilter
} }
// Set the filter column rule attributes ready for writing // Set the filter column rule attributes ready for writing
$filterColumn->setAttributes(array( 'val' => $val, $filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
'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, $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
'value' => $val $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
);
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN,
'value' => $maxVal
);
PHPExcel_Calculation_Functions::setReturnDateType($rDateType); PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
return array( return array('method' => '_filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_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( $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->_workSheet->rangeToArray($range, null, true, false));
$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 == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
@ -605,7 +604,7 @@ class PHPExcel_Worksheet_AutoFilter
// 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;
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE); $this->_workSheet->getRowDimension($rangeStart[1])->setVisible(true);
$columnFilterTests = array(); $columnFilterTests = array();
foreach ($this->_columns as $columnID => $filterColumn) { foreach ($this->_columns as $columnID => $filterColumn) {
@ -619,17 +618,15 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValues[] = $rule->getValue(); $ruleValues[] = $rule->getValue();
} }
// Test if we want to include blanks in our filter criteria // Test if we want to include blanks in our filter criteria
$blanks = FALSE; $blanks = false;
$ruleDataSet = array_filter($ruleValues); $ruleDataSet = array_filter($ruleValues);
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 == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values // Filter on absolute values
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInSimpleDataSet', 'method' => '_filterTestInSimpleDataSet',
'arguments' => array( 'filterValues' => $ruleDataSet, 'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
'blanks' => $blanks
)
); );
} else { } else {
// Filter on date group values // Filter on date group values
@ -669,14 +666,12 @@ class PHPExcel_Worksheet_AutoFilter
$arguments['dateTime'] = array_filter($arguments['dateTime']); $arguments['dateTime'] = array_filter($arguments['dateTime']);
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInDateGroupSet', 'method' => '_filterTestInDateGroupSet',
'arguments' => array( 'filterValues' => $arguments, 'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
'blanks' => $blanks
)
); );
} }
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER : case PHPExcel_Worksheet_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
foreach ($rules as $rule) { foreach ($rules as $rule) {
@ -687,21 +682,16 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValue = preg_quote($ruleValue); $ruleValue = preg_quote($ruleValue);
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue); $ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
if (trim($ruleValue) == '') { if (trim($ruleValue) == '') {
$customRuleForBlanks = TRUE; $customRuleForBlanks = true;
$ruleValue = trim($ruleValue); $ruleValue = trim($ruleValue);
} }
} }
$ruleValues[] = array( 'operator' => $rule->getOperator(), $ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
'value' => $ruleValue
);
} }
$join = $filterColumn->getJoin(); $join = $filterColumn->getJoin();
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
'join' => $join,
'customRuleForBlanks' => $customRuleForBlanks
)
); );
break; break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER : case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
@ -714,7 +704,7 @@ class PHPExcel_Worksheet_AutoFilter
// 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 === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
@ -724,9 +714,7 @@ class PHPExcel_Worksheet_AutoFilter
); );
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
); );
} else { } else {
// Date based // Date based
@ -774,18 +762,12 @@ class PHPExcel_Worksheet_AutoFilter
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) $operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
$ruleValues[] = array( 'operator' => $operator, $ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
'value' => $maxVal
);
$columnFilterTests[$columnID] = array( $columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet', 'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues, 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
);
$filterColumn->setAttributes(
array('maxVal' => $maxVal)
); );
$filterColumn->setAttributes(array('maxVal' => $maxVal));
break; break;
} }
} }
@ -796,7 +778,7 @@ class PHPExcel_Worksheet_AutoFilter
// Execute the column tests for each row in the autoFilter range to determine show/hide, // Execute the column tests for each row in the autoFilter range to determine show/hide,
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) { for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
// echo 'Testing Row = ', $row,PHP_EOL; // echo 'Testing Row = ', $row,PHP_EOL;
$result = TRUE; $result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) { foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL; // echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue(); $cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
@ -805,16 +787,14 @@ class PHPExcel_Worksheet_AutoFilter
$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( array($cellValue, $columnFilterTest['arguments'])
$cellValue,
$columnFilterTest['arguments']
)
); );
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL; // echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result) if (!$result) {
break; break;
} }
}
// Set show/hide for the row based on the result of the autoFilter result // Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL; // echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
$this->_workSheet->getRowDimension($row)->setVisible($result); $this->_workSheet->getRowDimension($row)->setVisible($result);
@ -827,13 +807,14 @@ class PHPExcel_Worksheet_AutoFilter
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {
if ($key == '_workSheet') { if ($key == '_workSheet') {
// Detach from worksheet // Detach from worksheet
$this->{$key} = NULL; $this->{$key} = null;
} else { } else {
$this->{$key} = clone $value; $this->{$key} = clone $value;
} }
@ -858,5 +839,4 @@ class PHPExcel_Worksheet_AutoFilter
public function __toString() { public function __toString() {
return (string) $this->_range; return (string) $this->_range;
} }
} }

View File

@ -220,7 +220,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* *
* @return string * @return string
*/ */
public function getJoin() { public function getJoin()
{
return $this->_join; return $this->_join;
} }
@ -409,5 +410,4 @@ class PHPExcel_Worksheet_AutoFilter_Column
} }
} }
} }
} }

View File

@ -267,5 +267,4 @@ class PHPExcel_Worksheet_ColumnDimension
} }
} }
} }
} }

View File

@ -59,7 +59,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getFilename() { public function getFilename()
{
return basename($this->_path); return basename($this->_path);
} }
@ -68,7 +69,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getIndexedFilename() { public function getIndexedFilename()
{
$fileName = $this->getFilename(); $fileName = $this->getFilename();
$fileName = str_replace(' ', '_', $fileName); $fileName = str_replace(' ', '_', $fileName);
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension(); return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
@ -79,7 +81,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getExtension() { public function getExtension()
{
$exploded = explode(".", basename($this->_path)); $exploded = explode(".", basename($this->_path));
return $exploded[count($exploded) - 1]; return $exploded[count($exploded) - 1];
} }
@ -89,7 +92,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string * @return string
*/ */
public function getPath() { public function getPath()
{
return $this->_path; return $this->_path;
} }
@ -101,7 +105,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing * @return PHPExcel_Worksheet_Drawing
*/ */
public function setPath($pValue = '', $pVerifyFile = true) { public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) { if ($pVerifyFile) {
if (file_exists($pValue)) { if (file_exists($pValue)) {
$this->_path = $pValue; $this->_path = $pValue;
@ -124,7 +129,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
$this->_path $this->_path
. parent::getHashCode() . parent::getHashCode()
@ -135,7 +141,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -118,7 +118,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return boolean * @return boolean
*/ */
public function getVisible() { public function getVisible()
{
return $this->_visible; return $this->_visible;
} }
@ -128,7 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setVisible($pValue = false) { public function setVisible($pValue = false)
{
$this->_visible = $pValue; $this->_visible = $pValue;
return $this; return $this;
} }
@ -138,7 +140,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getBlurRadius() { public function getBlurRadius()
{
return $this->_blurRadius; return $this->_blurRadius;
} }
@ -148,7 +151,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setBlurRadius($pValue = 6) { public function setBlurRadius($pValue = 6)
{
$this->_blurRadius = $pValue; $this->_blurRadius = $pValue;
return $this; return $this;
} }
@ -158,7 +162,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getDistance() { public function getDistance()
{
return $this->_distance; return $this->_distance;
} }
@ -168,7 +173,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setDistance($pValue = 2) { public function setDistance($pValue = 2)
{
$this->_distance = $pValue; $this->_distance = $pValue;
return $this; return $this;
} }
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getDirection() { public function getDirection()
{
return $this->_direction; return $this->_direction;
} }
@ -188,7 +195,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setDirection($pValue = 0) { public function setDirection($pValue = 0)
{
$this->_direction = $pValue; $this->_direction = $pValue;
return $this; return $this;
} }
@ -198,7 +206,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getAlignment() { public function getAlignment()
{
return $this->_alignment; return $this->_alignment;
} }
@ -208,7 +217,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setAlignment($pValue = 0) { public function setAlignment($pValue = 0)
{
$this->_alignment = $pValue; $this->_alignment = $pValue;
return $this; return $this;
} }
@ -218,7 +228,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getColor() { public function getColor()
{
return $this->_color; return $this->_color;
} }
@ -229,7 +240,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_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;
} }
@ -239,7 +251,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return int * @return int
*/ */
public function getAlpha() { public function getAlpha()
{
return $this->_alpha; return $this->_alpha;
} }
@ -249,7 +262,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow * @return PHPExcel_Worksheet_Drawing_Shadow
*/ */
public function setAlpha($pValue = 0) { public function setAlpha($pValue = 0)
{
$this->_alpha = $pValue; $this->_alpha = $pValue;
return $this; return $this;
} }
@ -259,7 +273,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
($this->_visible ? 't' : 'f') ($this->_visible ? 't' : 'f')
. $this->_blurRadius . $this->_blurRadius
@ -275,7 +290,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -192,7 +192,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getOddHeader() { public function getOddHeader()
{
return $this->_oddHeader; return $this->_oddHeader;
} }
@ -202,7 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setOddHeader($pValue) { public function setOddHeader($pValue)
{
$this->_oddHeader = $pValue; $this->_oddHeader = $pValue;
return $this; return $this;
} }
@ -212,7 +214,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getOddFooter() { public function getOddFooter()
{
return $this->_oddFooter; return $this->_oddFooter;
} }
@ -222,7 +225,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setOddFooter($pValue) { public function setOddFooter($pValue)
{
$this->_oddFooter = $pValue; $this->_oddFooter = $pValue;
return $this; return $this;
} }
@ -232,7 +236,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getEvenHeader() { public function getEvenHeader()
return $this->_evenHeader; return $this->_evenHeader;
} }
@ -242,7 +247,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setEvenHeader($pValue) { public function setEvenHeader($pValue)
{
$this->_evenHeader = $pValue; $this->_evenHeader = $pValue;
return $this; return $this;
} }
@ -252,7 +258,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getEvenFooter() { public function getEvenFooter()
{
return $this->_evenFooter; return $this->_evenFooter;
} }
@ -262,7 +269,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setEvenFooter($pValue) { public function setEvenFooter($pValue)
{
$this->_evenFooter = $pValue; $this->_evenFooter = $pValue;
return $this; return $this;
} }
@ -272,7 +280,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getFirstHeader() { public function getFirstHeader()
{
return $this->_firstHeader; return $this->_firstHeader;
} }
@ -282,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstHeader($pValue) { public function setFirstHeader($pValue)
{
$this->_firstHeader = $pValue; $this->_firstHeader = $pValue;
return $this; return $this;
} }
@ -292,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return string * @return string
*/ */
public function getFirstFooter() { public function getFirstFooter()
{
return $this->_firstFooter; return $this->_firstFooter;
} }
@ -302,7 +313,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstFooter($pValue) { public function setFirstFooter($pValue)
{
$this->_firstFooter = $pValue; $this->_firstFooter = $pValue;
return $this; return $this;
} }
@ -312,7 +324,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getDifferentOddEven() { public function getDifferentOddEven()
{
return $this->_differentOddEven; return $this->_differentOddEven;
} }
@ -322,7 +335,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setDifferentOddEven($pValue = false) { public function setDifferentOddEven($pValue = false)
{
$this->_differentOddEven = $pValue; $this->_differentOddEven = $pValue;
return $this; return $this;
} }
@ -332,7 +346,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getDifferentFirst() { public function getDifferentFirst()
{
return $this->_differentFirst; return $this->_differentFirst;
} }
@ -342,7 +357,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setDifferentFirst($pValue = false) { public function setDifferentFirst($pValue = false)
{
$this->_differentFirst = $pValue; $this->_differentFirst = $pValue;
return $this; return $this;
} }
@ -352,7 +368,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getScaleWithDocument() { public function getScaleWithDocument()
{
return $this->_scaleWithDocument; return $this->_scaleWithDocument;
} }
@ -362,7 +379,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setScaleWithDocument($pValue = true) { public function setScaleWithDocument($pValue = true)
{
$this->_scaleWithDocument = $pValue; $this->_scaleWithDocument = $pValue;
return $this; return $this;
} }
@ -372,7 +390,8 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return boolean * @return boolean
*/ */
public function getAlignWithMargins() { public function getAlignWithMargins()
{
return $this->_alignWithMargins; return $this->_alignWithMargins;
} }
@ -382,7 +401,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setAlignWithMargins($pValue = true) { public function setAlignWithMargins($pValue = true)
{
$this->_alignWithMargins = $pValue; $this->_alignWithMargins = $pValue;
return $this; return $this;
} }
@ -395,7 +415,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) { public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
{
$this->_headerFooterImages[$location] = $image; $this->_headerFooterImages[$location] = $image;
return $this; return $this;
} }
@ -407,7 +428,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function removeImage($location = self::IMAGE_HEADER_LEFT) { public function removeImage($location = self::IMAGE_HEADER_LEFT)
{
if (isset($this->_headerFooterImages[$location])) { if (isset($this->_headerFooterImages[$location])) {
unset($this->_headerFooterImages[$location]); unset($this->_headerFooterImages[$location]);
} }
@ -421,7 +443,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_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!');
} }
@ -435,15 +458,28 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @return PHPExcel_Worksheet_HeaderFooterDrawing[] * @return PHPExcel_Worksheet_HeaderFooterDrawing[]
*/ */
public function getImages() { public function getImages()
{
// Sort array // Sort array
$images = array(); $images = array();
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT]; if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) {
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER]; $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT]; }
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT]; if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) {
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER]; $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT]; }
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
$images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
$images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
$images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
$images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
}
$this->_headerFooterImages = $images; $this->_headerFooterImages = $images;
return $this->_headerFooterImages; return $this->_headerFooterImages;
@ -452,7 +488,8 @@ class PHPExcel_Worksheet_HeaderFooter
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -195,7 +195,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -297,7 +297,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pValue * @param int $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) { public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
{
$this->_paperSize = $pValue; $this->_paperSize = $pValue;
return $this; return $this;
} }
@ -307,7 +308,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return string * @return string
*/ */
public function getOrientation() { public function getOrientation()
{
return $this->_orientation; return $this->_orientation;
} }
@ -317,7 +319,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pValue * @param string $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) { public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
{
$this->_orientation = $pValue; $this->_orientation = $pValue;
return $this; return $this;
} }
@ -327,7 +330,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getScale() { public function getScale()
{
return $this->_scale; return $this->_scale;
} }
@ -342,7 +346,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setScale($pValue = 100, $pUpdate = true) { public function setScale($pValue = 100, $pUpdate = true)
{
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 0, where 0 results in 100 // but it is apparently still able to handle any scale >= 0, where 0 results in 100
if (($pValue >= 0) || is_null($pValue)) { if (($pValue >= 0) || is_null($pValue)) {
@ -371,7 +376,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToPage($pValue = true) { public function setFitToPage($pValue = true)
{
$this->_fitToPage = $pValue; $this->_fitToPage = $pValue;
return $this; return $this;
} }
@ -381,7 +387,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getFitToHeight() { public function getFitToHeight()
{
return $this->_fitToHeight; return $this->_fitToHeight;
} }
@ -392,7 +399,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToHeight($pValue = 1, $pUpdate = true) { public function setFitToHeight($pValue = 1, $pUpdate = true)
{
$this->_fitToHeight = $pValue; $this->_fitToHeight = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = true; $this->_fitToPage = true;
@ -405,7 +413,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int? * @return int?
*/ */
public function getFitToWidth() { public function getFitToWidth()
{
return $this->_fitToWidth; return $this->_fitToWidth;
} }
@ -416,7 +425,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToWidth($pValue = 1, $pUpdate = true) { public function setFitToWidth($pValue = 1, $pUpdate = true)
{
$this->_fitToWidth = $pValue; $this->_fitToWidth = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = true; $this->_fitToPage = true;
@ -429,7 +439,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return boolean * @return boolean
*/ */
public function isColumnsToRepeatAtLeftSet() { public function isColumnsToRepeatAtLeftSet()
{
if (is_array($this->_columnsToRepeatAtLeft)) { if (is_array($this->_columnsToRepeatAtLeft)) {
if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') { if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
return true; return true;
@ -444,7 +455,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return array Containing start column and end column, empty array if option unset * @return array Containing start column and end column, empty array if option unset
*/ */
public function getColumnsToRepeatAtLeft() { public function getColumnsToRepeatAtLeft()
{
return $this->_columnsToRepeatAtLeft; return $this->_columnsToRepeatAtLeft;
} }
@ -454,7 +466,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset * @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setColumnsToRepeatAtLeft($pValue = null) { public function setColumnsToRepeatAtLeft($pValue = null)
{
if (is_array($pValue)) { if (is_array($pValue)) {
$this->_columnsToRepeatAtLeft = $pValue; $this->_columnsToRepeatAtLeft = $pValue;
} }
@ -468,7 +481,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pEnd * @param string $pEnd
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') { public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A')
{
$this->_columnsToRepeatAtLeft = array($pStart, $pEnd); $this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
return $this; return $this;
} }
@ -478,7 +492,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return boolean * @return boolean
*/ */
public function isRowsToRepeatAtTopSet() { public function isRowsToRepeatAtTopSet()
{
if (is_array($this->_rowsToRepeatAtTop)) { if (is_array($this->_rowsToRepeatAtTop)) {
if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) { if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
return true; return true;
@ -493,7 +508,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return array Containing start column and end column, empty array if option unset * @return array Containing start column and end column, empty array if option unset
*/ */
public function getRowsToRepeatAtTop() { public function getRowsToRepeatAtTop()
{
return $this->_rowsToRepeatAtTop; return $this->_rowsToRepeatAtTop;
} }
@ -503,7 +519,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset * @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setRowsToRepeatAtTop($pValue = null) { public function setRowsToRepeatAtTop($pValue = null)
{
if (is_array($pValue)) { if (is_array($pValue)) {
$this->_rowsToRepeatAtTop = $pValue; $this->_rowsToRepeatAtTop = $pValue;
} }
@ -517,7 +534,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pEnd * @param int $pEnd
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) { public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1)
{
$this->_rowsToRepeatAtTop = array($pStart, $pEnd); $this->_rowsToRepeatAtTop = array($pStart, $pEnd);
return $this; return $this;
} }
@ -527,7 +545,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return bool * @return bool
*/ */
public function getHorizontalCentered() { public function getHorizontalCentered()
{
return $this->_horizontalCentered; return $this->_horizontalCentered;
} }
@ -537,7 +556,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value * @param bool $value
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setHorizontalCentered($value = false) { public function setHorizontalCentered($value = false)
{
$this->_horizontalCentered = $value; $this->_horizontalCentered = $value;
return $this; return $this;
} }
@ -547,7 +567,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return bool * @return bool
*/ */
public function getVerticalCentered() { public function getVerticalCentered()
{
return $this->_verticalCentered; return $this->_verticalCentered;
} }
@ -557,7 +578,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value * @param bool $value
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setVerticalCentered($value = false) { public function setVerticalCentered($value = false)
{
$this->_verticalCentered = $value; $this->_verticalCentered = $value;
return $this; return $this;
} }
@ -572,7 +594,8 @@ class PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return string * @return string
*/ */
public function getPrintArea($index = 0) { public function getPrintArea($index = 0)
{
if ($index == 0) { if ($index == 0) {
return $this->_printArea; return $this->_printArea;
} }
@ -592,7 +615,8 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1 * Print areas are numbered from 1
* @return boolean * @return boolean
*/ */
public function isPrintAreaSet($index = 0) { public function isPrintAreaSet($index = 0)
{
if ($index == 0) { if ($index == 0) {
return !is_null($this->_printArea); return !is_null($this->_printArea);
} }
@ -609,7 +633,8 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1 * Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function clearPrintArea($index = 0) { public function clearPrintArea($index = 0)
{
if ($index == 0) { if ($index == 0) {
$this->_printArea = null; $this->_printArea = null;
} else { } else {
@ -643,7 +668,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
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) {
@ -701,7 +727,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function addPrintArea($value, $index = -1) { public function addPrintArea($value, $index = -1)
{
return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT); return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
} }
@ -759,7 +786,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int * @return int
*/ */
public function getFirstPageNumber() { public function getFirstPageNumber()
{
return $this->_firstPageNumber; return $this->_firstPageNumber;
} }
@ -769,7 +797,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $value * @param int $value
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function setFirstPageNumber($value = null) { public function setFirstPageNumber($value = null)
{
$this->_firstPageNumber = $value; $this->_firstPageNumber = $value;
return $this; return $this;
} }
@ -779,14 +808,16 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return PHPExcel_Worksheet_HeaderFooter * @return PHPExcel_Worksheet_HeaderFooter
*/ */
public function resetFirstPageNumber() { public function resetFirstPageNumber()
{
return $this->setFirstPageNumber(null); return $this->setFirstPageNumber(null);
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {