PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-13 13:36:53 +02:00
parent 7d086fdbee
commit 141a61a908
7 changed files with 246 additions and 154 deletions

View File

@ -79,7 +79,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @var PHPExcel_Worksheet_AutoFilter
*/
private $_parent = NULL;
private $_parent = null;
/**
@ -128,7 +128,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param string $pColumn Column (e.g. A)
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
*/
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL)
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = null)
{
$this->_columnIndex = $pColumn;
$this->_parent = $pParent;
@ -139,7 +139,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getColumnIndex() {
public function getColumnIndex()
{
return $this->_columnIndex;
}
@ -150,10 +151,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setColumnIndex($pColumn) {
public function setColumnIndex($pColumn)
{
// Uppercase coordinate
$pColumn = strtoupper($pColumn);
if ($this->_parent !== NULL) {
if ($this->_parent !== null) {
$this->_parent->testColumnInRange($pColumn);
}
@ -167,7 +169,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter
*/
public function getParent() {
public function getParent()
{
return $this->_parent;
}
@ -177,7 +180,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param PHPExcel_Worksheet_AutoFilter
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null)
{
$this->_parent = $pParent;
return $this;
@ -188,7 +192,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getFilterType() {
public function getFilterType()
{
return $this->_filterType;
}
@ -199,8 +204,9 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
if (!in_array($pFilterType,self::$_filterTypes)) {
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
{
if (!in_array($pFilterType, self::$_filterTypes)) {
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
}
@ -225,10 +231,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
{
// Lowercase And/Or
$pJoin = strtolower($pJoin);
if (!in_array($pJoin,self::$_ruleJoins)) {
if (!in_array($pJoin, self::$_ruleJoins)) {
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
}
@ -244,7 +251,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setAttributes($pAttributes = array()) {
public function setAttributes($pAttributes = array())
{
$this->_attributes = $pAttributes;
return $this;
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setAttribute($pName, $pValue) {
public function setAttribute($pName, $pValue)
{
$this->_attributes[$pName] = $pValue;
return $this;
@ -269,7 +278,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getAttributes() {
public function getAttributes()
{
return $this->_attributes;
}
@ -279,10 +289,12 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param string $pName Attribute Name
* @return string
*/
public function getAttribute($pName) {
if (isset($this->_attributes[$pName]))
public function getAttribute($pName)
{
if (isset($this->_attributes[$pName])) {
return $this->_attributes[$pName];
return NULL;
}
return null;
}
/**
@ -291,7 +303,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function getRules() {
public function getRules()
{
return $this->_ruleset;
}
@ -301,7 +314,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function getRule($pIndex) {
public function getRule($pIndex)
{
if (!isset($this->_ruleset[$pIndex])) {
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
}
@ -313,7 +327,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function createRule() {
public function createRule()
{
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
return end($this->_ruleset);
@ -326,7 +341,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) {
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true)
{
$pRule->setParent($this);
$this->_ruleset[] = $pRule;
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
* @param integer $pIndex Rule index in the ruleset array
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function deleteRule($pIndex) {
public function deleteRule($pIndex)
{
if (isset($this->_ruleset[$pIndex])) {
unset($this->_ruleset[$pIndex]);
// If we've just deleted down to a single rule, then reset And/Or joining to Or
@ -357,7 +374,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function clearRules() {
public function clearRules()
{
$this->_ruleset = array();
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
@ -367,13 +385,14 @@ class PHPExcel_Worksheet_AutoFilter_Column
/**
* 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 == '_parent') {
// Detach from autofilter parent
$this->$key = NULL;
$this->$key = null;
} else {
$this->$key = clone $value;
}

View File

@ -234,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @var PHPExcel_Worksheet_AutoFilter_Column
*/
private $_parent = NULL;
private $_parent = null;
/**
@ -272,7 +272,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
*/
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
{
$this->_parent = $pParent;
}
@ -282,7 +282,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getRuleType() {
public function getRuleType()
{
return $this->_ruleType;
}
@ -293,8 +294,9 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
if (!in_array($pRuleType,self::$_ruleTypes)) {
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER)
{
if (!in_array($pRuleType, self::$_ruleTypes)) {
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
}
@ -308,7 +310,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getValue() {
public function getValue()
{
return $this->_value;
}
@ -319,17 +322,18 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setValue($pValue = '') {
public function setValue($pValue = '')
{
if (is_array($pValue)) {
$grouping = -1;
foreach ($pValue as $key => $value) {
// Validate array entries
if (!in_array($key,self::$_dateTimeGroups)) {
if (!in_array($key, self::$_dateTimeGroups)) {
// Remove any invalid entries from the value array
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) {
@ -348,7 +352,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getOperator() {
public function getOperator()
{
return $this->_operator;
}
@ -359,11 +364,13 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
if (empty($pOperator))
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL)
{
if (empty($pOperator)) {
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
if ((!in_array($pOperator,self::$_operators)) &&
(!in_array($pOperator,self::$_topTenValue))) {
}
if ((!in_array($pOperator, self::$_operators)) &&
(!in_array($pOperator, self::$_topTenValue))) {
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
}
$this->_operator = $pOperator;
@ -376,7 +383,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return string
*/
public function getGrouping() {
public function getGrouping()
{
return $this->_grouping;
}
@ -387,14 +395,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setGrouping($pGrouping = NULL) {
if (($pGrouping !== NULL) &&
(!in_array($pGrouping,self::$_dateTimeGroups)) &&
(!in_array($pGrouping,self::$_dynamicTypes)) &&
(!in_array($pGrouping,self::$_topTenType))) {
public function setGrouping($pGrouping = null)
{
if (($pGrouping !== null) &&
(!in_array($pGrouping, self::$_dateTimeGroups)) &&
(!in_array($pGrouping, self::$_dynamicTypes)) &&
(!in_array($pGrouping, self::$_topTenType))) {
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
}
$this->_grouping = $pGrouping;
return $this;
@ -409,14 +417,16 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null)
{
$this->setOperator($pOperator);
$this->setValue($pValue);
// Only set grouping if it's been passed in as a user-supplied argument,
// otherwise we're calculating it when we setValue() and don't want to overwrite that
// If the user supplies an argumnet for grouping, then on their own head be it
if ($pGrouping !== NULL)
if ($pGrouping !== null) {
$this->setGrouping($pGrouping);
}
return $this;
}
@ -426,7 +436,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
*
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getParent() {
public function getParent()
{
return $this->_parent;
}
@ -436,7 +447,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
* @param PHPExcel_Worksheet_AutoFilter_Column
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
*/
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
{
$this->_parent = $pParent;
return $this;
@ -445,13 +457,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
/**
* 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 == '_parent') {
// Detach from autofilter column parent
$this->$key = NULL;
$this->$key = null;
} else {
$this->$key = clone $value;
}
@ -460,5 +473,4 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
}
}
}
}

View File

@ -154,7 +154,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getImageIndex() {
public function getImageIndex()
{
return $this->_imageIndex;
}
@ -163,7 +164,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -173,7 +175,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setName($pValue = '') {
public function setName($pValue = '')
{
$this->_name = $pValue;
return $this;
}
@ -183,7 +186,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getDescription() {
public function getDescription()
{
return $this->_description;
}
@ -193,7 +197,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setDescription($pValue = '') {
public function setDescription($pValue = '')
{
$this->_description = $pValue;
return $this;
}
@ -203,7 +208,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
public function getWorksheet()
{
return $this->_worksheet;
}
@ -215,7 +221,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
{
if (is_null($this->_worksheet)) {
// Add drawing to PHPExcel_Worksheet
$this->_worksheet = $pValue;
@ -228,7 +235,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
while ($iterator->valid()) {
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
$this->_worksheet->getDrawingCollection()->offsetUnset($iterator->key());
$this->_worksheet = null;
break;
}
@ -248,7 +255,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string
*/
public function getCoordinates() {
public function getCoordinates()
{
return $this->_coordinates;
}
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setCoordinates($pValue = 'A1') {
public function setCoordinates($pValue = 'A1')
{
$this->_coordinates = $pValue;
return $this;
}
@ -268,7 +277,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getOffsetX() {
public function getOffsetX()
{
return $this->_offsetX;
}
@ -278,7 +288,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setOffsetX($pValue = 0) {
public function setOffsetX($pValue = 0)
{
$this->_offsetX = $pValue;
return $this;
}
@ -288,7 +299,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getOffsetY() {
public function getOffsetY()
{
return $this->_offsetY;
}
@ -298,7 +310,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setOffsetY($pValue = 0) {
public function setOffsetY($pValue = 0)
{
$this->_offsetY = $pValue;
return $this;
}
@ -308,7 +321,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -318,7 +332,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWidth($pValue = 0) {
public function setWidth($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
@ -336,7 +351,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -346,7 +362,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setHeight($pValue = 0) {
public function setHeight($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
@ -372,7 +389,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $height
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setWidthAndHeight($width = 0, $height = 0) {
public function setWidthAndHeight($width = 0, $height = 0)
{
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
@ -396,7 +414,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return boolean
*/
public function getResizeProportional() {
public function getResizeProportional()
{
return $this->_resizeProportional;
}
@ -406,7 +425,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param boolean $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setResizeProportional($pValue = true) {
public function setResizeProportional($pValue = true)
{
$this->_resizeProportional = $pValue;
return $this;
}
@ -416,7 +436,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return int
*/
public function getRotation() {
public function getRotation()
{
return $this->_rotation;
}
@ -426,7 +447,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setRotation($pValue = 0) {
public function setRotation($pValue = 0)
{
$this->_rotation = $pValue;
return $this;
}
@ -436,7 +458,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function getShadow() {
public function getShadow()
{
return $this->_shadow;
}
@ -447,7 +470,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
{
$this->_shadow = $pValue;
return $this;
}
@ -457,26 +481,16 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
*
* @return string Hash code
*/
public function getHashCode() {
return md5(
$this->_name
. $this->_description
. $this->_worksheet->getHashCode()
. $this->_coordinates
. $this->_offsetX
. $this->_offsetY
. $this->_width
. $this->_height
. $this->_rotation
. $this->_shadow->getHashCode()
. __CLASS__
);
public function getHashCode()
{
return md5($this->_name.$this->_description.$this->_worksheet->getHashCode().$this->_coordinates.$this->_offsetX.$this->_offsetY.$this->_width.$this->_height.$this->_rotation.$this->_shadow->getHashCode().__CLASS__);
}
/**
* 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

@ -92,11 +92,11 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
// Initialise values
$this->_path = '';
$this->_name = '';
$this->_offsetX = 0;
$this->_offsetY = 0;
$this->_width = 0;
$this->_height = 0;
$this->_resizeProportional = true;
$this->_offsetX = 0;
$this->_offsetY = 0;
$this->_width = 0;
$this->_height = 0;
$this->_resizeProportional = true;
}
/**
@ -104,7 +104,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -114,7 +115,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setName($pValue = '') {
public function setName($pValue = '')
{
$this->_name = $pValue;
return $this;
}
@ -124,7 +126,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getOffsetX() {
public function getOffsetX()
{
return $this->_offsetX;
}
@ -134,7 +137,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetX($pValue = 0) {
public function setOffsetX($pValue = 0)
{
$this->_offsetX = $pValue;
return $this;
}
@ -144,7 +148,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getOffsetY() {
public function getOffsetY()
{
return $this->_offsetY;
}
@ -154,7 +159,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetY($pValue = 0) {
public function setOffsetY($pValue = 0)
{
$this->_offsetY = $pValue;
return $this;
}
@ -164,7 +170,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -174,7 +181,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setWidth($pValue = 0) {
public function setWidth($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / $this->_height;
@ -192,7 +200,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return int
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -202,7 +211,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setHeight($pValue = 0) {
public function setHeight($pValue = 0)
{
// Resize proportional?
if ($this->_resizeProportional && $pValue != 0) {
$ratio = $this->_width / $this->_height;
@ -228,7 +238,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param int $height
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setWidthAndHeight($width = 0, $height = 0) {
public function setWidthAndHeight($width = 0, $height = 0)
{
$xratio = $width / $this->_width;
$yratio = $height / $this->_height;
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
@ -248,7 +259,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return boolean
*/
public function getResizeProportional() {
public function getResizeProportional()
{
return $this->_resizeProportional;
}
@ -258,7 +270,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setResizeProportional($pValue = true) {
public function setResizeProportional($pValue = true)
{
$this->_resizeProportional = $pValue;
return $this;
}
@ -268,7 +281,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getFilename() {
public function getFilename()
{
return basename($this->_path);
}
@ -277,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getExtension() {
public function getExtension()
{
$parts = explode(".", basename($this->_path));
return end($parts);
}
@ -287,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string
*/
public function getPath() {
public function getPath()
{
return $this->_path;
}
@ -299,7 +315,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
@ -322,9 +339,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
$this->_path
. $this->_name
. $this->_offsetX
. $this->_offsetY
@ -337,7 +355,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
/**
* 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

@ -81,10 +81,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
public function __construct()
{
// Initialise values
$this->_imageResource = null;
$this->_renderingFunction = self::RENDERING_DEFAULT;
$this->_imageResource = null;
$this->_renderingFunction = self::RENDERING_DEFAULT;
$this->_mimeType = self::MIMETYPE_DEFAULT;
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
// Initialize parent
parent::__construct();
@ -95,7 +95,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return resource
*/
public function getImageResource() {
public function getImageResource()
{
return $this->_imageResource;
}
@ -105,7 +106,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @param $value resource
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setImageResource($value = null) {
public function setImageResource($value = null)
{
$this->_imageResource = $value;
if (!is_null($this->_imageResource)) {
@ -121,7 +123,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getRenderingFunction() {
public function getRenderingFunction()
{
return $this->_renderingFunction;
}
@ -131,7 +134,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @param string $value
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT)
{
$this->_renderingFunction = $value;
return $this;
}
@ -141,7 +145,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getMimeType() {
public function getMimeType()
{
return $this->_mimeType;
}
@ -151,7 +156,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @param string $value
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT)
{
$this->_mimeType = $value;
return $this;
}
@ -161,7 +167,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string
*/
public function getIndexedFilename() {
public function getIndexedFilename()
{
$extension = strtolower($this->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
@ -174,9 +181,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_renderingFunction
$this->_renderingFunction
. $this->_mimeType
. $this->_uniqueName
. parent::getHashCode()

View File

@ -89,7 +89,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getLeft() {
public function getLeft()
{
return $this->_left;
}
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setLeft($pValue) {
public function setLeft($pValue)
{
$this->_left = $pValue;
return $this;
}
@ -109,7 +111,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getRight() {
public function getRight()
{
return $this->_right;
}
@ -119,7 +122,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setRight($pValue) {
public function setRight($pValue)
{
$this->_right = $pValue;
return $this;
}
@ -129,7 +133,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getTop() {
public function getTop()
{
return $this->_top;
}
@ -139,7 +144,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setTop($pValue) {
public function setTop($pValue)
{
$this->_top = $pValue;
return $this;
}
@ -149,7 +155,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getBottom() {
public function getBottom()
{
return $this->_bottom;
}
@ -159,7 +166,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setBottom($pValue) {
public function setBottom($pValue)
{
$this->_bottom = $pValue;
return $this;
}
@ -169,7 +177,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getHeader() {
public function getHeader()
{
return $this->_header;
}
@ -179,7 +188,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setHeader($pValue) {
public function setHeader($pValue)
{
$this->_header = $pValue;
return $this;
}
@ -189,7 +199,8 @@ class PHPExcel_Worksheet_PageMargins
*
* @return double
*/
public function getFooter() {
public function getFooter()
{
return $this->_footer;
}
@ -199,7 +210,8 @@ class PHPExcel_Worksheet_PageMargins
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setFooter($pValue) {
public function setFooter($pValue)
{
$this->_footer = $pValue;
return $this;
}
@ -207,7 +219,8 @@ class PHPExcel_Worksheet_PageMargins
/**
* 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

@ -86,7 +86,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return int
*/
public function getZoomScale() {
public function getZoomScale()
{
return $this->_zoomScale;
}
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_SheetView
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_SheetView
*/
public function setZoomScale($pValue = 100) {
public function setZoomScale($pValue = 100)
{
// 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 >= 1
if (($pValue >= 1) || is_null($pValue)) {
@ -115,7 +117,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return int
*/
public function getZoomScaleNormal() {
public function getZoomScaleNormal()
{
return $this->_zoomScaleNormal;
}
@ -128,7 +131,8 @@ class PHPExcel_Worksheet_SheetView
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_SheetView
*/
public function setZoomScaleNormal($pValue = 100) {
public function setZoomScaleNormal($pValue = 100)
{
if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScaleNormal = $pValue;
} else {
@ -142,7 +146,8 @@ class PHPExcel_Worksheet_SheetView
*
* @return string
*/
public function getView() {
public function getView()
{
return $this->_sheetviewType;
}
@ -158,11 +163,12 @@ class PHPExcel_Worksheet_SheetView
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_SheetView
*/
public function setView($pValue = NULL) {
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
// via the user interface
if ($pValue === NULL)
public function setView($pValue = null)
{
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
if ($pValue === null) {
$pValue = self::SHEETVIEW_NORMAL;
}
if (in_array($pValue, self::$_sheetViewTypes)) {
$this->_sheetviewType = $pValue;
} else {
@ -175,7 +181,8 @@ class PHPExcel_Worksheet_SheetView
/**
* 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)) {