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
*/
private $_workSheet = NULL;
private $_workSheet = null;
/**
@ -65,7 +65,7 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $pRange Cell range (i.e. A1:E10)
* @param PHPExcel_Worksheet $pSheet
*/
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = NULL)
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = null)
{
$this->_range = $pRange;
$this->_workSheet = $pSheet;
@ -76,7 +76,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return PHPExcel_Worksheet
*/
public function getParent() {
public function getParent()
{
return $this->_workSheet;
}
@ -86,7 +87,8 @@ class PHPExcel_Worksheet_AutoFilter
* @param PHPExcel_Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setParent(PHPExcel_Worksheet $pSheet = NULL) {
public function setParent(PHPExcel_Worksheet $pSheet = null)
{
$this->_workSheet = $pSheet;
return $this;
@ -97,7 +99,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return string
*/
public function getRange() {
public function getRange()
{
return $this->_range;
}
@ -108,14 +111,15 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setRange($pRange = '') {
public function setRange($pRange = '')
{
// Uppercase coordinate
$cellAddress = explode('!',strtoupper($pRange));
if (count($cellAddress) > 1) {
list($worksheet, $pRange) = $cellAddress;
}
if (strpos($pRange,':') !== FALSE) {
if (strpos($pRange, ':') !== false) {
$this->_range = $pRange;
} elseif (empty($pRange)) {
$this->_range = '';
@ -146,7 +150,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumns() {
public function getColumns()
{
return $this->_columns;
}
@ -157,7 +162,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The column offset within the autofilter range
*/
public function testColumnInRange($column) {
public function testColumnInRange($column)
{
if (empty($this->_range)) {
throw new PHPExcel_Exception("No autofilter range is defined.");
}
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The offset of the specified column within the autofilter range
*/
public function getColumnOffset($pColumn) {
public function getColumnOffset($pColumn)
{
return $this->testColumnInRange($pColumn);
}
@ -189,7 +196,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumn($pColumn) {
public function getColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (!isset($this->_columns[$pColumn])) {
@ -206,7 +214,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumnByOffset($pColumnOffset = 0) {
public function getColumnByOffset($pColumnOffset = 0)
{
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
@ -250,7 +259,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function clearColumn($pColumn) {
public function clearColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (isset($this->_columns[$pColumn])) {
@ -271,11 +281,12 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $toColumn Column name (e.g. B)
* @return PHPExcel_Worksheet_AutoFilter
*/
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) {
public function shiftColumn($fromColumn = null, $toColumn = null)
{
$fromColumn = strtoupper($fromColumn);
$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]->setColumnIndex($toColumn);
$this->_columns[$toColumn] = $this->_columns[$fromColumn];
@ -300,7 +311,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSetValues = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
return in_array($cellValue, $dataSetValues);
@ -317,7 +328,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dateSet = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
@ -338,12 +349,12 @@ class PHPExcel_Worksheet_AutoFilter
}
foreach ($dateSet as $dateValue) {
// Use of substr to extract value at the appropriate group level
if (substr($dtVal,0,strlen($dateValue)) == $dateValue)
return TRUE;
if (substr($dtVal,0,strlen($dateValue)) == $dateValue) {
return true;
}
}
}
return FALSE;
return false;
}
/**
@ -357,12 +368,12 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : FALSE;
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
}
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
@ -392,13 +403,13 @@ class PHPExcel_Worksheet_AutoFilter
} elseif ($rule['value'] == '') {
switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
$retVal = (($cellValue == '') || ($cellValue === NULL));
$retVal = (($cellValue == '') || ($cellValue === null));
break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL :
$retVal = (($cellValue != '') && ($cellValue !== NULL));
$retVal = (($cellValue != '') && ($cellValue !== null));
break;
default :
$retVal = TRUE;
$retVal = true;
break;
}
} else {
@ -411,8 +422,9 @@ class PHPExcel_Worksheet_AutoFilter
$returnVal = $returnVal || $retVal;
// Break as soon as we have a TRUE match for OR joins,
// to avoid unnecessary additional code execution
if ($returnVal)
if ($returnVal) {
return $returnVal;
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND :
$returnVal = $returnVal && $retVal;
@ -433,18 +445,18 @@ class PHPExcel_Worksheet_AutoFilter
private static function _filterTestInPeriodDateSet($cellValue, $monthSet)
{
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
if (is_numeric($cellValue)) {
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
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();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$val = $maxVal = NULL;
$val = $maxVal = null;
$ruleValues = array();
$baseDate = PHPExcel_Calculation_DateTime::DATENOW();
@ -480,22 +492,22 @@ class PHPExcel_Worksheet_AutoFilter
$baseDate = strtotime('-7 days', $baseDate);
break;
case PHPExcel_Worksheet_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;
case PHPExcel_Worksheet_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;
case PHPExcel_Worksheet_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;
case PHPExcel_Worksheet_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;
case PHPExcel_Worksheet_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;
case PHPExcel_Worksheet_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;
}
@ -508,30 +520,30 @@ class PHPExcel_Worksheet_AutoFilter
break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE :
$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;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
case PHPExcel_Worksheet_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;
$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;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
$thisMonth = date('m', $baseDate);
$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;
$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;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
case PHPExcel_Worksheet_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;
$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;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK :
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK :
@ -555,33 +567,20 @@ class PHPExcel_Worksheet_AutoFilter
}
// Set the filter column rule attributes ready for writing
$filterColumn->setAttributes(array( 'val' => $val,
'maxVal' => $maxVal
)
);
$filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
// 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' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN,
'value' => $maxVal
);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
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' => 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;
$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);
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
// 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();
foreach ($this->_columns as $columnID => $filterColumn) {
@ -619,17 +618,15 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValues[] = $rule->getValue();
}
// Test if we want to include blanks in our filter criteria
$blanks = FALSE;
$blanks = false;
$ruleDataSet = array_filter($ruleValues);
if (count($ruleValues) != count($ruleDataSet))
$blanks = TRUE;
$blanks = true;
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInSimpleDataSet',
'arguments' => array( 'filterValues' => $ruleDataSet,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
);
} else {
// Filter on date group values
@ -669,14 +666,12 @@ class PHPExcel_Worksheet_AutoFilter
$arguments['dateTime'] = array_filter($arguments['dateTime']);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInDateGroupSet',
'arguments' => array( 'filterValues' => $arguments,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
);
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER :
$customRuleForBlanks = FALSE;
$customRuleForBlanks = false;
$ruleValues = array();
// Build a list of the filter value selections
foreach ($rules as $rule) {
@ -687,21 +682,16 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValue = preg_quote($ruleValue);
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
if (trim($ruleValue) == '') {
$customRuleForBlanks = TRUE;
$customRuleForBlanks = true;
$ruleValue = trim($ruleValue);
}
}
$ruleValues[] = array( 'operator' => $rule->getOperator(),
'value' => $ruleValue
);
$ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
}
$join = $filterColumn->getJoin();
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => $join,
'customRuleForBlanks' => $customRuleForBlanks
)
'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
);
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
@ -714,19 +704,17 @@ class PHPExcel_Worksheet_AutoFilter
// Number (Average) based
// Calculate the average
$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
$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_LESSTHAN;
$ruleValues[] = array( 'operator' => $operator,
$ruleValues[] = array('operator' => $operator,
'value' => $average
);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
} else {
// Date based
@ -774,18 +762,12 @@ class PHPExcel_Worksheet_AutoFilter
$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_LESSTHANOREQUAL;
$ruleValues[] = array( 'operator' => $operator,
'value' => $maxVal
);
$ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
);
$filterColumn->setAttributes(
array('maxVal' => $maxVal)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
$filterColumn->setAttributes(array('maxVal' => $maxVal));
break;
}
}
@ -796,7 +778,7 @@ class PHPExcel_Worksheet_AutoFilter
// Execute the column tests for each row in the autoFilter range to determine show/hide,
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
// echo 'Testing Row = ', $row,PHP_EOL;
$result = TRUE;
$result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
@ -805,15 +787,13 @@ class PHPExcel_Worksheet_AutoFilter
$result = $result &&
call_user_func_array(
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
array(
$cellValue,
$columnFilterTest['arguments']
)
array($cellValue, $columnFilterTest['arguments'])
);
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result)
if (!$result) {
break;
}
}
// Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
@ -827,13 +807,14 @@ class PHPExcel_Worksheet_AutoFilter
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
if ($key == '_workSheet') {
// Detach from worksheet
$this->{$key} = NULL;
$this->{$key} = null;
} else {
$this->{$key} = clone $value;
}
@ -858,5 +839,4 @@ class PHPExcel_Worksheet_AutoFilter
public function __toString() {
return (string) $this->_range;
}
}

View File

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

View File

@ -333,7 +333,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
unset($pValue[$key]);
} else {
// Work out what the dateTime grouping will be
$grouping = max($grouping, array_search($key,self::$_dateTimeGroups));
$grouping = max($grouping, array_search($key, self::$_dateTimeGroups));
}
}
if (count($pValue) == 0) {

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
*/
public function getFilename() {
public function getFilename()
{
return basename($this->_path);
}
@ -68,7 +69,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getIndexedFilename() {
public function getIndexedFilename()
{
$fileName = $this->getFilename();
$fileName = str_replace(' ', '_', $fileName);
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
*/
public function getExtension() {
public function getExtension()
{
$exploded = explode(".", basename($this->_path));
return $exploded[count($exploded) - 1];
}
@ -89,7 +92,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getPath() {
public function getPath()
{
return $this->_path;
}
@ -101,7 +105,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
@ -124,9 +129,10 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
$this->_path
. parent::getHashCode()
. __CLASS__
);
@ -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.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

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

View File

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

View File

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

View File

@ -405,7 +405,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @param string $id1
* @param string $id2
* @param boolean $isMultiLevelSeries
*
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)

View File

@ -144,7 +144,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
$mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);