From 114fc007636a90f083c6a5f68b8ec00c519677e7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 22 Mar 2016 10:08:48 +0100 Subject: [PATCH] Fix some PHPCS errors --- src/PhpSpreadsheet/Calculation/MathTrig.php | 45 ++++++++++--------- src/PhpSpreadsheet/Helper/HTML.php | 2 +- .../Reader/Excel5/Color/BIFF5.php | 2 +- .../Reader/Excel5/Color/BuiltIn.php | 2 +- .../Reader/Excel5/ErrorCode.php | 2 +- .../Reader/Excel5/Style/Border.php | 34 +++++++------- .../Reader/Excel5/Style/FillPattern.php | 2 +- src/PhpSpreadsheet/Shared/CodePage.php | 14 +++--- src/PhpSpreadsheet/Shared/ZipArchive.php | 3 +- src/PhpSpreadsheet/Spreadsheet.php | 4 +- src/PhpSpreadsheet/Style/NumberFormat.php | 8 ++-- .../Writer/Excel2007/ContentTypes.php | 4 +- src/PhpSpreadsheet/Writer/Excel2007/Theme.php | 2 + .../Writer/Excel2007/Worksheet.php | 1 + .../Writer/Excel5/Worksheet.php | 3 +- src/PhpSpreadsheet/Writer/HTML.php | 4 +- src/PhpSpreadsheet/Writer/OpenDocument.php | 4 +- .../Writer/OpenDocument/Cell/Comment.php | 5 ++- .../Writer/OpenDocument/Content.php | 5 ++- .../Writer/OpenDocument/Meta.php | 4 +- .../Writer/OpenDocument/MetaInf.php | 4 +- .../Writer/OpenDocument/Mimetype.php | 4 +- .../Writer/OpenDocument/Settings.php | 4 +- .../Writer/OpenDocument/Styles.php | 4 +- .../Writer/OpenDocument/Thumbnails.php | 4 +- .../Writer/OpenDocument/WriterPart.php | 4 +- 26 files changed, 103 insertions(+), 71 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 45a32da0..8a4310cb 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -1212,27 +1212,28 @@ class MathTrig return $returnValue; } - /** - * SUMIFS - * - * Counts the number of cells that contain numbers within the list of arguments - * - * Excel Function: - * SUMIFS(value1[,value2[, ...]],condition) - * - * @access public - * @category Mathematical and Trigonometric Functions - * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be summed. - * @return float - */ - public static function SUMIFS() { - $arrayList = func_get_args(); + /** + * SUMIFS + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * SUMIFS(value1[,value2[, ...]],condition) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @param string $condition The criteria that defines which cells will be summed. + * @return float + */ + public static function SUMIFS() + { + $arrayList = func_get_args(); - // Return value - $returnValue = 0; + // Return value + $returnValue = 0; - $sumArgs = Functions::flattenArray(array_shift($arrayList)); + $sumArgs = Functions::flattenArray(array_shift($arrayList)); while (count($arrayList) > 0) { $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); @@ -1256,9 +1257,9 @@ class MathTrig } } - // Return - return $returnValue; - } + // Return + return $returnValue; + } /** * SUMPRODUCT diff --git a/src/PhpSpreadsheet/Helper/HTML.php b/src/PhpSpreadsheet/Helper/HTML.php index 703bf20b..8e7de536 100644 --- a/src/PhpSpreadsheet/Helper/HTML.php +++ b/src/PhpSpreadsheet/Helper/HTML.php @@ -634,7 +634,7 @@ class HTML protected function cleanWhitespace() { - foreach($this->richTextObject->getRichTextElements() as $key => $element) { + foreach ($this->richTextObject->getRichTextElements() as $key => $element) { $text = $element->getText(); // Trim any leading spaces on the first run if ($key == 0) { diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php index 89f83fd2..67985721 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php @@ -76,4 +76,4 @@ class BIFF5 } return array('rgb' => '000000'); } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php b/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php index 237a1e8c..bb7adb85 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php @@ -30,4 +30,4 @@ class BuiltIn } return array('rgb' => '000000'); } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php b/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php index b9996ed1..79e28f39 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php +++ b/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php @@ -27,4 +27,4 @@ class ErrorCode } return false; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php b/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php index 6cb07bfe..9d63aa07 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php @@ -2,25 +2,25 @@ namespace PHPExcel\Reader\Excel5\Style; -use \PHPExcel\Style\Border; +use \PHPExcel\Style\Border as StyleBorder; class Border { protected static $map = array( - 0x00 => Border::BORDER_NONE, - 0x01 => Border::BORDER_THIN, - 0x02 => Border::BORDER_MEDIUM, - 0x03 => Border::BORDER_DASHED, - 0x04 => Border::BORDER_DOTTED, - 0x05 => Border::BORDER_THICK, - 0x06 => Border::BORDER_DOUBLE, - 0x07 => Border::BORDER_HAIR, - 0x08 => Border::BORDER_MEDIUMDASHED, - 0x09 => Border::BORDER_DASHDOT, - 0x0A => Border::BORDER_MEDIUMDASHDOT, - 0x0B => Border::BORDER_DASHDOTDOT, - 0x0C => Border::BORDER_MEDIUMDASHDOTDOT, - 0x0D => Border::BORDER_SLANTDASHDOT, + 0x00 => StyleBorder::BORDER_NONE, + 0x01 => StyleBorder::BORDER_THIN, + 0x02 => StyleBorder::BORDER_MEDIUM, + 0x03 => StyleBorder::BORDER_DASHED, + 0x04 => StyleBorder::BORDER_DOTTED, + 0x05 => StyleBorder::BORDER_THICK, + 0x06 => StyleBorder::BORDER_DOUBLE, + 0x07 => StyleBorder::BORDER_HAIR, + 0x08 => StyleBorder::BORDER_MEDIUMDASHED, + 0x09 => StyleBorder::BORDER_DASHDOT, + 0x0A => StyleBorder::BORDER_MEDIUMDASHDOT, + 0x0B => StyleBorder::BORDER_DASHDOTDOT, + 0x0C => StyleBorder::BORDER_MEDIUMDASHDOTDOT, + 0x0D => StyleBorder::BORDER_SLANTDASHDOT, ); /** @@ -35,6 +35,6 @@ class Border if (isset(self::$map[$index])) { return self::$map[$index]; } - return Border::BORDER_NONE; + return StyleBorder::BORDER_NONE; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php b/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php index 3b929836..c386b30b 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php @@ -42,4 +42,4 @@ class FillPattern } return Fill::FILL_NONE; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Shared/CodePage.php b/src/PhpSpreadsheet/Shared/CodePage.php index ea5f9c00..24f4b634 100644 --- a/src/PhpSpreadsheet/Shared/CodePage.php +++ b/src/PhpSpreadsheet/Shared/CodePage.php @@ -118,10 +118,10 @@ class CodePage return 'CP950'; // Macintosh Chinese Traditional case 10003: return 'CP1361'; // Macintosh Korean - case 10004: - return 'MACARABIC'; // Apple Arabic + case 10004: + return 'MACARABIC'; // Apple Arabic case 10005: - return 'MACHEBREW'; // Apple Hebrew + return 'MACHEBREW'; // Apple Hebrew case 10006: return 'MACGREEK'; // Macintosh Greek case 10007: @@ -129,11 +129,11 @@ class CodePage case 10008: return 'CP936'; // Macintosh - Simplified Chinese (GB 2312) case 10010: - return 'MACROMANIA'; // Macintosh Romania + return 'MACROMANIA'; // Macintosh Romania case 10017: - return 'MACUKRAINE'; // Macintosh Ukraine + return 'MACUKRAINE'; // Macintosh Ukraine case 10021: - return 'MACTHAI'; // Macintosh Thai + return 'MACTHAI'; // Macintosh Thai case 10029: return 'MACCENTRALEUROPE'; // Macintosh Central Europe case 10079: @@ -141,7 +141,7 @@ class CodePage case 10081: return 'MACTURKISH'; // Macintosh Turkish case 10082: - return 'MACCROATIAN'; // Macintosh Croatian + return 'MACCROATIAN'; // Macintosh Croatian case 21010: return 'UTF-16LE'; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE case 32768: diff --git a/src/PhpSpreadsheet/Shared/ZipArchive.php b/src/PhpSpreadsheet/Shared/ZipArchive.php index 981eeebd..7b7d9c8e 100644 --- a/src/PhpSpreadsheet/Shared/ZipArchive.php +++ b/src/PhpSpreadsheet/Shared/ZipArchive.php @@ -154,7 +154,8 @@ class ZipArchive return $contents; } - public function getFromIndex($index) { + public function getFromIndex($index) + { $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING); $contents = ''; if ((is_array($extracted)) && ($extracted != 0)) { diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index a2d27a23..eee9245e 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -238,7 +238,7 @@ class Spreadsheet { $returnData = null; $what = strtolower($what); - switch ($what){ + switch ($what) { case 'all': $returnData = $this->ribbonXMLData; break; @@ -282,7 +282,7 @@ class Spreadsheet { $ReturnData = null; $What = strtolower($What); - switch($What) { + switch ($What) { case 'all': return $this->ribbonBinObjects; break; diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index c199fffd..13a23b3e 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -447,11 +447,13 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable 'h' => 'g' ); - private static function setLowercaseCallback($matches) { + private static function setLowercaseCallback($matches) + { return mb_strtolower($matches[0]); } - private static function escapeQuotesCallback($matches) { + private static function escapeQuotesCallback($matches) + { return '\\' . implode('\\', str_split($matches[1])); } @@ -468,7 +470,7 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable // Only process the non-quoted blocks for date format characters $blocks = explode('"', $format); - foreach($blocks as $key => &$block) { + foreach ($blocks as $key => &$block) { if ($key % 2 == 0) { $block = strtr($block, self::$dateFormatReplacements); if (!strpos($block, 'A')) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php index 7eb7bbcf..aeb2e94c 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php @@ -146,7 +146,7 @@ class ContentTypes extends WriterPart $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); } - if (!isset( $aMediaContentTypes[$extension])) { + if (!isset($aMediaContentTypes[$extension])) { $aMediaContentTypes[$extension] = $mimeType; $this->writeDefaultContentType($objWriter, $extension, $mimeType); @@ -165,7 +165,7 @@ class ContentTypes extends WriterPart for ($i = 0; $i < $sheetCount; ++$i) { if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { - if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) { + if (!isset($aMediaContentTypes[strtolower($image->getExtension())])) { $aMediaContentTypes[strtolower($image->getExtension())] = $this->getImageMimeType($image->getPath()); $this->writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php index 433f8d64..336edfd2 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php @@ -1,5 +1,7 @@ */ -class PHPExcel_Writer_OpenDocument_Cell_Comment +class Comment { public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell) { diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php index b2991673..9cb2ecda 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php @@ -1,4 +1,7 @@ */ -class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_WriterPart +class Content extends WriterPart { const NUMBER_COLS_REPEATED_MAX = 1024; const NUMBER_ROWS_REPEATED_MAX = 1048576; diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php index 51f07c97..3b344b83 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php @@ -1,5 +1,7 @@