PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-15 13:17:40 +02:00
parent 96f3d0e6ee
commit 5508013569
8 changed files with 371 additions and 310 deletions

View File

@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_fitToPage = FALSE;
private $_fitToPage = false;
/**
* Fit To Height
@ -251,28 +251,28 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_horizontalCentered = FALSE;
private $_horizontalCentered = false;
/**
* Center page vertically
*
* @var boolean
*/
private $_verticalCentered = FALSE;
private $_verticalCentered = false;
/**
* Print area
*
* @var string
*/
private $_printArea = NULL;
private $_printArea = null;
/**
* First page number
*
* @var int
*/
private $_firstPageNumber = NULL;
private $_firstPageNumber = null;
/**
* Create a new PHPExcel_Worksheet_PageSetup
@ -286,7 +286,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int
*/
public function getPaperSize() {
public function getPaperSize()
{
return $this->_paperSize;
}
@ -370,7 +371,7 @@ 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;
}
@ -391,10 +392,10 @@ 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;
$this->_fitToPage = true;
}
return $this;
}
@ -415,10 +416,10 @@ 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;
$this->_fitToPage = true;
}
return $this;
}
@ -610,7 +611,7 @@ class PHPExcel_Worksheet_PageSetup
*/
public function clearPrintArea($index = 0) {
if ($index == 0) {
$this->_printArea = NULL;
$this->_printArea = null;
} else {
$printAreas = explode(',', $this->_printArea);
if (isset($printAreas[$index-1])) {

View File

@ -166,7 +166,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function isProtectionEnabled() {
function isProtectionEnabled()
{
return $this->_sheet ||
$this->_objects ||
$this->_scenarios ||
@ -190,7 +191,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSheet() {
function getSheet()
{
return $this->_sheet;
}
@ -200,7 +202,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false) {
function setSheet($pValue = false)
{
$this->_sheet = $pValue;
return $this;
}
@ -210,7 +213,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getObjects() {
function getObjects()
{
return $this->_objects;
}
@ -220,7 +224,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false) {
function setObjects($pValue = false)
{
$this->_objects = $pValue;
return $this;
}
@ -230,7 +235,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getScenarios() {
function getScenarios()
{
return $this->_scenarios;
}
@ -240,7 +246,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false) {
function setScenarios($pValue = false)
{
$this->_scenarios = $pValue;
return $this;
}
@ -250,7 +257,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatCells() {
function getFormatCells()
{
return $this->_formatCells;
}
@ -260,7 +268,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false) {
function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue;
return $this;
}
@ -270,7 +279,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatColumns() {
function getFormatColumns()
{
return $this->_formatColumns;
}
@ -280,7 +290,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false) {
function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue;
return $this;
}
@ -290,7 +301,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatRows() {
function getFormatRows()
{
return $this->_formatRows;
}
@ -300,7 +312,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false) {
function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue;
return $this;
}
@ -310,7 +323,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertColumns() {
function getInsertColumns()
{
return $this->_insertColumns;
}
@ -320,7 +334,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false) {
function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue;
return $this;
}
@ -330,7 +345,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertRows() {
function getInsertRows()
{
return $this->_insertRows;
}
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false) {
function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue;
return $this;
}
@ -350,7 +367,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertHyperlinks() {
function getInsertHyperlinks()
{
return $this->_insertHyperlinks;
}
@ -360,7 +378,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false) {
function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue;
return $this;
}
@ -370,7 +389,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteColumns() {
function getDeleteColumns()
{
return $this->_deleteColumns;
}
@ -380,7 +400,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false) {
function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue;
return $this;
}
@ -390,7 +411,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteRows() {
function getDeleteRows()
{
return $this->_deleteRows;
}
@ -400,7 +422,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false) {
function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue;
return $this;
}
@ -410,7 +433,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectLockedCells() {
function getSelectLockedCells()
{
return $this->_selectLockedCells;
}
@ -420,7 +444,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false) {
function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue;
return $this;
}
@ -430,7 +455,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSort() {
function getSort()
{
return $this->_sort;
}
@ -440,7 +466,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false) {
function setSort($pValue = false)
{
$this->_sort = $pValue;
return $this;
}
@ -450,7 +477,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getAutoFilter() {
function getAutoFilter()
{
return $this->_autoFilter;
}
@ -460,7 +488,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false) {
function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue;
return $this;
}
@ -470,7 +499,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getPivotTables() {
function getPivotTables()
{
return $this->_pivotTables;
}
@ -480,7 +510,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false) {
function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue;
return $this;
}
@ -490,7 +521,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectUnlockedCells() {
function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells;
}
@ -500,7 +532,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false) {
function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue;
return $this;
}
@ -510,7 +543,8 @@ class PHPExcel_Worksheet_Protection
*
* @return string
*/
function getPassword() {
function getPassword()
{
return $this->_password;
}
@ -521,7 +555,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false) {
function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
@ -532,7 +567,8 @@ class PHPExcel_Worksheet_Protection
/**
* 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

@ -65,7 +65,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getIncludeCharts() {
public function getIncludeCharts()
{
return $this->_includeCharts;
}
@ -93,7 +94,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getPreCalculateFormulas() {
public function getPreCalculateFormulas()
{
return $this->_preCalculateFormulas;
}
@ -105,7 +107,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter
*/
public function setPreCalculateFormulas($pValue = TRUE) {
public function setPreCalculateFormulas($pValue = true)
{
$this->_preCalculateFormulas = (boolean) $pValue;
return $this;
}
@ -115,7 +118,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getUseDiskCaching() {
public function getUseDiskCaching()
{
return $this->_useDiskCaching;
}
@ -127,10 +131,11 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007
*/
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) {
public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) {
if ($pDirectory !== null) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
@ -145,7 +150,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return string
*/
public function getDiskCachingDirectory() {
public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory;
}
}

View File

@ -32,7 +32,8 @@
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart {
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{
/**
* Write charts to XML format
*
@ -41,7 +42,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeChart(PHPExcel_Chart $pChart = null) {
public function writeChart(PHPExcel_Chart $pChart = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -115,7 +117,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) {
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{
if (is_null($title)) {
return;
}
@ -159,7 +162,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) {
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{
if (is_null($legend)) {
return;
}
@ -349,7 +353,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeDataLbls($objWriter, $chartLayout) {
private function _writeDataLbls($objWriter, $chartLayout)
{
$objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey');
@ -403,7 +408,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) {
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{
$objWriter->startElement('c:catAx');
if ($id1 > 0) {
@ -524,7 +530,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) {
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{
$objWriter->startElement('c:valAx');
if ($id2 > 0) {
@ -1004,7 +1011,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array
* @throws PHPExcel_Writer_Exception
*/
private static function _getChartType($plotArea) {
private static function _getChartType($plotArea)
{
$groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) {
@ -1036,7 +1044,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) {
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotGroup)) {
return;
}
@ -1209,7 +1218,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) {
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{
if (is_null($plotSeriesLabel)) {
return;
}
@ -1246,7 +1256,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) {
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1337,7 +1348,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) {
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1383,7 +1395,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) {
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{
$objWriter->startElement('c:layout');
if (!is_null($layout)) {
@ -1451,7 +1464,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeAlternateContent($objWriter) {
private function _writeAlternateContent($objWriter)
{
$objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1480,7 +1494,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePrintSettings($objWriter) {
private function _writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter');

View File

@ -159,7 +159,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
}
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
if ($pPHPExcel->hasRibbonBinObjects()) {
// Some additional objects in the ribbon ?
// we need to write "Extension" but not already write for media content
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) {

View File

@ -812,7 +812,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value);
if ($value > '') {
$objWriter->writeAttribute($key, $value);
}
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else {