Completed
Push — develop ( bf3457...467bab )
by
unknown
09:08
created
src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @var integer
87 87
      * @see addContinue()
88 88
      */
89
-    private $limit    = 8224;
89
+    private $limit = 8224;
90 90
 
91 91
     /**
92 92
      * Constructor
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
             $teststr = pack("d", 1.2345);
112 112
             $number  = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
113 113
             if ($number == $teststr) {
114
-                $byte_order = 0;    // Little Endian
114
+                $byte_order = 0; // Little Endian
115 115
             } elseif ($number == strrev($teststr)) {
116
-                $byte_order = 1;    // Big Endian
116
+                $byte_order = 1; // Big Endian
117 117
             } else {
118 118
                 // Give up. I'll fix this in a later version.
119 119
                 throw new \PHPExcel\Writer\Exception("Required floating point format not supported on this platform.");
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
      */
166 166
     protected function storeBof($type)
167 167
     {
168
-        $record  = 0x0809;            // Record identifier    (BIFF5-BIFF8)
168
+        $record  = 0x0809; // Record identifier    (BIFF5-BIFF8)
169 169
         $length  = 0x0010;
170 170
 
171 171
         // by inspection of real files, MS Office Excel 2007 writes the following
172 172
         $unknown = pack("VV", 0x000100D1, 0x00000406);
173 173
 
174
-        $build   = 0x0DBB;            //    Excel 97
175
-        $year    = 0x07CC;            //    Excel 97
174
+        $build   = 0x0DBB; //    Excel 97
175
+        $year    = 0x07CC; //    Excel 97
176 176
 
177
-        $version = 0x0600;            //    BIFF8
177
+        $version = 0x0600; //    BIFF8
178 178
 
179 179
         $header  = pack("vv", $record, $length);
180 180
         $data    = pack("vvvv", $version, $type, $build, $year);
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
      */
189 189
     protected function storeEof()
190 190
     {
191
-        $record    = 0x000A;   // Record identifier
192
-        $length    = 0x0000;   // Number of bytes to follow
191
+        $record    = 0x000A; // Record identifier
192
+        $length    = 0x0000; // Number of bytes to follow
193 193
 
194 194
         $header    = pack("vv", $record, $length);
195 195
         $this->append($header);
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function writeEof()
204 204
     {
205
-        $record    = 0x000A;   // Record identifier
206
-        $length    = 0x0000;   // Number of bytes to follow
205
+        $record    = 0x000A; // Record identifier
206
+        $length    = 0x0000; // Number of bytes to follow
207 207
         $header    = pack("vv", $record, $length);
208 208
         return $this->writeData($header);
209 209
     }
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
     private function addContinue($data)
224 224
     {
225 225
         $limit  = $this->limit;
226
-        $record = 0x003C;         // Record identifier
226
+        $record = 0x003C; // Record identifier
227 227
 
228 228
         // The first 2080/8224 bytes remain intact. However, we have to change
229 229
         // the length field of the record.
230 230
         $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
231 231
 
232
-        $header = pack("vv", $record, $limit);  // Headers for continue records
232
+        $header = pack("vv", $record, $limit); // Headers for continue records
233 233
 
234 234
         // Retrieve chunks of 2080/8224 bytes +4 for the header.
235 235
         $data_length = strlen($data);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Workbook.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         // It needs to call its parent's constructor explicitly
200 200
         parent::__construct();
201 201
 
202
-        $this->parser        = $parser;
202
+        $this->parser = $parser;
203 203
         $this->biffSize     = 0;
204 204
         $this->palette      = array();
205 205
         $this->countryCode = -1;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $this->stringTotal      = &$str_total;
208 208
         $this->stringUnique     = &$str_unique;
209 209
         $this->stringTable      = &$str_table;
210
-        $this->colors        = &$colors;
210
+        $this->colors = &$colors;
211 211
         $this->setPaletteXl97();
212 212
 
213 213
         $this->phpExcel = $phpExcel;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
         for ($i = 0; $i < $countSheets; ++$i) {
222 222
             $phpSheet = $phpExcel->getSheet($i);
223 223
 
224
-            $this->parser->setExtSheet($phpSheet->getTitle(), $i);  // Register worksheet name with parser
224
+            $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser
225 225
 
226 226
             $supbook_index = 0x00;
227 227
             $ref = pack('vvv', $supbook_index, $i, $i);
228
-            $this->parser->references[] = $ref;  // Register reference with parser
228
+            $this->parser->references[] = $ref; // Register reference with parser
229 229
 
230 230
             // Sheet tab colors?
231 231
             if ($phpSheet->isTabColorSet()) {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      */
473 473
     private function calcSheetOffsets()
474 474
     {
475
-        $boundsheet_length = 10;  // fixed length for a BOUNDSHEET record
475
+        $boundsheet_length = 10; // fixed length for a BOUNDSHEET record
476 476
 
477 477
         // size of Workbook globals part 1 + 3
478 478
         $offset            = $this->_datasize;
@@ -836,9 +836,9 @@  discard block
 block discarded – undo
836 836
         $record = 0x0018;
837 837
 
838 838
         // option flags
839
-        $options = ($isHidden  ? 0x21 : 0x00);
839
+        $options = ($isHidden ? 0x21 : 0x00);
840 840
 
841
-        $extra  = pack(
841
+        $extra = pack(
842 842
             'Cvvvvv',
843 843
             0x3B,
844 844
             $sheetIndex - 1,
@@ -866,9 +866,9 @@  discard block
 block discarded – undo
866 866
      */
867 867
     private function writeCodepage()
868 868
     {
869
-        $record = 0x0042;             // Record identifier
870
-        $length = 0x0002;             // Number of bytes to follow
871
-        $cv  = $this->codepage;   // The code page
869
+        $record = 0x0042; // Record identifier
870
+        $length = 0x0002; // Number of bytes to follow
871
+        $cv = $this->codepage; // The code page
872 872
 
873 873
         $header = pack('vv', $record, $length);
874 874
         $data   = pack('v', $cv);
@@ -881,24 +881,24 @@  discard block
 block discarded – undo
881 881
      */
882 882
     private function writeWindow1()
883 883
     {
884
-        $record = 0x003D;   // Record identifier
885
-        $length = 0x0012;   // Number of bytes to follow
884
+        $record = 0x003D; // Record identifier
885
+        $length = 0x0012; // Number of bytes to follow
886 886
 
887
-        $xWn  = 0x0000;     // Horizontal position of window
888
-        $yWn  = 0x0000;     // Vertical position of window
889
-        $dxWn = 0x25BC;     // Width of window
890
-        $dyWn = 0x1572;     // Height of window
887
+        $xWn  = 0x0000; // Horizontal position of window
888
+        $yWn  = 0x0000; // Vertical position of window
889
+        $dxWn = 0x25BC; // Width of window
890
+        $dyWn = 0x1572; // Height of window
891 891
 
892
-        $grbit = 0x0038;    // Option flags
892
+        $grbit = 0x0038; // Option flags
893 893
 
894 894
         // not supported by PHPExcel, so there is only one selected sheet, the active
895
-        $ctabsel = 1;       // Number of workbook tabs selected
895
+        $ctabsel = 1; // Number of workbook tabs selected
896 896
 
897
-        $wTabRatio = 0x0258;    // Tab to scrollbar ratio
897
+        $wTabRatio = 0x0258; // Tab to scrollbar ratio
898 898
 
899 899
         // not supported by PHPExcel, set to 0
900
-        $itabFirst = 0;     // 1st displayed worksheet
901
-        $itabCur   = $this->phpExcel->getActiveSheetIndex();    // Active worksheet
900
+        $itabFirst = 0; // 1st displayed worksheet
901
+        $itabCur   = $this->phpExcel->getActiveSheetIndex(); // Active worksheet
902 902
 
903 903
         $header = pack("vv", $record, $length);
904 904
         $data   = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     private function writeBoundSheet($sheet, $offset)
915 915
     {
916 916
         $sheetname = $sheet->getTitle();
917
-        $record    = 0x0085;                    // Record identifier
917
+        $record    = 0x0085; // Record identifier
918 918
 
919 919
         // sheet state
920 920
         switch ($sheet->getSheetState()) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
         // sheet type
936 936
         $st = 0x00;
937 937
 
938
-        $grbit = 0x0000;                    // Visibility and sheet type
938
+        $grbit = 0x0000; // Visibility and sheet type
939 939
 
940 940
         $data = pack("VCC", $offset, $ss, $st);
941 941
         $data .= \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($sheetname);
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
      */
951 951
     private function writeSupbookInternal()
952 952
     {
953
-        $record    = 0x01AE;   // Record identifier
954
-        $length    = 0x0004;   // Bytes to follow
953
+        $record    = 0x01AE; // Record identifier
954
+        $length    = 0x0004; // Bytes to follow
955 955
 
956 956
         $header    = pack("vv", $record, $length);
957 957
         $data      = pack("vv", $this->phpExcel->getSheetCount(), 0x0401);
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
     private function writeExternalsheetBiff8()
967 967
     {
968 968
         $totalReferences = count($this->parser->references);
969
-        $record = 0x0017;                     // Record identifier
970
-        $length = 2 + 6 * $totalReferences;  // Number of bytes to follow
969
+        $record = 0x0017; // Record identifier
970
+        $length = 2 + 6 * $totalReferences; // Number of bytes to follow
971 971
 
972
-        $supbook_index = 0;           // FIXME: only using internal SUPBOOK record
972
+        $supbook_index = 0; // FIXME: only using internal SUPBOOK record
973 973
         $header = pack("vv", $record, $length);
974 974
         $data   = pack('v', $totalReferences);
975 975
         for ($i = 0; $i < $totalReferences; ++$i) {
@@ -983,12 +983,12 @@  discard block
 block discarded – undo
983 983
      */
984 984
     private function writeStyle()
985 985
     {
986
-        $record = 0x0293;   // Record identifier
987
-        $length = 0x0004;   // Bytes to follow
986
+        $record = 0x0293; // Record identifier
987
+        $length = 0x0004; // Bytes to follow
988 988
 
989
-        $ixfe    = 0x8000;  // Index to cell style XF
990
-        $BuiltIn = 0x00;     // Built-in style
991
-        $iLevel  = 0xff;     // Outline style level
989
+        $ixfe    = 0x8000; // Index to cell style XF
990
+        $BuiltIn = 0x00; // Built-in style
991
+        $iLevel  = 0xff; // Outline style level
992 992
 
993 993
         $header = pack("vv", $record, $length);
994 994
         $data   = pack("vCC", $ixfe, $BuiltIn, $iLevel);
@@ -1003,14 +1003,14 @@  discard block
 block discarded – undo
1003 1003
      */
1004 1004
     private function writeNumberFormat($format, $ifmt)
1005 1005
     {
1006
-        $record = 0x041E;    // Record identifier
1006
+        $record = 0x041E; // Record identifier
1007 1007
 
1008 1008
         $numberFormatString = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($format);
1009
-        $length = 2 + strlen($numberFormatString);    // Number of bytes to follow
1009
+        $length = 2 + strlen($numberFormatString); // Number of bytes to follow
1010 1010
 
1011 1011
 
1012 1012
         $header = pack("vv", $record, $length);
1013
-        $data   = pack("v", $ifmt) .  $numberFormatString;
1013
+        $data   = pack("v", $ifmt) . $numberFormatString;
1014 1014
         $this->append($header . $data);
1015 1015
     }
1016 1016
 
@@ -1019,12 +1019,12 @@  discard block
 block discarded – undo
1019 1019
      */
1020 1020
     private function writeDateMode()
1021 1021
     {
1022
-        $record = 0x0022;   // Record identifier
1023
-        $length = 0x0002;   // Bytes to follow
1022
+        $record = 0x0022; // Record identifier
1023
+        $length = 0x0002; // Bytes to follow
1024 1024
 
1025 1025
         $f1904  = (\PHPExcel\Shared\Date::getExcelCalendar() == \PHPExcel\Shared\Date::CALENDAR_MAC_1904)
1026 1026
             ? 1
1027
-            : 0;   // Flag for 1904 date system
1027
+            : 0; // Flag for 1904 date system
1028 1028
 
1029 1029
         $header = pack("vv", $record, $length);
1030 1030
         $data   = pack("v", $f1904);
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
      */
1046 1046
     private function writeExternalCount($cxals)
1047 1047
     {
1048
-        $record = 0x0016;   // Record identifier
1049
-        $length = 0x0002;   // Number of bytes to follow
1048
+        $record = 0x0016; // Record identifier
1049
+        $length = 0x0002; // Number of bytes to follow
1050 1050
 
1051 1051
         $header = pack("vv", $record, $length);
1052 1052
         $data   = pack("v", $cxals);
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
      */
1065 1065
     private function writeExternalSheet($sheetname)
1066 1066
     {
1067
-        $record = 0x0017;                     // Record identifier
1068
-        $length = 0x02 + strlen($sheetname);  // Number of bytes to follow
1067
+        $record = 0x0017; // Record identifier
1068
+        $length = 0x02 + strlen($sheetname); // Number of bytes to follow
1069 1069
 
1070
-        $cch    = strlen($sheetname);         // Length of sheet name
1071
-        $rgch   = 0x03;                       // Filename encoding
1070
+        $cch    = strlen($sheetname); // Length of sheet name
1071
+        $rgch   = 0x03; // Filename encoding
1072 1072
 
1073 1073
         $header = pack("vv", $record, $length);
1074 1074
         $data   = pack("CC", $cch, $rgch);
@@ -1088,20 +1088,20 @@  discard block
 block discarded – undo
1088 1088
      */
1089 1089
     private function writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax)
1090 1090
     {
1091
-        $record = 0x0018;       // Record identifier
1092
-        $length = 0x0024;       // Number of bytes to follow
1093
-
1094
-        $grbit  = 0x0020;       // Option flags
1095
-        $chKey  = 0x00;         // Keyboard shortcut
1096
-        $cch    = 0x01;         // Length of text name
1097
-        $cce    = 0x0015;       // Length of text definition
1098
-        $ixals  = $index + 1;   // Sheet index
1099
-        $itab   = $ixals;       // Equal to ixals
1100
-        $cchCustMenu    = 0x00;         // Length of cust menu text
1101
-        $cchDescription = 0x00;         // Length of description text
1102
-        $cchHelptopic   = 0x00;         // Length of help topic text
1103
-        $cchStatustext  = 0x00;         // Length of status bar text
1104
-        $rgch           = $type;        // Built-in name type
1091
+        $record = 0x0018; // Record identifier
1092
+        $length = 0x0024; // Number of bytes to follow
1093
+
1094
+        $grbit  = 0x0020; // Option flags
1095
+        $chKey  = 0x00; // Keyboard shortcut
1096
+        $cch    = 0x01; // Length of text name
1097
+        $cce    = 0x0015; // Length of text definition
1098
+        $ixals  = $index + 1; // Sheet index
1099
+        $itab   = $ixals; // Equal to ixals
1100
+        $cchCustMenu    = 0x00; // Length of cust menu text
1101
+        $cchDescription = 0x00; // Length of description text
1102
+        $cchHelptopic   = 0x00; // Length of help topic text
1103
+        $cchStatustext  = 0x00; // Length of status bar text
1104
+        $rgch           = $type; // Built-in name type
1105 1105
 
1106 1106
         $unknown03 = 0x3b;
1107 1107
         $unknown04 = 0xffff - $index;
@@ -1152,24 +1152,24 @@  discard block
 block discarded – undo
1152 1152
      */
1153 1153
     private function writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax)
1154 1154
     {
1155
-        $record          = 0x0018;       // Record identifier
1156
-        $length          = 0x003d;       // Number of bytes to follow
1157
-        $grbit           = 0x0020;       // Option flags
1158
-        $chKey           = 0x00;         // Keyboard shortcut
1159
-        $cch             = 0x01;         // Length of text name
1160
-        $cce             = 0x002e;       // Length of text definition
1161
-        $ixals           = $index + 1;   // Sheet index
1162
-        $itab            = $ixals;       // Equal to ixals
1163
-        $cchCustMenu     = 0x00;         // Length of cust menu text
1164
-        $cchDescription  = 0x00;         // Length of description text
1165
-        $cchHelptopic    = 0x00;         // Length of help topic text
1166
-        $cchStatustext   = 0x00;         // Length of status bar text
1167
-        $rgch            = $type;        // Built-in name type
1155
+        $record          = 0x0018; // Record identifier
1156
+        $length          = 0x003d; // Number of bytes to follow
1157
+        $grbit           = 0x0020; // Option flags
1158
+        $chKey           = 0x00; // Keyboard shortcut
1159
+        $cch             = 0x01; // Length of text name
1160
+        $cce             = 0x002e; // Length of text definition
1161
+        $ixals           = $index + 1; // Sheet index
1162
+        $itab            = $ixals; // Equal to ixals
1163
+        $cchCustMenu     = 0x00; // Length of cust menu text
1164
+        $cchDescription  = 0x00; // Length of description text
1165
+        $cchHelptopic    = 0x00; // Length of help topic text
1166
+        $cchStatustext   = 0x00; // Length of status bar text
1167
+        $rgch            = $type; // Built-in name type
1168 1168
 
1169 1169
         $unknown01       = 0x29;
1170 1170
         $unknown02       = 0x002b;
1171 1171
         $unknown03       = 0x3b;
1172
-        $unknown04       = 0xffff-$index;
1172
+        $unknown04       = 0xffff - $index;
1173 1173
         $unknown05       = 0x0000;
1174 1174
         $unknown06       = 0x0000;
1175 1175
         $unknown07       = 0x1087;
@@ -1227,8 +1227,8 @@  discard block
 block discarded – undo
1227 1227
      */
1228 1228
     private function writeCountry()
1229 1229
     {
1230
-        $record = 0x008C;    // Record identifier
1231
-        $length = 4;         // Number of bytes to follow
1230
+        $record = 0x008C; // Record identifier
1231
+        $length = 4; // Number of bytes to follow
1232 1232
 
1233 1233
         $header = pack('vv', $record, $length);
1234 1234
         /* using the same country code always for simplicity */
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
      */
1245 1245
     private function writeRecalcId()
1246 1246
     {
1247
-        $record = 0x01C1;    // Record identifier
1248
-        $length = 8;         // Number of bytes to follow
1247
+        $record = 0x01C1; // Record identifier
1248
+        $length = 8; // Number of bytes to follow
1249 1249
 
1250 1250
         $header = pack('vv', $record, $length);
1251 1251
 
@@ -1262,10 +1262,10 @@  discard block
 block discarded – undo
1262 1262
     {
1263 1263
         $aref = $this->palette;
1264 1264
 
1265
-        $record = 0x0092;                // Record identifier
1266
-        $length = 2 + 4 * count($aref);  // Number of bytes to follow
1267
-        $ccv    = count($aref);          // Number of RGB values to follow
1268
-        $data = '';                      // The RGB data
1265
+        $record = 0x0092; // Record identifier
1266
+        $length = 2 + 4 * count($aref); // Number of bytes to follow
1267
+        $ccv    = count($aref); // Number of RGB values to follow
1268
+        $data = ''; // The RGB data
1269 1269
 
1270 1270
         // Pack the RGB data
1271 1271
         foreach ($aref as $color) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Xf.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -133,23 +133,23 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function __construct(\PHPExcel\Style $style = null)
135 135
     {
136
-        $this->isStyleXf =     false;
136
+        $this->isStyleXf = false;
137 137
         $this->fontIndex = 0;
138 138
 
139
-        $this->numberFormatIndex     = 0;
139
+        $this->numberFormatIndex = 0;
140 140
 
141
-        $this->textJustLast  = 0;
141
+        $this->textJustLast = 0;
142 142
 
143 143
         $this->foregroundColor       = 0x40;
144 144
         $this->backgroundColor       = 0x41;
145 145
 
146
-        $this->_diag           = 0;
146
+        $this->_diag = 0;
147 147
 
148 148
         $this->bottomBorderColor   = 0x40;
149 149
         $this->topBorderColor      = 0x40;
150 150
         $this->leftBorderColor     = 0x40;
151 151
         $this->rightBorderColor    = 0x40;
152
-        $this->_diag_color     = 0x40;
152
+        $this->_diag_color = 0x40;
153 153
         $this->_style = $style;
154 154
 
155 155
     }
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
         // Flags to indicate if attributes have been set.
174
-        $atr_num     = ($this->numberFormatIndex != 0)?1:0;
175
-        $atr_fnt     = ($this->fontIndex != 0)?1:0;
174
+        $atr_num     = ($this->numberFormatIndex != 0) ? 1 : 0;
175
+        $atr_fnt     = ($this->fontIndex != 0) ? 1 : 0;
176 176
         $atr_alc     = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
177
-        $atr_bdr     = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle())   ||
178
-                        self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle())      ||
179
-                        self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle())     ||
180
-                        self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
177
+        $atr_bdr     = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
178
+                        self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
179
+                        self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
180
+                        self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle())) ? 1 : 0;
181 181
         $atr_pat     = (($this->foregroundColor != 0x40) ||
182 182
                         ($this->backgroundColor != 0x41) ||
183
-                        self::mapFillType($this->_style->getFill()->getFillType()))?1:0;
183
+                        self::mapFillType($this->_style->getFill()->getFillType())) ? 1 : 0;
184 184
         $atr_prot    = self::mapLocked($this->_style->getProtection()->getLocked())
185 185
                         | self::mapHidden($this->_style->getProtection()->getHidden());
186 186
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
189 189
             $this->bottomBorderColor = 0;
190 190
         }
191
-        if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle())  == 0) {
191
+        if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
192 192
             $this->topBorderColor = 0;
193 193
         }
194 194
         if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
@@ -201,47 +201,47 @@  discard block
 block discarded – undo
201 201
             $this->_diag_color = 0;
202 202
         }
203 203
 
204
-        $record = 0x00E0;              // Record identifier
205
-        $length = 0x0014;              // Number of bytes to follow
204
+        $record = 0x00E0; // Record identifier
205
+        $length = 0x0014; // Number of bytes to follow
206 206
 
207
-        $ifnt = $this->fontIndex;   // Index to FONT record
208
-        $ifmt = $this->numberFormatIndex;  // Index to FORMAT record
207
+        $ifnt = $this->fontIndex; // Index to FONT record
208
+        $ifmt = $this->numberFormatIndex; // Index to FORMAT record
209 209
 
210
-        $align  = $this->mapHAlign($this->_style->getAlignment()->getHorizontal());       // Alignment
211
-        $align |= (int) $this->_style->getAlignment()->getWrapText()     << 3;
212
-        $align |= self::mapVAlign($this->_style->getAlignment()->getVertical())  << 4;
210
+        $align  = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
211
+        $align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
212
+        $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
213 213
         $align |= $this->textJustLast << 7;
214 214
 
215
-        $used_attrib  = $atr_num  << 2;
216
-        $used_attrib |= $atr_fnt  << 3;
217
-        $used_attrib |= $atr_alc  << 4;
218
-        $used_attrib |= $atr_bdr  << 5;
219
-        $used_attrib |= $atr_pat  << 6;
215
+        $used_attrib  = $atr_num << 2;
216
+        $used_attrib |= $atr_fnt << 3;
217
+        $used_attrib |= $atr_alc << 4;
218
+        $used_attrib |= $atr_bdr << 5;
219
+        $used_attrib |= $atr_pat << 6;
220 220
         $used_attrib |= $atr_prot << 7;
221 221
 
222
-        $icv  = $this->foregroundColor;      // fg and bg pattern colors
223
-        $icv |= $this->backgroundColor      << 7;
222
+        $icv  = $this->foregroundColor; // fg and bg pattern colors
223
+        $icv |= $this->backgroundColor << 7;
224 224
 
225
-        $border1  = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle());          // Border line style and color
226
-        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle())         << 4;
227
-        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle())           << 8;
228
-        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle())        << 12;
229
-        $border1 |= $this->leftBorderColor    << 16;
230
-        $border1 |= $this->rightBorderColor   << 23;
225
+        $border1  = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
226
+        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
227
+        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
228
+        $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
229
+        $border1 |= $this->leftBorderColor << 16;
230
+        $border1 |= $this->rightBorderColor << 23;
231 231
 
232 232
         $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
233 233
         $diag_tl_to_rb = $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_BOTH
234 234
                             || $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_DOWN;
235 235
         $diag_tr_to_lb = $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_BOTH
236 236
                             || $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_UP;
237
-        $border1 |= $diag_tl_to_rb        << 30;
238
-        $border1 |= $diag_tr_to_lb        << 31;
237
+        $border1 |= $diag_tl_to_rb << 30;
238
+        $border1 |= $diag_tr_to_lb << 31;
239 239
 
240
-        $border2  = $this->topBorderColor;    // Border color
241
-        $border2 |= $this->bottomBorderColor   << 7;
242
-        $border2 |= $this->_diag_color     << 14;
243
-        $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle())           << 21;
244
-        $border2 |= self::mapFillType($this->_style->getFill()->getFillType())        << 26;
240
+        $border2  = $this->topBorderColor; // Border color
241
+        $border2 |= $this->bottomBorderColor << 7;
242
+        $border2 |= $this->_diag_color << 14;
243
+        $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
244
+        $border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26;
245 245
 
246 246
         $header = pack("vv", $record, $length);
247 247
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
         \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTTRELLIS    => 0x10,
428 428
         \PHPExcel\Style\Fill::FILL_PATTERN_GRAY125         => 0x11,
429 429
         \PHPExcel\Style\Fill::FILL_PATTERN_GRAY0625        => 0x12,
430
-        \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR         => 0x00,    // does not exist in BIFF8
431
-        \PHPExcel\Style\Fill::FILL_GRADIENT_PATH           => 0x00,    // does not exist in BIFF8
430
+        \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR         => 0x00, // does not exist in BIFF8
431
+        \PHPExcel\Style\Fill::FILL_GRADIENT_PATH           => 0x00, // does not exist in BIFF8
432 432
     );
433 433
 
434 434
     /**
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Escher.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 $innerData = '';
93 93
 
94 94
                 // write the dgg
95
-                $recVer            = 0x0;
95
+                $recVer = 0x0;
96 96
                 $recInstance    = 0x0000;
97 97
                 $recType        = 0xF006;
98 98
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $length            = strlen($data);
207 207
 
208 208
                 $recVerInstance  = $recVer;
209
-                $recVerInstance |=    $recInstance << 4;
209
+                $recVerInstance |= $recInstance << 4;
210 210
 
211 211
                 $header = pack('vvV', $recVerInstance, $recType, $length);
212 212
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                         $length            = strlen($innerData);
238 238
 
239 239
                         $recVerInstance  = $recVer;
240
-                        $recVerInstance |=    $recInstance << 4;
240
+                        $recVerInstance |= $recInstance << 4;
241 241
 
242 242
                         $header = pack('vvV', $recVerInstance, $recType, $length);
243 243
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                         $length            = strlen($innerData);
265 265
 
266 266
                         $recVerInstance  = $recVer;
267
-                        $recVerInstance |=    $recInstance << 4;
267
+                        $recVerInstance |= $recInstance << 4;
268 268
 
269 269
                         $header = pack('vvV', $recVerInstance, $recType, $length);
270 270
 
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
                 if ($this->object->getOPTCollection()) {
407 407
                     $optData = '';
408 408
 
409
-                    $recVer            = 0x3;
409
+                    $recVer = 0x3;
410 410
                     $recInstance    = count($this->object->getOPTCollection());
411 411
                     $recType        = 0xF00B;
412 412
                     foreach ($this->object->getOPTCollection() as $property => $value) {
413 413
                         $optData .= pack('vV', $property, $value);
414 414
                     }
415
-                    $length            = strlen($optData);
415
+                    $length = strlen($optData);
416 416
 
417 417
                     $recVerInstance  = $recVer;
418 418
                     $recVerInstance |= $recInstance << 4;
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                 if ($this->object->getStartCoordinates()) {
426 426
                     $clientAnchorData = '';
427 427
 
428
-                    $recVer            = 0x0;
428
+                    $recVer = 0x0;
429 429
                     $recInstance    = 0x0;
430 430
                     $recType        = 0xF010;
431 431
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
                     $clientAnchorData = pack('vvvvvvvvv', $this->object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
455 455
                     
456
-                    $length            = strlen($clientAnchorData);
456
+                    $length = strlen($clientAnchorData);
457 457
 
458 458
                     $recVerInstance  = $recVer;
459 459
                     $recVerInstance |= $recInstance << 4;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                 if (!$this->object->getSpgr()) {
467 467
                     $clientDataData = '';
468 468
 
469
-                    $recVer            = 0x0;
469
+                    $recVer = 0x0;
470 470
                     $recInstance    = 0x0;
471 471
                     $recType        = 0xF011;
472 472
 
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Font.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
         $bFamily = 0; // Font family
86 86
         $bCharSet = \PHPExcel\Shared\Font::getCharsetFromFontName($this->font->getName()); // Character set
87 87
 
88
-        $record = 0x31;        // Record identifier
89
-        $reserved = 0x00;    // Reserved
90
-        $grbit = 0x00;        // Font attributes
88
+        $record = 0x31; // Record identifier
89
+        $reserved = 0x00; // Reserved
90
+        $grbit = 0x00; // Font attributes
91 91
         if ($this->font->getItalic()) {
92 92
             $grbit |= 0x02;
93 93
         }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     private static function mapBold($bold)
135 135
     {
136 136
         if ($bold) {
137
-            return 0x2BC;  //  700 = Bold font weight
137
+            return 0x2BC; //  700 = Bold font weight
138 138
         }
139
-        return 0x190;      //  400 = Normal font weight
139
+        return 0x190; //  400 = Normal font weight
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Parser.php 1 patch
Spacing   +276 added lines, -276 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function __construct()
117 117
     {
118
-        $this->currentCharacter  = 0;
119
-        $this->currentToken = '';       // The token we are working on.
120
-        $this->formula       = '';       // The formula to parse.
121
-        $this->lookAhead     = '';       // The character ahead of the current char.
122
-        $this->parseTree    = '';       // The parse tree to be generated.
123
-        $this->initializeHashes();      // Initialize the hashes: ptg's and function's ptg's
118
+        $this->currentCharacter = 0;
119
+        $this->currentToken = ''; // The token we are working on.
120
+        $this->formula       = ''; // The formula to parse.
121
+        $this->lookAhead     = ''; // The character ahead of the current char.
122
+        $this->parseTree    = ''; // The parse tree to be generated.
123
+        $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's
124 124
         $this->externalSheets = array();
125 125
         $this->references = array();
126 126
     }
@@ -246,256 +246,256 @@  discard block
 block discarded – undo
246 246
         //
247 247
         $this->functions = array(
248 248
             // function                  ptg  args  class  vol
249
-            'COUNT'           => array(   0,   -1,    0,    0 ),
250
-            'IF'              => array(   1,   -1,    1,    0 ),
251
-            'ISNA'            => array(   2,    1,    1,    0 ),
252
-            'ISERROR'         => array(   3,    1,    1,    0 ),
253
-            'SUM'             => array(   4,   -1,    0,    0 ),
254
-            'AVERAGE'         => array(   5,   -1,    0,    0 ),
255
-            'MIN'             => array(   6,   -1,    0,    0 ),
256
-            'MAX'             => array(   7,   -1,    0,    0 ),
257
-            'ROW'             => array(   8,   -1,    0,    0 ),
258
-            'COLUMN'          => array(   9,   -1,    0,    0 ),
259
-            'NA'              => array(  10,    0,    0,    0 ),
260
-            'NPV'             => array(  11,   -1,    1,    0 ),
261
-            'STDEV'           => array(  12,   -1,    0,    0 ),
262
-            'DOLLAR'          => array(  13,   -1,    1,    0 ),
263
-            'FIXED'           => array(  14,   -1,    1,    0 ),
264
-            'SIN'             => array(  15,    1,    1,    0 ),
265
-            'COS'             => array(  16,    1,    1,    0 ),
266
-            'TAN'             => array(  17,    1,    1,    0 ),
267
-            'ATAN'            => array(  18,    1,    1,    0 ),
268
-            'PI'              => array(  19,    0,    1,    0 ),
269
-            'SQRT'            => array(  20,    1,    1,    0 ),
270
-            'EXP'             => array(  21,    1,    1,    0 ),
271
-            'LN'              => array(  22,    1,    1,    0 ),
272
-            'LOG10'           => array(  23,    1,    1,    0 ),
273
-            'ABS'             => array(  24,    1,    1,    0 ),
274
-            'INT'             => array(  25,    1,    1,    0 ),
275
-            'SIGN'            => array(  26,    1,    1,    0 ),
276
-            'ROUND'           => array(  27,    2,    1,    0 ),
277
-            'LOOKUP'          => array(  28,   -1,    0,    0 ),
278
-            'INDEX'           => array(  29,   -1,    0,    1 ),
279
-            'REPT'            => array(  30,    2,    1,    0 ),
280
-            'MID'             => array(  31,    3,    1,    0 ),
281
-            'LEN'             => array(  32,    1,    1,    0 ),
282
-            'VALUE'           => array(  33,    1,    1,    0 ),
283
-            'TRUE'            => array(  34,    0,    1,    0 ),
284
-            'FALSE'           => array(  35,    0,    1,    0 ),
285
-            'AND'             => array(  36,   -1,    0,    0 ),
286
-            'OR'              => array(  37,   -1,    0,    0 ),
287
-            'NOT'             => array(  38,    1,    1,    0 ),
288
-            'MOD'             => array(  39,    2,    1,    0 ),
289
-            'DCOUNT'          => array(  40,    3,    0,    0 ),
290
-            'DSUM'            => array(  41,    3,    0,    0 ),
291
-            'DAVERAGE'        => array(  42,    3,    0,    0 ),
292
-            'DMIN'            => array(  43,    3,    0,    0 ),
293
-            'DMAX'            => array(  44,    3,    0,    0 ),
294
-            'DSTDEV'          => array(  45,    3,    0,    0 ),
295
-            'VAR'             => array(  46,   -1,    0,    0 ),
296
-            'DVAR'            => array(  47,    3,    0,    0 ),
297
-            'TEXT'            => array(  48,    2,    1,    0 ),
298
-            'LINEST'          => array(  49,   -1,    0,    0 ),
299
-            'TREND'           => array(  50,   -1,    0,    0 ),
300
-            'LOGEST'          => array(  51,   -1,    0,    0 ),
301
-            'GROWTH'          => array(  52,   -1,    0,    0 ),
302
-            'PV'              => array(  56,   -1,    1,    0 ),
303
-            'FV'              => array(  57,   -1,    1,    0 ),
304
-            'NPER'            => array(  58,   -1,    1,    0 ),
305
-            'PMT'             => array(  59,   -1,    1,    0 ),
306
-            'RATE'            => array(  60,   -1,    1,    0 ),
307
-            'MIRR'            => array(  61,    3,    0,    0 ),
308
-            'IRR'             => array(  62,   -1,    0,    0 ),
309
-            'RAND'            => array(  63,    0,    1,    1 ),
310
-            'MATCH'           => array(  64,   -1,    0,    0 ),
311
-            'DATE'            => array(  65,    3,    1,    0 ),
312
-            'TIME'            => array(  66,    3,    1,    0 ),
313
-            'DAY'             => array(  67,    1,    1,    0 ),
314
-            'MONTH'           => array(  68,    1,    1,    0 ),
315
-            'YEAR'            => array(  69,    1,    1,    0 ),
316
-            'WEEKDAY'         => array(  70,   -1,    1,    0 ),
317
-            'HOUR'            => array(  71,    1,    1,    0 ),
318
-            'MINUTE'          => array(  72,    1,    1,    0 ),
319
-            'SECOND'          => array(  73,    1,    1,    0 ),
320
-            'NOW'             => array(  74,    0,    1,    1 ),
321
-            'AREAS'           => array(  75,    1,    0,    1 ),
322
-            'ROWS'            => array(  76,    1,    0,    1 ),
323
-            'COLUMNS'         => array(  77,    1,    0,    1 ),
324
-            'OFFSET'          => array(  78,   -1,    0,    1 ),
325
-            'SEARCH'          => array(  82,   -1,    1,    0 ),
326
-            'TRANSPOSE'       => array(  83,    1,    1,    0 ),
327
-            'TYPE'            => array(  86,    1,    1,    0 ),
328
-            'ATAN2'           => array(  97,    2,    1,    0 ),
329
-            'ASIN'            => array(  98,    1,    1,    0 ),
330
-            'ACOS'            => array(  99,    1,    1,    0 ),
331
-            'CHOOSE'          => array( 100,   -1,    1,    0 ),
332
-            'HLOOKUP'         => array( 101,   -1,    0,    0 ),
333
-            'VLOOKUP'         => array( 102,   -1,    0,    0 ),
334
-            'ISREF'           => array( 105,    1,    0,    0 ),
335
-            'LOG'             => array( 109,   -1,    1,    0 ),
336
-            'CHAR'            => array( 111,    1,    1,    0 ),
337
-            'LOWER'           => array( 112,    1,    1,    0 ),
338
-            'UPPER'           => array( 113,    1,    1,    0 ),
339
-            'PROPER'          => array( 114,    1,    1,    0 ),
340
-            'LEFT'            => array( 115,   -1,    1,    0 ),
341
-            'RIGHT'           => array( 116,   -1,    1,    0 ),
342
-            'EXACT'           => array( 117,    2,    1,    0 ),
343
-            'TRIM'            => array( 118,    1,    1,    0 ),
344
-            'REPLACE'         => array( 119,    4,    1,    0 ),
345
-            'SUBSTITUTE'      => array( 120,   -1,    1,    0 ),
346
-            'CODE'            => array( 121,    1,    1,    0 ),
347
-            'FIND'            => array( 124,   -1,    1,    0 ),
348
-            'CELL'            => array( 125,   -1,    0,    1 ),
349
-            'ISERR'           => array( 126,    1,    1,    0 ),
350
-            'ISTEXT'          => array( 127,    1,    1,    0 ),
351
-            'ISNUMBER'        => array( 128,    1,    1,    0 ),
352
-            'ISBLANK'         => array( 129,    1,    1,    0 ),
353
-            'T'               => array( 130,    1,    0,    0 ),
354
-            'N'               => array( 131,    1,    0,    0 ),
355
-            'DATEVALUE'       => array( 140,    1,    1,    0 ),
356
-            'TIMEVALUE'       => array( 141,    1,    1,    0 ),
357
-            'SLN'             => array( 142,    3,    1,    0 ),
358
-            'SYD'             => array( 143,    4,    1,    0 ),
359
-            'DDB'             => array( 144,   -1,    1,    0 ),
360
-            'INDIRECT'        => array( 148,   -1,    1,    1 ),
361
-            'CALL'            => array( 150,   -1,    1,    0 ),
362
-            'CLEAN'           => array( 162,    1,    1,    0 ),
363
-            'MDETERM'         => array( 163,    1,    2,    0 ),
364
-            'MINVERSE'        => array( 164,    1,    2,    0 ),
365
-            'MMULT'           => array( 165,    2,    2,    0 ),
366
-            'IPMT'            => array( 167,   -1,    1,    0 ),
367
-            'PPMT'            => array( 168,   -1,    1,    0 ),
368
-            'COUNTA'          => array( 169,   -1,    0,    0 ),
369
-            'PRODUCT'         => array( 183,   -1,    0,    0 ),
370
-            'FACT'            => array( 184,    1,    1,    0 ),
371
-            'DPRODUCT'        => array( 189,    3,    0,    0 ),
372
-            'ISNONTEXT'       => array( 190,    1,    1,    0 ),
373
-            'STDEVP'          => array( 193,   -1,    0,    0 ),
374
-            'VARP'            => array( 194,   -1,    0,    0 ),
375
-            'DSTDEVP'         => array( 195,    3,    0,    0 ),
376
-            'DVARP'           => array( 196,    3,    0,    0 ),
377
-            'TRUNC'           => array( 197,   -1,    1,    0 ),
378
-            'ISLOGICAL'       => array( 198,    1,    1,    0 ),
379
-            'DCOUNTA'         => array( 199,    3,    0,    0 ),
380
-            'USDOLLAR'        => array( 204,   -1,    1,    0 ),
381
-            'FINDB'           => array( 205,   -1,    1,    0 ),
382
-            'SEARCHB'         => array( 206,   -1,    1,    0 ),
383
-            'REPLACEB'        => array( 207,    4,    1,    0 ),
384
-            'LEFTB'           => array( 208,   -1,    1,    0 ),
385
-            'RIGHTB'          => array( 209,   -1,    1,    0 ),
386
-            'MIDB'            => array( 210,    3,    1,    0 ),
387
-            'LENB'            => array( 211,    1,    1,    0 ),
388
-            'ROUNDUP'         => array( 212,    2,    1,    0 ),
389
-            'ROUNDDOWN'       => array( 213,    2,    1,    0 ),
390
-            'ASC'             => array( 214,    1,    1,    0 ),
391
-            'DBCS'            => array( 215,    1,    1,    0 ),
392
-            'RANK'            => array( 216,   -1,    0,    0 ),
393
-            'ADDRESS'         => array( 219,   -1,    1,    0 ),
394
-            'DAYS360'         => array( 220,   -1,    1,    0 ),
395
-            'TODAY'           => array( 221,    0,    1,    1 ),
396
-            'VDB'             => array( 222,   -1,    1,    0 ),
397
-            'MEDIAN'          => array( 227,   -1,    0,    0 ),
398
-            'SUMPRODUCT'      => array( 228,   -1,    2,    0 ),
399
-            'SINH'            => array( 229,    1,    1,    0 ),
400
-            'COSH'            => array( 230,    1,    1,    0 ),
401
-            'TANH'            => array( 231,    1,    1,    0 ),
402
-            'ASINH'           => array( 232,    1,    1,    0 ),
403
-            'ACOSH'           => array( 233,    1,    1,    0 ),
404
-            'ATANH'           => array( 234,    1,    1,    0 ),
405
-            'DGET'            => array( 235,    3,    0,    0 ),
406
-            'INFO'            => array( 244,    1,    1,    1 ),
407
-            'DB'              => array( 247,   -1,    1,    0 ),
408
-            'FREQUENCY'       => array( 252,    2,    0,    0 ),
409
-            'ERROR.TYPE'      => array( 261,    1,    1,    0 ),
410
-            'REGISTER.ID'     => array( 267,   -1,    1,    0 ),
411
-            'AVEDEV'          => array( 269,   -1,    0,    0 ),
412
-            'BETADIST'        => array( 270,   -1,    1,    0 ),
413
-            'GAMMALN'         => array( 271,    1,    1,    0 ),
414
-            'BETAINV'         => array( 272,   -1,    1,    0 ),
415
-            'BINOMDIST'       => array( 273,    4,    1,    0 ),
416
-            'CHIDIST'         => array( 274,    2,    1,    0 ),
417
-            'CHIINV'          => array( 275,    2,    1,    0 ),
418
-            'COMBIN'          => array( 276,    2,    1,    0 ),
419
-            'CONFIDENCE'      => array( 277,    3,    1,    0 ),
420
-            'CRITBINOM'       => array( 278,    3,    1,    0 ),
421
-            'EVEN'            => array( 279,    1,    1,    0 ),
422
-            'EXPONDIST'       => array( 280,    3,    1,    0 ),
423
-            'FDIST'           => array( 281,    3,    1,    0 ),
424
-            'FINV'            => array( 282,    3,    1,    0 ),
425
-            'FISHER'          => array( 283,    1,    1,    0 ),
426
-            'FISHERINV'       => array( 284,    1,    1,    0 ),
427
-            'FLOOR'           => array( 285,    2,    1,    0 ),
428
-            'GAMMADIST'       => array( 286,    4,    1,    0 ),
429
-            'GAMMAINV'        => array( 287,    3,    1,    0 ),
430
-            'CEILING'         => array( 288,    2,    1,    0 ),
431
-            'HYPGEOMDIST'     => array( 289,    4,    1,    0 ),
432
-            'LOGNORMDIST'     => array( 290,    3,    1,    0 ),
433
-            'LOGINV'          => array( 291,    3,    1,    0 ),
434
-            'NEGBINOMDIST'    => array( 292,    3,    1,    0 ),
435
-            'NORMDIST'        => array( 293,    4,    1,    0 ),
436
-            'NORMSDIST'       => array( 294,    1,    1,    0 ),
437
-            'NORMINV'         => array( 295,    3,    1,    0 ),
438
-            'NORMSINV'        => array( 296,    1,    1,    0 ),
439
-            'STANDARDIZE'     => array( 297,    3,    1,    0 ),
440
-            'ODD'             => array( 298,    1,    1,    0 ),
441
-            'PERMUT'          => array( 299,    2,    1,    0 ),
442
-            'POISSON'         => array( 300,    3,    1,    0 ),
443
-            'TDIST'           => array( 301,    3,    1,    0 ),
444
-            'WEIBULL'         => array( 302,    4,    1,    0 ),
445
-            'SUMXMY2'         => array( 303,    2,    2,    0 ),
446
-            'SUMX2MY2'        => array( 304,    2,    2,    0 ),
447
-            'SUMX2PY2'        => array( 305,    2,    2,    0 ),
448
-            'CHITEST'         => array( 306,    2,    2,    0 ),
449
-            'CORREL'          => array( 307,    2,    2,    0 ),
450
-            'COVAR'           => array( 308,    2,    2,    0 ),
451
-            'FORECAST'        => array( 309,    3,    2,    0 ),
452
-            'FTEST'           => array( 310,    2,    2,    0 ),
453
-            'INTERCEPT'       => array( 311,    2,    2,    0 ),
454
-            'PEARSON'         => array( 312,    2,    2,    0 ),
455
-            'RSQ'             => array( 313,    2,    2,    0 ),
456
-            'STEYX'           => array( 314,    2,    2,    0 ),
457
-            'SLOPE'           => array( 315,    2,    2,    0 ),
458
-            'TTEST'           => array( 316,    4,    2,    0 ),
459
-            'PROB'            => array( 317,   -1,    2,    0 ),
460
-            'DEVSQ'           => array( 318,   -1,    0,    0 ),
461
-            'GEOMEAN'         => array( 319,   -1,    0,    0 ),
462
-            'HARMEAN'         => array( 320,   -1,    0,    0 ),
463
-            'SUMSQ'           => array( 321,   -1,    0,    0 ),
464
-            'KURT'            => array( 322,   -1,    0,    0 ),
465
-            'SKEW'            => array( 323,   -1,    0,    0 ),
466
-            'ZTEST'           => array( 324,   -1,    0,    0 ),
467
-            'LARGE'           => array( 325,    2,    0,    0 ),
468
-            'SMALL'           => array( 326,    2,    0,    0 ),
469
-            'QUARTILE'        => array( 327,    2,    0,    0 ),
470
-            'PERCENTILE'      => array( 328,    2,    0,    0 ),
471
-            'PERCENTRANK'     => array( 329,   -1,    0,    0 ),
472
-            'MODE'            => array( 330,   -1,    2,    0 ),
473
-            'TRIMMEAN'        => array( 331,    2,    0,    0 ),
474
-            'TINV'            => array( 332,    2,    1,    0 ),
475
-            'CONCATENATE'     => array( 336,   -1,    1,    0 ),
476
-            'POWER'           => array( 337,    2,    1,    0 ),
477
-            'RADIANS'         => array( 342,    1,    1,    0 ),
478
-            'DEGREES'         => array( 343,    1,    1,    0 ),
479
-            'SUBTOTAL'        => array( 344,   -1,    0,    0 ),
480
-            'SUMIF'           => array( 345,   -1,    0,    0 ),
481
-            'COUNTIF'         => array( 346,    2,    0,    0 ),
482
-            'COUNTBLANK'      => array( 347,    1,    0,    0 ),
483
-            'ISPMT'           => array( 350,    4,    1,    0 ),
484
-            'DATEDIF'         => array( 351,    3,    1,    0 ),
485
-            'DATESTRING'      => array( 352,    1,    1,    0 ),
486
-            'NUMBERSTRING'    => array( 353,    2,    1,    0 ),
487
-            'ROMAN'           => array( 354,   -1,    1,    0 ),
488
-            'GETPIVOTDATA'    => array( 358,   -1,    0,    0 ),
489
-            'HYPERLINK'       => array( 359,   -1,    1,    0 ),
490
-            'PHONETIC'        => array( 360,    1,    0,    0 ),
491
-            'AVERAGEA'        => array( 361,   -1,    0,    0 ),
492
-            'MAXA'            => array( 362,   -1,    0,    0 ),
493
-            'MINA'            => array( 363,   -1,    0,    0 ),
494
-            'STDEVPA'         => array( 364,   -1,    0,    0 ),
495
-            'VARPA'           => array( 365,   -1,    0,    0 ),
496
-            'STDEVA'          => array( 366,   -1,    0,    0 ),
497
-            'VARA'            => array( 367,   -1,    0,    0 ),
498
-            'BAHTTEXT'        => array( 368,    1,    0,    0 ),
249
+            'COUNT'           => array(0, -1, 0, 0),
250
+            'IF'              => array(1, -1, 1, 0),
251
+            'ISNA'            => array(2, 1, 1, 0),
252
+            'ISERROR'         => array(3, 1, 1, 0),
253
+            'SUM'             => array(4, -1, 0, 0),
254
+            'AVERAGE'         => array(5, -1, 0, 0),
255
+            'MIN'             => array(6, -1, 0, 0),
256
+            'MAX'             => array(7, -1, 0, 0),
257
+            'ROW'             => array(8, -1, 0, 0),
258
+            'COLUMN'          => array(9, -1, 0, 0),
259
+            'NA'              => array(10, 0, 0, 0),
260
+            'NPV'             => array(11, -1, 1, 0),
261
+            'STDEV'           => array(12, -1, 0, 0),
262
+            'DOLLAR'          => array(13, -1, 1, 0),
263
+            'FIXED'           => array(14, -1, 1, 0),
264
+            'SIN'             => array(15, 1, 1, 0),
265
+            'COS'             => array(16, 1, 1, 0),
266
+            'TAN'             => array(17, 1, 1, 0),
267
+            'ATAN'            => array(18, 1, 1, 0),
268
+            'PI'              => array(19, 0, 1, 0),
269
+            'SQRT'            => array(20, 1, 1, 0),
270
+            'EXP'             => array(21, 1, 1, 0),
271
+            'LN'              => array(22, 1, 1, 0),
272
+            'LOG10'           => array(23, 1, 1, 0),
273
+            'ABS'             => array(24, 1, 1, 0),
274
+            'INT'             => array(25, 1, 1, 0),
275
+            'SIGN'            => array(26, 1, 1, 0),
276
+            'ROUND'           => array(27, 2, 1, 0),
277
+            'LOOKUP'          => array(28, -1, 0, 0),
278
+            'INDEX'           => array(29, -1, 0, 1),
279
+            'REPT'            => array(30, 2, 1, 0),
280
+            'MID'             => array(31, 3, 1, 0),
281
+            'LEN'             => array(32, 1, 1, 0),
282
+            'VALUE'           => array(33, 1, 1, 0),
283
+            'TRUE'            => array(34, 0, 1, 0),
284
+            'FALSE'           => array(35, 0, 1, 0),
285
+            'AND'             => array(36, -1, 0, 0),
286
+            'OR'              => array(37, -1, 0, 0),
287
+            'NOT'             => array(38, 1, 1, 0),
288
+            'MOD'             => array(39, 2, 1, 0),
289
+            'DCOUNT'          => array(40, 3, 0, 0),
290
+            'DSUM'            => array(41, 3, 0, 0),
291
+            'DAVERAGE'        => array(42, 3, 0, 0),
292
+            'DMIN'            => array(43, 3, 0, 0),
293
+            'DMAX'            => array(44, 3, 0, 0),
294
+            'DSTDEV'          => array(45, 3, 0, 0),
295
+            'VAR'             => array(46, -1, 0, 0),
296
+            'DVAR'            => array(47, 3, 0, 0),
297
+            'TEXT'            => array(48, 2, 1, 0),
298
+            'LINEST'          => array(49, -1, 0, 0),
299
+            'TREND'           => array(50, -1, 0, 0),
300
+            'LOGEST'          => array(51, -1, 0, 0),
301
+            'GROWTH'          => array(52, -1, 0, 0),
302
+            'PV'              => array(56, -1, 1, 0),
303
+            'FV'              => array(57, -1, 1, 0),
304
+            'NPER'            => array(58, -1, 1, 0),
305
+            'PMT'             => array(59, -1, 1, 0),
306
+            'RATE'            => array(60, -1, 1, 0),
307
+            'MIRR'            => array(61, 3, 0, 0),
308
+            'IRR'             => array(62, -1, 0, 0),
309
+            'RAND'            => array(63, 0, 1, 1),
310
+            'MATCH'           => array(64, -1, 0, 0),
311
+            'DATE'            => array(65, 3, 1, 0),
312
+            'TIME'            => array(66, 3, 1, 0),
313
+            'DAY'             => array(67, 1, 1, 0),
314
+            'MONTH'           => array(68, 1, 1, 0),
315
+            'YEAR'            => array(69, 1, 1, 0),
316
+            'WEEKDAY'         => array(70, -1, 1, 0),
317
+            'HOUR'            => array(71, 1, 1, 0),
318
+            'MINUTE'          => array(72, 1, 1, 0),
319
+            'SECOND'          => array(73, 1, 1, 0),
320
+            'NOW'             => array(74, 0, 1, 1),
321
+            'AREAS'           => array(75, 1, 0, 1),
322
+            'ROWS'            => array(76, 1, 0, 1),
323
+            'COLUMNS'         => array(77, 1, 0, 1),
324
+            'OFFSET'          => array(78, -1, 0, 1),
325
+            'SEARCH'          => array(82, -1, 1, 0),
326
+            'TRANSPOSE'       => array(83, 1, 1, 0),
327
+            'TYPE'            => array(86, 1, 1, 0),
328
+            'ATAN2'           => array(97, 2, 1, 0),
329
+            'ASIN'            => array(98, 1, 1, 0),
330
+            'ACOS'            => array(99, 1, 1, 0),
331
+            'CHOOSE'          => array(100, -1, 1, 0),
332
+            'HLOOKUP'         => array(101, -1, 0, 0),
333
+            'VLOOKUP'         => array(102, -1, 0, 0),
334
+            'ISREF'           => array(105, 1, 0, 0),
335
+            'LOG'             => array(109, -1, 1, 0),
336
+            'CHAR'            => array(111, 1, 1, 0),
337
+            'LOWER'           => array(112, 1, 1, 0),
338
+            'UPPER'           => array(113, 1, 1, 0),
339
+            'PROPER'          => array(114, 1, 1, 0),
340
+            'LEFT'            => array(115, -1, 1, 0),
341
+            'RIGHT'           => array(116, -1, 1, 0),
342
+            'EXACT'           => array(117, 2, 1, 0),
343
+            'TRIM'            => array(118, 1, 1, 0),
344
+            'REPLACE'         => array(119, 4, 1, 0),
345
+            'SUBSTITUTE'      => array(120, -1, 1, 0),
346
+            'CODE'            => array(121, 1, 1, 0),
347
+            'FIND'            => array(124, -1, 1, 0),
348
+            'CELL'            => array(125, -1, 0, 1),
349
+            'ISERR'           => array(126, 1, 1, 0),
350
+            'ISTEXT'          => array(127, 1, 1, 0),
351
+            'ISNUMBER'        => array(128, 1, 1, 0),
352
+            'ISBLANK'         => array(129, 1, 1, 0),
353
+            'T'               => array(130, 1, 0, 0),
354
+            'N'               => array(131, 1, 0, 0),
355
+            'DATEVALUE'       => array(140, 1, 1, 0),
356
+            'TIMEVALUE'       => array(141, 1, 1, 0),
357
+            'SLN'             => array(142, 3, 1, 0),
358
+            'SYD'             => array(143, 4, 1, 0),
359
+            'DDB'             => array(144, -1, 1, 0),
360
+            'INDIRECT'        => array(148, -1, 1, 1),
361
+            'CALL'            => array(150, -1, 1, 0),
362
+            'CLEAN'           => array(162, 1, 1, 0),
363
+            'MDETERM'         => array(163, 1, 2, 0),
364
+            'MINVERSE'        => array(164, 1, 2, 0),
365
+            'MMULT'           => array(165, 2, 2, 0),
366
+            'IPMT'            => array(167, -1, 1, 0),
367
+            'PPMT'            => array(168, -1, 1, 0),
368
+            'COUNTA'          => array(169, -1, 0, 0),
369
+            'PRODUCT'         => array(183, -1, 0, 0),
370
+            'FACT'            => array(184, 1, 1, 0),
371
+            'DPRODUCT'        => array(189, 3, 0, 0),
372
+            'ISNONTEXT'       => array(190, 1, 1, 0),
373
+            'STDEVP'          => array(193, -1, 0, 0),
374
+            'VARP'            => array(194, -1, 0, 0),
375
+            'DSTDEVP'         => array(195, 3, 0, 0),
376
+            'DVARP'           => array(196, 3, 0, 0),
377
+            'TRUNC'           => array(197, -1, 1, 0),
378
+            'ISLOGICAL'       => array(198, 1, 1, 0),
379
+            'DCOUNTA'         => array(199, 3, 0, 0),
380
+            'USDOLLAR'        => array(204, -1, 1, 0),
381
+            'FINDB'           => array(205, -1, 1, 0),
382
+            'SEARCHB'         => array(206, -1, 1, 0),
383
+            'REPLACEB'        => array(207, 4, 1, 0),
384
+            'LEFTB'           => array(208, -1, 1, 0),
385
+            'RIGHTB'          => array(209, -1, 1, 0),
386
+            'MIDB'            => array(210, 3, 1, 0),
387
+            'LENB'            => array(211, 1, 1, 0),
388
+            'ROUNDUP'         => array(212, 2, 1, 0),
389
+            'ROUNDDOWN'       => array(213, 2, 1, 0),
390
+            'ASC'             => array(214, 1, 1, 0),
391
+            'DBCS'            => array(215, 1, 1, 0),
392
+            'RANK'            => array(216, -1, 0, 0),
393
+            'ADDRESS'         => array(219, -1, 1, 0),
394
+            'DAYS360'         => array(220, -1, 1, 0),
395
+            'TODAY'           => array(221, 0, 1, 1),
396
+            'VDB'             => array(222, -1, 1, 0),
397
+            'MEDIAN'          => array(227, -1, 0, 0),
398
+            'SUMPRODUCT'      => array(228, -1, 2, 0),
399
+            'SINH'            => array(229, 1, 1, 0),
400
+            'COSH'            => array(230, 1, 1, 0),
401
+            'TANH'            => array(231, 1, 1, 0),
402
+            'ASINH'           => array(232, 1, 1, 0),
403
+            'ACOSH'           => array(233, 1, 1, 0),
404
+            'ATANH'           => array(234, 1, 1, 0),
405
+            'DGET'            => array(235, 3, 0, 0),
406
+            'INFO'            => array(244, 1, 1, 1),
407
+            'DB'              => array(247, -1, 1, 0),
408
+            'FREQUENCY'       => array(252, 2, 0, 0),
409
+            'ERROR.TYPE'      => array(261, 1, 1, 0),
410
+            'REGISTER.ID'     => array(267, -1, 1, 0),
411
+            'AVEDEV'          => array(269, -1, 0, 0),
412
+            'BETADIST'        => array(270, -1, 1, 0),
413
+            'GAMMALN'         => array(271, 1, 1, 0),
414
+            'BETAINV'         => array(272, -1, 1, 0),
415
+            'BINOMDIST'       => array(273, 4, 1, 0),
416
+            'CHIDIST'         => array(274, 2, 1, 0),
417
+            'CHIINV'          => array(275, 2, 1, 0),
418
+            'COMBIN'          => array(276, 2, 1, 0),
419
+            'CONFIDENCE'      => array(277, 3, 1, 0),
420
+            'CRITBINOM'       => array(278, 3, 1, 0),
421
+            'EVEN'            => array(279, 1, 1, 0),
422
+            'EXPONDIST'       => array(280, 3, 1, 0),
423
+            'FDIST'           => array(281, 3, 1, 0),
424
+            'FINV'            => array(282, 3, 1, 0),
425
+            'FISHER'          => array(283, 1, 1, 0),
426
+            'FISHERINV'       => array(284, 1, 1, 0),
427
+            'FLOOR'           => array(285, 2, 1, 0),
428
+            'GAMMADIST'       => array(286, 4, 1, 0),
429
+            'GAMMAINV'        => array(287, 3, 1, 0),
430
+            'CEILING'         => array(288, 2, 1, 0),
431
+            'HYPGEOMDIST'     => array(289, 4, 1, 0),
432
+            'LOGNORMDIST'     => array(290, 3, 1, 0),
433
+            'LOGINV'          => array(291, 3, 1, 0),
434
+            'NEGBINOMDIST'    => array(292, 3, 1, 0),
435
+            'NORMDIST'        => array(293, 4, 1, 0),
436
+            'NORMSDIST'       => array(294, 1, 1, 0),
437
+            'NORMINV'         => array(295, 3, 1, 0),
438
+            'NORMSINV'        => array(296, 1, 1, 0),
439
+            'STANDARDIZE'     => array(297, 3, 1, 0),
440
+            'ODD'             => array(298, 1, 1, 0),
441
+            'PERMUT'          => array(299, 2, 1, 0),
442
+            'POISSON'         => array(300, 3, 1, 0),
443
+            'TDIST'           => array(301, 3, 1, 0),
444
+            'WEIBULL'         => array(302, 4, 1, 0),
445
+            'SUMXMY2'         => array(303, 2, 2, 0),
446
+            'SUMX2MY2'        => array(304, 2, 2, 0),
447
+            'SUMX2PY2'        => array(305, 2, 2, 0),
448
+            'CHITEST'         => array(306, 2, 2, 0),
449
+            'CORREL'          => array(307, 2, 2, 0),
450
+            'COVAR'           => array(308, 2, 2, 0),
451
+            'FORECAST'        => array(309, 3, 2, 0),
452
+            'FTEST'           => array(310, 2, 2, 0),
453
+            'INTERCEPT'       => array(311, 2, 2, 0),
454
+            'PEARSON'         => array(312, 2, 2, 0),
455
+            'RSQ'             => array(313, 2, 2, 0),
456
+            'STEYX'           => array(314, 2, 2, 0),
457
+            'SLOPE'           => array(315, 2, 2, 0),
458
+            'TTEST'           => array(316, 4, 2, 0),
459
+            'PROB'            => array(317, -1, 2, 0),
460
+            'DEVSQ'           => array(318, -1, 0, 0),
461
+            'GEOMEAN'         => array(319, -1, 0, 0),
462
+            'HARMEAN'         => array(320, -1, 0, 0),
463
+            'SUMSQ'           => array(321, -1, 0, 0),
464
+            'KURT'            => array(322, -1, 0, 0),
465
+            'SKEW'            => array(323, -1, 0, 0),
466
+            'ZTEST'           => array(324, -1, 0, 0),
467
+            'LARGE'           => array(325, 2, 0, 0),
468
+            'SMALL'           => array(326, 2, 0, 0),
469
+            'QUARTILE'        => array(327, 2, 0, 0),
470
+            'PERCENTILE'      => array(328, 2, 0, 0),
471
+            'PERCENTRANK'     => array(329, -1, 0, 0),
472
+            'MODE'            => array(330, -1, 2, 0),
473
+            'TRIMMEAN'        => array(331, 2, 0, 0),
474
+            'TINV'            => array(332, 2, 1, 0),
475
+            'CONCATENATE'     => array(336, -1, 1, 0),
476
+            'POWER'           => array(337, 2, 1, 0),
477
+            'RADIANS'         => array(342, 1, 1, 0),
478
+            'DEGREES'         => array(343, 1, 1, 0),
479
+            'SUBTOTAL'        => array(344, -1, 0, 0),
480
+            'SUMIF'           => array(345, -1, 0, 0),
481
+            'COUNTIF'         => array(346, 2, 0, 0),
482
+            'COUNTBLANK'      => array(347, 1, 0, 0),
483
+            'ISPMT'           => array(350, 4, 1, 0),
484
+            'DATEDIF'         => array(351, 3, 1, 0),
485
+            'DATESTRING'      => array(352, 1, 1, 0),
486
+            'NUMBERSTRING'    => array(353, 2, 1, 0),
487
+            'ROMAN'           => array(354, -1, 1, 0),
488
+            'GETPIVOTDATA'    => array(358, -1, 0, 0),
489
+            'HYPERLINK'       => array(359, -1, 1, 0),
490
+            'PHONETIC'        => array(360, 1, 0, 0),
491
+            'AVERAGEA'        => array(361, -1, 0, 0),
492
+            'MAXA'            => array(362, -1, 0, 0),
493
+            'MINA'            => array(363, -1, 0, 0),
494
+            'STDEVPA'         => array(364, -1, 0, 0),
495
+            'VARPA'           => array(365, -1, 0, 0),
496
+            'STDEVA'          => array(366, -1, 0, 0),
497
+            'VARA'            => array(367, -1, 0, 0),
498
+            'BAHTTEXT'        => array(368, 1, 0, 0),
499 499
         );
500 500
     }
501 501
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
      */
599 599
     private function convertFunction($token, $num_args)
600 600
     {
601
-        $args     = $this->functions[$token][1];
601
+        $args = $this->functions[$token][1];
602 602
 //        $volatile = $this->functions[$token][3];
603 603
 
604 604
         // Fixed number of args eg. TIME($i, $j, $k).
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
             // TODO: use real error codes
646 646
             throw new \PHPExcel\Writer\Exception("Unknown class $class");
647 647
         }
648
-        return $ptgArea . $row1 . $row2 . $col1. $col2;
648
+        return $ptgArea . $row1 . $row2 . $col1 . $col2;
649 649
     }
650 650
 
651 651
     /**
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
             list($row1, $col1) = $this->cellToPackedRowcol($cell1);
675 675
             list($row2, $col2) = $this->cellToPackedRowcol($cell2);
676 676
         } else { // It's a rows range (like 26:27)
677
-             list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2);
677
+             list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2);
678 678
         }
679 679
 
680 680
         // The ptg value depends on the class of the ptg.
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 //            throw new \PHPExcel\Writer\Exception("Unknown class $class");
689 689
 //        }
690 690
 
691
-        return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
691
+        return $ptgArea . $ext_ref . $row1 . $row2 . $col1 . $col2;
692 692
     }
693 693
 
694 694
     /**
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 //            // TODO: use real error codes
718 718
 //            throw new \PHPExcel\Writer\Exception("Unknown class $class");
719 719
 //        }
720
-        return $ptgRef.$row.$col;
720
+        return $ptgRef . $row . $col;
721 721
     }
722 722
 
723 723
     /**
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 //            throw new \PHPExcel\Writer\Exception("Unknown class $class");
753 753
 //        }
754 754
 
755
-        return $ptgRef . $ext_ref. $row . $col;
755
+        return $ptgRef . $ext_ref . $row . $col;
756 756
     }
757 757
 
758 758
     /**
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
             }
1039 1039
 
1040 1040
             if ($i < ($formula_length - 1)) {
1041
-                $this->lookAhead = $this->formula{$i+1};
1041
+                $this->lookAhead = $this->formula{$i + 1};
1042 1042
             }
1043 1043
             $token = '';
1044 1044
         }
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             $token .= $this->formula{$i};
1048 1048
 
1049 1049
             if ($i < ($formula_length - 1)) {
1050
-                $this->lookAhead = $this->formula{$i+1};
1050
+                $this->lookAhead = $this->formula{$i + 1};
1051 1051
             } else {
1052 1052
                 $this->lookAhead = '';
1053 1053
             }
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
             }
1063 1063
 
1064 1064
             if ($i < ($formula_length - 2)) {
1065
-                $this->lookAhead = $this->formula{$i+2};
1065
+                $this->lookAhead = $this->formula{$i + 2};
1066 1066
             } else { // if we run out of characters lookAhead becomes empty
1067 1067
                 $this->lookAhead = '';
1068 1068
             }
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
                 } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
1131 1131
                     // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
1132 1132
                     return $token;
1133
-                } elseif (is_numeric($token) and (!is_numeric($token.$this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) {
1133
+                } elseif (is_numeric($token) and (!is_numeric($token . $this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) {
1134 1134
                     // If it's a number (check that it's not a sheet name or range)
1135 1135
                     return $token;
1136
-                } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"')%2 == 0)) {
1136
+                } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"') % 2 == 0)) {
1137 1137
                     // If it's a string (of maximum 255 characters)
1138 1138
                     return $token;
1139 1139
                 } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
         $this->formula      = $formula;
1166 1166
         $this->lookAhead    = isset($formula{1}) ? $formula{1} : '';
1167 1167
         $this->advance();
1168
-        $this->parseTree   = $this->condition();
1168
+        $this->parseTree = $this->condition();
1169 1169
         return true;
1170 1170
     }
1171 1171
 
@@ -1330,12 +1330,12 @@  discard block
 block discarded – undo
1330 1330
     private function fact()
1331 1331
     {
1332 1332
         if ($this->currentToken == "(") {
1333
-            $this->advance();         // eat the "("
1333
+            $this->advance(); // eat the "("
1334 1334
             $result = $this->parenthesizedExpression();
1335 1335
             if ($this->currentToken != ")") {
1336 1336
                 throw new \PHPExcel\Writer\Exception("')' token expected.");
1337 1337
             }
1338
-            $this->advance();         // eat the ")"
1338
+            $this->advance(); // eat the ")"
1339 1339
             return $result;
1340 1340
         }
1341 1341
         // if it's a reference
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
             // If it's a number or a percent
1379 1379
             if ($this->lookAhead == '%') {
1380 1380
                 $result = $this->createTree('ptgPercent', $this->currentToken, '');
1381
-                $this->advance();  // Skip the percentage operator once we've pre-built that tree
1381
+                $this->advance(); // Skip the percentage operator once we've pre-built that tree
1382 1382
             } else {
1383 1383
                 $result = $this->createTree($this->currentToken, '', '');
1384 1384
             }
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
             $result = $this->func();
1390 1390
             return $result;
1391 1391
         }
1392
-        throw new \PHPExcel\Writer\Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter);
1392
+        throw new \PHPExcel\Writer\Exception("Syntax error: " . $this->currentToken . ", lookahead: " . $this->lookAhead . ", current char: " . $this->currentCharacter);
1393 1393
     }
1394 1394
 
1395 1395
     /**
@@ -1405,12 +1405,12 @@  discard block
 block discarded – undo
1405 1405
         $function = strtoupper($this->currentToken);
1406 1406
         $result   = ''; // initialize result
1407 1407
         $this->advance();
1408
-        $this->advance();         // eat the "("
1408
+        $this->advance(); // eat the "("
1409 1409
         while ($this->currentToken != ')') {
1410 1410
         /**/
1411 1411
             if ($num_args > 0) {
1412 1412
                 if ($this->currentToken == "," || $this->currentToken == ";") {
1413
-                    $this->advance();  // eat the "," or ";"
1413
+                    $this->advance(); // eat the "," or ";"
1414 1414
                 } else {
1415 1415
                     throw new \PHPExcel\Writer\Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
1416 1416
                 }
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
         }
1433 1433
 
1434 1434
         $result = $this->createTree($function, $result, $num_args);
1435
-        $this->advance();         // eat the ")"
1435
+        $this->advance(); // eat the ")"
1436 1436
         return $result;
1437 1437
     }
1438 1438
 
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
                 $left_tree = '';
1513 1513
             }
1514 1514
             // add it's left subtree and return.
1515
-            return $left_tree.$this->convertFunction($tree['value'], $tree['right']);
1515
+            return $left_tree . $this->convertFunction($tree['value'], $tree['right']);
1516 1516
         } else {
1517 1517
             $converted_tree = $this->convert($tree['value']);
1518 1518
         }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5/Worksheet.php 1 patch
Spacing   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         $this->_preCalculateFormulas = $preCalculateFormulas;
218 218
         $this->stringTotal        = &$str_total;
219
-        $this->stringUnique        = &$str_unique;
219
+        $this->stringUnique = &$str_unique;
220 220
         $this->stringTable        = &$str_table;
221 221
         $this->colors            = &$colors;
222 222
         $this->parser            = $parser;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         //$this->offset            = 0;
228 228
         $this->xlsStringMaxLength = 255;
229 229
         $this->columnInfo  = array();
230
-        $this->selection   = array(0,0,0,0);
230
+        $this->selection   = array(0, 0, 0, 0);
231 231
         $this->activePane  = 3;
232 232
 
233 233
         $this->_print_headers = 0;
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         $minR = 1;
244 244
         $minC = 'A';
245 245
 
246
-        $maxR  = $this->phpSheet->getHighestRow();
246
+        $maxR = $this->phpSheet->getHighestRow();
247 247
         $maxC = $this->phpSheet->getHighestColumn();
248 248
 
249 249
         // Determine lowest and highest column and row
250 250
 //        $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
251
-        $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ;
251
+        $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR;
252 252
 
253 253
         $this->firstColumnIndex = \PHPExcel\Cell::columnIndexFromString($minC);
254 254
         $this->lastColumnIndex  = \PHPExcel\Cell::columnIndexFromString($maxC);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
 
297 297
         $columnDimensions = $phpSheet->getColumnDimensions();
298
-        $maxCol = $this->lastColumnIndex -1;
298
+        $maxCol = $this->lastColumnIndex - 1;
299 299
         for ($i = 0; $i <= $maxCol; ++$i) {
300 300
             $hidden = 0;
301 301
             $level = 0;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         }
546 546
 
547 547
         $firstCellCoordinates = \PHPExcel\Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
548
-        $lastCellCoordinates  = \PHPExcel\Cell::coordinateFromString($lastCell);  // e.g. array(1, 6)
548
+        $lastCellCoordinates  = \PHPExcel\Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
549 549
 
550 550
         return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, \PHPExcel\Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, \PHPExcel\Cell::columnIndexFromString($lastCellCoordinates[0]) - 1);
551 551
     }
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 
563 563
         // Return data stored in memory
564 564
         if (isset($this->_data)) {
565
-            $tmp   = $this->_data;
565
+            $tmp = $this->_data;
566 566
             unset($this->_data);
567 567
             return $tmp;
568 568
         }
@@ -619,17 +619,17 @@  discard block
 block discarded – undo
619 619
      */
620 620
     private function writeNumber($row, $col, $num, $xfIndex)
621 621
     {
622
-        $record    = 0x0203;                 // Record identifier
623
-        $length    = 0x000E;                 // Number of bytes to follow
622
+        $record    = 0x0203; // Record identifier
623
+        $length    = 0x000E; // Number of bytes to follow
624 624
 
625
-        $header        = pack("vv", $record, $length);
626
-        $data        = pack("vvv", $row, $col, $xfIndex);
627
-        $xl_double    = pack("d", $num);
625
+        $header = pack("vv", $record, $length);
626
+        $data = pack("vvv", $row, $col, $xfIndex);
627
+        $xl_double = pack("d", $num);
628 628
         if (self::getByteOrder()) { // if it's Big Endian
629 629
             $xl_double = strrev($xl_double);
630 630
         }
631 631
 
632
-        $this->append($header.$data.$xl_double);
632
+        $this->append($header . $data . $xl_double);
633 633
         return(0);
634 634
     }
635 635
 
@@ -657,8 +657,8 @@  discard block
 block discarded – undo
657 657
      */
658 658
     private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
659 659
     {
660
-        $record    = 0x00FD;                   // Record identifier
661
-        $length    = 0x000A;                   // Bytes to follow
660
+        $record    = 0x00FD; // Record identifier
661
+        $length    = 0x000A; // Bytes to follow
662 662
         $str = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun);
663 663
 
664 664
         /* check if string is already present */
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
         }
668 668
         $this->stringTotal++;
669 669
 
670
-        $header    = pack('vv', $record, $length);
671
-        $data    = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
672
-        $this->append($header.$data);
670
+        $header = pack('vv', $record, $length);
671
+        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
672
+        $this->append($header . $data);
673 673
     }
674 674
 
675 675
     /**
@@ -690,20 +690,20 @@  discard block
 block discarded – undo
690 690
     private function writeLabel($row, $col, $str, $xfIndex)
691 691
     {
692 692
         $strlen    = strlen($str);
693
-        $record    = 0x0204;                   // Record identifier
694
-        $length    = 0x0008 + $strlen;         // Bytes to follow
693
+        $record    = 0x0204; // Record identifier
694
+        $length    = 0x0008 + $strlen; // Bytes to follow
695 695
 
696 696
         $str_error = 0;
697 697
 
698 698
         if ($strlen > $this->xlsStringMaxLength) { // LABEL must be < 255 chars
699
-            $str    = substr($str, 0, $this->xlsStringMaxLength);
699
+            $str = substr($str, 0, $this->xlsStringMaxLength);
700 700
             $length    = 0x0008 + $this->xlsStringMaxLength;
701 701
             $strlen    = $this->xlsStringMaxLength;
702 702
             $str_error = -3;
703 703
         }
704 704
 
705
-        $header    = pack("vv", $record, $length);
706
-        $data    = pack("vvvv", $row, $col, $xfIndex, $strlen);
705
+        $header = pack("vv", $record, $length);
706
+        $data = pack("vvvv", $row, $col, $xfIndex, $strlen);
707 707
         $this->append($header . $data . $str);
708 708
         return($str_error);
709 709
     }
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
      */
726 726
     private function writeLabelSst($row, $col, $str, $xfIndex)
727 727
     {
728
-        $record    = 0x00FD;                   // Record identifier
729
-        $length    = 0x000A;                   // Bytes to follow
728
+        $record    = 0x00FD; // Record identifier
729
+        $length    = 0x000A; // Bytes to follow
730 730
 
731 731
         $str = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str);
732 732
 
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
         }
737 737
         $this->stringTotal++;
738 738
 
739
-        $header    = pack('vv', $record, $length);
740
-        $data    = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
741
-        $this->append($header.$data);
739
+        $header = pack('vv', $record, $length);
740
+        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
741
+        $this->append($header . $data);
742 742
     }
743 743
 
744 744
     /**
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
      */
752 752
     private function writeNote($row, $col, $note)
753 753
     {
754
-        $note_length    = strlen($note);
755
-        $record            = 0x001C;            // Record identifier
756
-        $max_length        = 2048;                // Maximun length for a NOTE record
754
+        $note_length = strlen($note);
755
+        $record            = 0x001C; // Record identifier
756
+        $max_length        = 2048; // Maximun length for a NOTE record
757 757
 
758 758
         // Length for this record is no more than 2048 + 6
759 759
         $length    = 0x0006 + min($note_length, 2048);
760 760
         $header    = pack("vv", $record, $length);
761
-        $data    = pack("vvv", $row, $col, $note_length);
761
+        $data = pack("vvv", $row, $col, $note_length);
762 762
         $this->append($header . $data . substr($note, 0, 2048));
763 763
 
764 764
         for ($i = $max_length; $i < $note_length; $i += $max_length) {
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
             $length = 0x0006 + strlen($chunk);
767 767
             $header = pack("vv", $record, $length);
768 768
             $data   = pack("vvv", -1, 0, strlen($chunk));
769
-            $this->append($header.$data.$chunk);
769
+            $this->append($header . $data . $chunk);
770 770
         }
771 771
         return(0);
772 772
     }
@@ -789,8 +789,8 @@  discard block
 block discarded – undo
789 789
      */
790 790
     public function writeBlank($row, $col, $xfIndex)
791 791
     {
792
-        $record    = 0x0201;                 // Record identifier
793
-        $length    = 0x0006;                 // Number of bytes to follow
792
+        $record    = 0x0201; // Record identifier
793
+        $length    = 0x0006; // Number of bytes to follow
794 794
 
795 795
         $header    = pack("vv", $record, $length);
796 796
         $data      = pack("vvv", $row, $col, $xfIndex);
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
      */
837 837
     private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue)
838 838
     {
839
-        $record    = 0x0006;     // Record identifier
839
+        $record = 0x0006; // Record identifier
840 840
 
841 841
         // Initialize possible additional value for STRING record that should be written after the FORMULA record?
842 842
         $stringValue = null;
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
             // we use best effort to determine data type
848 848
             if (is_bool($calculatedValue)) {
849 849
                 // Boolean value
850
-                $num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF);
850
+                $num = pack('CCCvCv', 0x01, 0x00, (int) $calculatedValue, 0x00, 0x00, 0xFFFF);
851 851
             } elseif (is_int($calculatedValue) || is_float($calculatedValue)) {
852 852
                 // Numeric value
853 853
                 $num = pack('d', $calculatedValue);
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
             $num = pack('d', 0x00);
872 872
         }
873 873
 
874
-        $grbit        = 0x03;                // Option flags
875
-        $unknown    = 0x0000;            // Must be zero
874
+        $grbit = 0x03; // Option flags
875
+        $unknown = 0x0000; // Must be zero
876 876
 
877 877
         // Strip the '=' or '@' sign at the beginning of the formula string
878 878
         if ($formula{0} == '=') {
@@ -888,8 +888,8 @@  discard block
 block discarded – undo
888 888
             $error = $this->parser->parse($formula);
889 889
             $formula = $this->parser->toReversePolish();
890 890
 
891
-            $formlen    = strlen($formula);    // Length of the binary string
892
-            $length     = 0x16 + $formlen;     // Length of the record data
891
+            $formlen    = strlen($formula); // Length of the binary string
892
+            $length     = 0x16 + $formlen; // Length of the record data
893 893
 
894 894
             $header    = pack("vv", $record, $length);
895 895
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
      */
916 916
     private function writeStringRecord($stringValue)
917 917
     {
918
-        $record = 0x0207;     // Record identifier
918
+        $record = 0x0207; // Record identifier
919 919
         $data = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue);
920 920
 
921 921
         $length = strlen($data);
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
      */
994 994
     public function writeUrlWeb($row1, $col1, $row2, $col2, $url)
995 995
     {
996
-        $record      = 0x01B8;                       // Record identifier
997
-        $length      = 0x00000;                      // Bytes to follow
996
+        $record      = 0x01B8; // Record identifier
997
+        $length      = 0x00000; // Bytes to follow
998 998
 
999 999
         // Pack the undocumented parts of the hyperlink stream
1000 1000
         $unknown1    = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
      */
1039 1039
     public function writeUrlInternal($row1, $col1, $row2, $col2, $url)
1040 1040
     {
1041
-        $record      = 0x01B8;                       // Record identifier
1042
-        $length      = 0x00000;                      // Bytes to follow
1041
+        $record      = 0x01B8; // Record identifier
1042
+        $length      = 0x00000; // Bytes to follow
1043 1043
 
1044 1044
         // Strip URL type
1045 1045
         $url = preg_replace('/^internal:/', '', $url);
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
             return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format));
1098 1098
         }
1099 1099
 
1100
-        $record      = 0x01B8;                       // Record identifier
1101
-        $length      = 0x00000;                      // Bytes to follow
1100
+        $record      = 0x01B8; // Record identifier
1101
+        $length      = 0x00000; // Bytes to follow
1102 1102
 
1103 1103
         // Strip URL type and change Unix dir separator to Dos style (if needed)
1104 1104
         //
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
         if (preg_match('/^[A-Z]:/', $url)) {
1115 1115
             $absolute = 0x02; // absolute path on Windows, e.g. C:\...
1116 1116
         }
1117
-        $link_type               = 0x01 | $absolute;
1117
+        $link_type = 0x01 | $absolute;
1118 1118
 
1119 1119
         // Determine if the link contains a sheet reference and change some of the
1120 1120
         // parameters accordingly.
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
         $dir_short   = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
1137 1137
 
1138 1138
         // Store the long dir name as a wchar string (non-null terminated)
1139
-        $dir_long       = $dir_long . "\0";
1139
+        $dir_long = $dir_long . "\0";
1140 1140
 
1141 1141
         // Pack the lengths of the dir strings
1142 1142
         $dir_short_len = pack("V", strlen($dir_short));
@@ -1150,15 +1150,15 @@  discard block
 block discarded – undo
1150 1150
         $unknown4 = pack("v", 0x03);
1151 1151
 
1152 1152
         // Pack the main data stream
1153
-        $data        = pack("vvvv", $row1, $row2, $col1, $col2) .
1154
-                          $unknown1     .
1155
-                          $link_type    .
1156
-                          $unknown2     .
1157
-                          $up_count     .
1158
-                          $dir_short_len.
1159
-                          $dir_short    .
1160
-                          $unknown3     .
1161
-                          $stream_len   ;/*.
1153
+        $data = pack("vvvv", $row1, $row2, $col1, $col2) .
1154
+                          $unknown1 .
1155
+                          $link_type .
1156
+                          $unknown2 .
1157
+                          $up_count .
1158
+                          $dir_short_len .
1159
+                          $dir_short .
1160
+                          $unknown3 .
1161
+                          $stream_len; /*.
1162 1162
                           $dir_long_len .
1163 1163
                           $unknown4     .
1164 1164
                           $dir_long     .
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
         $header   = pack("vv", $record, $length);
1171 1171
 
1172 1172
         // Write the packed data
1173
-        $this->append($header. $data);
1173
+        $this->append($header . $data);
1174 1174
         return 0;
1175 1175
     }
1176 1176
 
@@ -1186,14 +1186,14 @@  discard block
 block discarded – undo
1186 1186
      */
1187 1187
     private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0)
1188 1188
     {
1189
-        $record      = 0x0208;               // Record identifier
1190
-        $length      = 0x0010;               // Number of bytes to follow
1191
-
1192
-        $colMic      = 0x0000;               // First defined column
1193
-        $colMac      = 0x0000;               // Last defined column
1194
-        $irwMac      = 0x0000;               // Used by Excel to optimise loading
1195
-        $reserved    = 0x0000;               // Reserved
1196
-        $grbit       = 0x0000;               // Option flags
1189
+        $record      = 0x0208; // Record identifier
1190
+        $length      = 0x0010; // Number of bytes to follow
1191
+
1192
+        $colMic      = 0x0000; // First defined column
1193
+        $colMac      = 0x0000; // Last defined column
1194
+        $irwMac      = 0x0000; // Used by Excel to optimise loading
1195
+        $reserved    = 0x0000; // Reserved
1196
+        $grbit       = 0x0000; // Option flags
1197 1197
         $ixfe        = $xfIndex;
1198 1198
 
1199 1199
         if ($height < 0) {
@@ -1202,9 +1202,9 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
         // Use writeRow($row, null, $XF) to set XF format without setting height
1204 1204
         if ($height != null) {
1205
-            $miyRw = $height * 20;  // row height
1205
+            $miyRw = $height * 20; // row height
1206 1206
         } else {
1207
-            $miyRw = 0xff;          // default row height is 256
1207
+            $miyRw = 0xff; // default row height is 256
1208 1208
         }
1209 1209
 
1210 1210
         // Set the options flags. fUnsynced is used to show that the font and row
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
         $header   = pack("vv", $record, $length);
1229 1229
         $data     = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe);
1230
-        $this->append($header.$data);
1230
+        $this->append($header . $data);
1231 1231
     }
1232 1232
 
1233 1233
     /**
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
         $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved
1242 1242
 
1243 1243
         $header = pack("vv", $record, $length);
1244
-        $this->append($header.$data);
1244
+        $this->append($header . $data);
1245 1245
     }
1246 1246
 
1247 1247
     /**
@@ -1249,53 +1249,53 @@  discard block
 block discarded – undo
1249 1249
      */
1250 1250
     private function writeWindow2()
1251 1251
     {
1252
-        $record         = 0x023E;     // Record identifier
1252
+        $record         = 0x023E; // Record identifier
1253 1253
         $length         = 0x0012;
1254 1254
 
1255
-        $grbit          = 0x00B6;     // Option flags
1256
-        $rwTop          = 0x0000;     // Top row visible in window
1257
-        $colLeft        = 0x0000;     // Leftmost column visible in window
1255
+        $grbit          = 0x00B6; // Option flags
1256
+        $rwTop          = 0x0000; // Top row visible in window
1257
+        $colLeft        = 0x0000; // Leftmost column visible in window
1258 1258
 
1259 1259
 
1260 1260
         // The options flags that comprise $grbit
1261
-        $fDspFmla       = 0;                     // 0 - bit
1261
+        $fDspFmla       = 0; // 0 - bit
1262 1262
         $fDspGrid       = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1
1263 1263
         $fDspRwCol      = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2
1264
-        $fFrozen        = $this->phpSheet->getFreezePane() ? 1 : 0;        // 3
1265
-        $fDspZeros      = 1;                     // 4
1266
-        $fDefaultHdr    = 1;                     // 5
1264
+        $fFrozen        = $this->phpSheet->getFreezePane() ? 1 : 0; // 3
1265
+        $fDspZeros      = 1; // 4
1266
+        $fDefaultHdr    = 1; // 5
1267 1267
         $fArabic        = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6
1268
-        $fDspGuts       = $this->outlineOn;    // 7
1269
-        $fFrozenNoSplit = 0;                     // 0 - bit
1268
+        $fDspGuts       = $this->outlineOn; // 7
1269
+        $fFrozenNoSplit = 0; // 0 - bit
1270 1270
         // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
1271 1271
         $fSelected      = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
1272
-        $fPaged         = 1;                     // 2
1272
+        $fPaged         = 1; // 2
1273 1273
         $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === \PHPExcel\Worksheet\SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
1274 1274
 
1275 1275
         $grbit             = $fDspFmla;
1276
-        $grbit            |= $fDspGrid       << 1;
1277
-        $grbit            |= $fDspRwCol       << 2;
1278
-        $grbit            |= $fFrozen           << 3;
1279
-        $grbit            |= $fDspZeros       << 4;
1280
-        $grbit            |= $fDefaultHdr       << 5;
1281
-        $grbit            |= $fArabic           << 6;
1282
-        $grbit            |= $fDspGuts       << 7;
1276
+        $grbit            |= $fDspGrid << 1;
1277
+        $grbit            |= $fDspRwCol << 2;
1278
+        $grbit            |= $fFrozen << 3;
1279
+        $grbit            |= $fDspZeros << 4;
1280
+        $grbit            |= $fDefaultHdr << 5;
1281
+        $grbit            |= $fArabic << 6;
1282
+        $grbit            |= $fDspGuts << 7;
1283 1283
         $grbit            |= $fFrozenNoSplit << 8;
1284
-        $grbit            |= $fSelected       << 9;
1285
-        $grbit            |= $fPaged           << 10;
1284
+        $grbit            |= $fSelected << 9;
1285
+        $grbit            |= $fPaged << 10;
1286 1286
         $grbit            |= $fPageBreakPreview << 11;
1287 1287
 
1288 1288
         $header  = pack("vv", $record, $length);
1289 1289
         $data    = pack("vvv", $grbit, $rwTop, $colLeft);
1290 1290
 
1291 1291
         // FIXME !!!
1292
-        $rgbHdr       = 0x0040; // Row/column heading and gridline color index
1292
+        $rgbHdr = 0x0040; // Row/column heading and gridline color index
1293 1293
         $zoom_factor_page_break = ($fPageBreakPreview ? $this->phpSheet->getSheetView()->getZoomScale() : 0x0000);
1294
-        $zoom_factor_normal =  $this->phpSheet->getSheetView()->getZoomScaleNormal();
1294
+        $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal();
1295 1295
 
1296 1296
         $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
1297 1297
 
1298
-        $this->append($header.$data);
1298
+        $this->append($header . $data);
1299 1299
     }
1300 1300
 
1301 1301
     /**
@@ -1312,8 +1312,8 @@  discard block
 block discarded – undo
1312 1312
         // convert to twips
1313 1313
         $defaultRowHeight = (int) 20 * $defaultRowHeight;
1314 1314
 
1315
-        $record   = 0x0225;      // Record identifier
1316
-        $length   = 0x0004;      // Number of bytes to follow
1315
+        $record   = 0x0225; // Record identifier
1316
+        $length   = 0x0004; // Number of bytes to follow
1317 1317
 
1318 1318
         $header   = pack("vv", $record, $length);
1319 1319
         $data     = pack("vv", 1, $defaultRowHeight);
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
     {
1328 1328
         $defaultColWidth = 8;
1329 1329
 
1330
-        $record   = 0x0055;      // Record identifier
1331
-        $length   = 0x0002;      // Number of bytes to follow
1330
+        $record   = 0x0055; // Record identifier
1331
+        $length   = 0x0002; // Number of bytes to follow
1332 1332
 
1333 1333
         $header = pack("vv", $record, $length);
1334 1334
         $data = pack("v", $defaultColWidth);
@@ -1377,20 +1377,20 @@  discard block
 block discarded – undo
1377 1377
         } else {
1378 1378
             $level = 0;
1379 1379
         }
1380
-        $record   = 0x007D;          // Record identifier
1381
-        $length   = 0x000C;          // Number of bytes to follow
1380
+        $record   = 0x007D; // Record identifier
1381
+        $length   = 0x000C; // Number of bytes to follow
1382 1382
 
1383
-        $coldx   *= 256;             // Convert to units of 1/256 of a char
1383
+        $coldx   *= 256; // Convert to units of 1/256 of a char
1384 1384
 
1385 1385
         $ixfe     = $xfIndex;
1386
-        $reserved = 0x0000;            // Reserved
1386
+        $reserved = 0x0000; // Reserved
1387 1387
 
1388 1388
         $level = max(0, min($level, 7));
1389 1389
         $grbit |= $level << 8;
1390 1390
 
1391 1391
         $header   = pack("vv", $record, $length);
1392 1392
         $data     = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
1393
-        $this->append($header.$data);
1393
+        $this->append($header . $data);
1394 1394
     }
1395 1395
 
1396 1396
     /**
@@ -1424,20 +1424,20 @@  discard block
 block discarded – undo
1424 1424
         $rwFirst = min($rwFirst, 65535);
1425 1425
         $rwLast  = min($rwLast, 65535);
1426 1426
 
1427
-        $record   = 0x001D;                  // Record identifier
1428
-        $length   = 0x000F;                  // Number of bytes to follow
1427
+        $record   = 0x001D; // Record identifier
1428
+        $length   = 0x000F; // Number of bytes to follow
1429 1429
 
1430
-        $pnn      = $this->activePane;     // Pane position
1431
-        $rwAct    = $rwFirst;                // Active row
1432
-        $colAct   = $colFirst;               // Active column
1433
-        $irefAct  = 0;                       // Active cell ref
1434
-        $cref     = 1;                       // Number of refs
1430
+        $pnn      = $this->activePane; // Pane position
1431
+        $rwAct    = $rwFirst; // Active row
1432
+        $colAct   = $colFirst; // Active column
1433
+        $irefAct  = 0; // Active cell ref
1434
+        $cref     = 1; // Number of refs
1435 1435
 
1436 1436
         if (!isset($rwLast)) {
1437
-            $rwLast   = $rwFirst;       // Last  row in reference
1437
+            $rwLast   = $rwFirst; // Last  row in reference
1438 1438
         }
1439 1439
         if (!isset($colLast)) {
1440
-            $colLast  = $colFirst;      // Last  col in reference
1440
+            $colLast  = $colFirst; // Last  col in reference
1441 1441
         }
1442 1442
 
1443 1443
         // Swap last row/col for first row/col as necessary
@@ -1544,21 +1544,21 @@  discard block
 block discarded – undo
1544 1544
         $record = 0x0867;
1545 1545
 
1546 1546
         // prepare options
1547
-        $options  =   (int) !$this->phpSheet->getProtection()->getObjects()
1548
-                    | (int) !$this->phpSheet->getProtection()->getScenarios()           << 1
1549
-                    | (int) !$this->phpSheet->getProtection()->getFormatCells()         << 2
1550
-                    | (int) !$this->phpSheet->getProtection()->getFormatColumns()       << 3
1551
-                    | (int) !$this->phpSheet->getProtection()->getFormatRows()          << 4
1552
-                    | (int) !$this->phpSheet->getProtection()->getInsertColumns()       << 5
1553
-                    | (int) !$this->phpSheet->getProtection()->getInsertRows()          << 6
1554
-                    | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks()    << 7
1555
-                    | (int) !$this->phpSheet->getProtection()->getDeleteColumns()       << 8
1556
-                    | (int) !$this->phpSheet->getProtection()->getDeleteRows()          << 9
1557
-                    | (int) !$this->phpSheet->getProtection()->getSelectLockedCells()   << 10
1558
-                    | (int) !$this->phpSheet->getProtection()->getSort()                << 11
1559
-                    | (int) !$this->phpSheet->getProtection()->getAutoFilter()          << 12
1560
-                    | (int) !$this->phpSheet->getProtection()->getPivotTables()         << 13
1561
-                    | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14 ;
1547
+        $options = (int) !$this->phpSheet->getProtection()->getObjects()
1548
+                    | (int) !$this->phpSheet->getProtection()->getScenarios() << 1
1549
+                    | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2
1550
+                    | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3
1551
+                    | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4
1552
+                    | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5
1553
+                    | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6
1554
+                    | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7
1555
+                    | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8
1556
+                    | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9
1557
+                    | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10
1558
+                    | (int) !$this->phpSheet->getProtection()->getSort() << 11
1559
+                    | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12
1560
+                    | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13
1561
+                    | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14;
1562 1562
 
1563 1563
         // record data
1564 1564
         $recordData = pack(
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 
1622 1622
             $length = strlen($recordData);
1623 1623
 
1624
-            $record = 0x0868;        // Record identifier
1624
+            $record = 0x0868; // Record identifier
1625 1625
             $header = pack("vv", $record, $length);
1626 1626
             $this->append($header . $recordData);
1627 1627
         }
@@ -1641,8 +1641,8 @@  discard block
 block discarded – undo
1641 1641
      */
1642 1642
     private function writeExterncount($count)
1643 1643
     {
1644
-        $record = 0x0016;          // Record identifier
1645
-        $length = 0x0002;          // Number of bytes to follow
1644
+        $record = 0x0016; // Record identifier
1645
+        $length = 0x0002; // Number of bytes to follow
1646 1646
 
1647 1647
         $header = pack("vv", $record, $length);
1648 1648
         $data   = pack("v", $count);
@@ -1659,20 +1659,20 @@  discard block
 block discarded – undo
1659 1659
      */
1660 1660
     private function writeExternsheet($sheetname)
1661 1661
     {
1662
-        $record    = 0x0017;         // Record identifier
1662
+        $record = 0x0017; // Record identifier
1663 1663
 
1664 1664
         // References to the current sheet are encoded differently to references to
1665 1665
         // external sheets.
1666 1666
         //
1667 1667
         if ($this->phpSheet->getTitle() == $sheetname) {
1668 1668
             $sheetname = '';
1669
-            $length    = 0x02;  // The following 2 bytes
1670
-            $cch       = 1;     // The following byte
1671
-            $rgch      = 0x02;  // Self reference
1669
+            $length    = 0x02; // The following 2 bytes
1670
+            $cch       = 1; // The following byte
1671
+            $rgch      = 0x02; // Self reference
1672 1672
         } else {
1673 1673
             $length    = 0x02 + strlen($sheetname);
1674 1674
             $cch       = strlen($sheetname);
1675
-            $rgch      = 0x03;  // Reference to a sheet in the current workbook
1675
+            $rgch      = 0x03; // Reference to a sheet in the current workbook
1676 1676
         }
1677 1677
 
1678 1678
         $header = pack("vv", $record, $length);
@@ -1707,8 +1707,8 @@  discard block
 block discarded – undo
1707 1707
         } else {
1708 1708
             $pnnAct = null;
1709 1709
         }
1710
-        $record  = 0x0041;       // Record identifier
1711
-        $length  = 0x000A;       // Number of bytes to follow
1710
+        $record  = 0x0041; // Record identifier
1711
+        $length  = 0x000A; // Number of bytes to follow
1712 1712
 
1713 1713
         // Code specific to frozen or thawed panes.
1714 1714
         if ($this->phpSheet->getFreezePane()) {
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
             // The default column width is 8.43
1734 1734
             // The following slope and intersection values were interpolated.
1735 1735
             //
1736
-            $y = 20*$y + 255;
1737
-            $x = 113.879*$x + 390;
1736
+            $y = 20 * $y + 255;
1737
+            $x = 113.879 * $x + 390;
1738 1738
         }
1739 1739
 
1740 1740
 
@@ -1768,47 +1768,47 @@  discard block
 block discarded – undo
1768 1768
      */
1769 1769
     private function writeSetup()
1770 1770
     {
1771
-        $record       = 0x00A1;                  // Record identifier
1772
-        $length       = 0x0022;                  // Number of bytes to follow
1771
+        $record       = 0x00A1; // Record identifier
1772
+        $length       = 0x0022; // Number of bytes to follow
1773 1773
 
1774
-        $iPaperSize   = $this->phpSheet->getPageSetup()->getPaperSize();    // Paper size
1774
+        $iPaperSize   = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size
1775 1775
 
1776 1776
         $iScale = $this->phpSheet->getPageSetup()->getScale() ?
1777
-            $this->phpSheet->getPageSetup()->getScale() : 100;   // Print scaling factor
1777
+            $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor
1778 1778
 
1779
-        $iPageStart   = 0x01;                 // Starting page number
1780
-        $iFitWidth    = (int) $this->phpSheet->getPageSetup()->getFitToWidth();    // Fit to number of pages wide
1781
-        $iFitHeight    = (int) $this->phpSheet->getPageSetup()->getFitToHeight();    // Fit to number of pages high
1782
-        $grbit        = 0x00;                 // Option flags
1783
-        $iRes         = 0x0258;               // Print resolution
1784
-        $iVRes        = 0x0258;               // Vertical print resolution
1779
+        $iPageStart   = 0x01; // Starting page number
1780
+        $iFitWidth    = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
1781
+        $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
1782
+        $grbit        = 0x00; // Option flags
1783
+        $iRes         = 0x0258; // Print resolution
1784
+        $iVRes        = 0x0258; // Vertical print resolution
1785 1785
 
1786
-        $numHdr       = $this->phpSheet->getPageMargins()->getHeader();  // Header Margin
1786
+        $numHdr       = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin
1787 1787
 
1788
-        $numFtr       = $this->phpSheet->getPageMargins()->getFooter();   // Footer Margin
1789
-        $iCopies      = 0x01;                 // Number of copies
1788
+        $numFtr       = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin
1789
+        $iCopies      = 0x01; // Number of copies
1790 1790
 
1791
-        $fLeftToRight = 0x0;                     // Print over then down
1791
+        $fLeftToRight = 0x0; // Print over then down
1792 1792
 
1793 1793
         // Page orientation
1794 1794
         $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ?
1795 1795
             0x0 : 0x1;
1796 1796
 
1797
-        $fNoPls       = 0x0;                     // Setup not read from printer
1798
-        $fNoColor     = 0x0;                     // Print black and white
1799
-        $fDraft       = 0x0;                     // Print draft quality
1800
-        $fNotes       = 0x0;                     // Print notes
1801
-        $fNoOrient    = 0x0;                     // Orientation not set
1802
-        $fUsePage     = 0x0;                     // Use custom starting page
1797
+        $fNoPls       = 0x0; // Setup not read from printer
1798
+        $fNoColor     = 0x0; // Print black and white
1799
+        $fDraft       = 0x0; // Print draft quality
1800
+        $fNotes       = 0x0; // Print notes
1801
+        $fNoOrient    = 0x0; // Orientation not set
1802
+        $fUsePage     = 0x0; // Use custom starting page
1803 1803
 
1804 1804
         $grbit           = $fLeftToRight;
1805
-        $grbit          |= $fLandscape    << 1;
1806
-        $grbit          |= $fNoPls        << 2;
1807
-        $grbit          |= $fNoColor      << 3;
1808
-        $grbit          |= $fDraft        << 4;
1809
-        $grbit          |= $fNotes        << 5;
1810
-        $grbit          |= $fNoOrient     << 6;
1811
-        $grbit          |= $fUsePage      << 7;
1805
+        $grbit          |= $fLandscape << 1;
1806
+        $grbit          |= $fNoPls << 2;
1807
+        $grbit          |= $fNoColor << 3;
1808
+        $grbit          |= $fDraft << 4;
1809
+        $grbit          |= $fNotes << 5;
1810
+        $grbit          |= $fNoOrient << 6;
1811
+        $grbit          |= $fUsePage << 7;
1812 1812
 
1813 1813
         $numHdr = pack("d", $numHdr);
1814 1814
         $numFtr = pack("d", $numFtr);
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 
1820 1820
         $header = pack("vv", $record, $length);
1821 1821
         $data1  = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
1822
-        $data2  = $numHdr.$numFtr;
1822
+        $data2  = $numHdr . $numFtr;
1823 1823
         $data3  = pack("v", $iCopies);
1824 1824
         $this->append($header . $data1 . $data2 . $data3);
1825 1825
     }
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
      */
1830 1830
     private function writeHeader()
1831 1831
     {
1832
-        $record  = 0x0014;               // Record identifier
1832
+        $record = 0x0014; // Record identifier
1833 1833
 
1834 1834
         /* removing for now
1835 1835
         // need to fix character count (multibyte!)
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
         $recordData = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
1844 1844
         $length = strlen($recordData);
1845 1845
 
1846
-        $header   = pack("vv", $record, $length);
1846
+        $header = pack("vv", $record, $length);
1847 1847
 
1848 1848
         $this->append($header . $recordData);
1849 1849
     }
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
      */
1854 1854
     private function writeFooter()
1855 1855
     {
1856
-        $record  = 0x0015;               // Record identifier
1856
+        $record = 0x0015; // Record identifier
1857 1857
 
1858 1858
         /* removing for now
1859 1859
         // need to fix character count (multibyte!)
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
         $recordData = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
1868 1868
         $length = strlen($recordData);
1869 1869
 
1870
-        $header    = pack("vv", $record, $length);
1870
+        $header = pack("vv", $record, $length);
1871 1871
 
1872 1872
         $this->append($header . $recordData);
1873 1873
     }
@@ -1879,15 +1879,15 @@  discard block
 block discarded – undo
1879 1879
      */
1880 1880
     private function writeHcenter()
1881 1881
     {
1882
-        $record   = 0x0083;              // Record identifier
1883
-        $length   = 0x0002;              // Bytes to follow
1882
+        $record   = 0x0083; // Record identifier
1883
+        $length   = 0x0002; // Bytes to follow
1884 1884
 
1885
-        $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0;     // Horizontal centering
1885
+        $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
1886 1886
 
1887 1887
         $header    = pack("vv", $record, $length);
1888 1888
         $data      = pack("v", $fHCenter);
1889 1889
 
1890
-        $this->append($header.$data);
1890
+        $this->append($header . $data);
1891 1891
     }
1892 1892
 
1893 1893
     /**
@@ -1895,10 +1895,10 @@  discard block
 block discarded – undo
1895 1895
      */
1896 1896
     private function writeVcenter()
1897 1897
     {
1898
-        $record   = 0x0084;              // Record identifier
1899
-        $length   = 0x0002;              // Bytes to follow
1898
+        $record   = 0x0084; // Record identifier
1899
+        $length   = 0x0002; // Bytes to follow
1900 1900
 
1901
-        $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0;     // Horizontal centering
1901
+        $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
1902 1902
 
1903 1903
         $header    = pack("vv", $record, $length);
1904 1904
         $data      = pack("v", $fVCenter);
@@ -1910,10 +1910,10 @@  discard block
 block discarded – undo
1910 1910
      */
1911 1911
     private function writeMarginLeft()
1912 1912
     {
1913
-        $record  = 0x0026;                   // Record identifier
1914
-        $length  = 0x0008;                   // Bytes to follow
1913
+        $record  = 0x0026; // Record identifier
1914
+        $length  = 0x0008; // Bytes to follow
1915 1915
 
1916
-        $margin  = $this->phpSheet->getPageMargins()->getLeft();     // Margin in inches
1916
+        $margin  = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches
1917 1917
 
1918 1918
         $header    = pack("vv", $record, $length);
1919 1919
         $data      = pack("d", $margin);
@@ -1929,10 +1929,10 @@  discard block
 block discarded – undo
1929 1929
      */
1930 1930
     private function writeMarginRight()
1931 1931
     {
1932
-        $record  = 0x0027;                   // Record identifier
1933
-        $length  = 0x0008;                   // Bytes to follow
1932
+        $record  = 0x0027; // Record identifier
1933
+        $length  = 0x0008; // Bytes to follow
1934 1934
 
1935
-        $margin  = $this->phpSheet->getPageMargins()->getRight();     // Margin in inches
1935
+        $margin  = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches
1936 1936
 
1937 1937
         $header    = pack("vv", $record, $length);
1938 1938
         $data      = pack("d", $margin);
@@ -1948,10 +1948,10 @@  discard block
 block discarded – undo
1948 1948
      */
1949 1949
     private function writeMarginTop()
1950 1950
     {
1951
-        $record  = 0x0028;                   // Record identifier
1952
-        $length  = 0x0008;                   // Bytes to follow
1951
+        $record  = 0x0028; // Record identifier
1952
+        $length  = 0x0008; // Bytes to follow
1953 1953
 
1954
-        $margin  = $this->phpSheet->getPageMargins()->getTop();     // Margin in inches
1954
+        $margin  = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches
1955 1955
 
1956 1956
         $header    = pack("vv", $record, $length);
1957 1957
         $data      = pack("d", $margin);
@@ -1967,10 +1967,10 @@  discard block
 block discarded – undo
1967 1967
      */
1968 1968
     private function writeMarginBottom()
1969 1969
     {
1970
-        $record  = 0x0029;                   // Record identifier
1971
-        $length  = 0x0008;                   // Bytes to follow
1970
+        $record  = 0x0029; // Record identifier
1971
+        $length  = 0x0008; // Bytes to follow
1972 1972
 
1973
-        $margin  = $this->phpSheet->getPageMargins()->getBottom();     // Margin in inches
1973
+        $margin  = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches
1974 1974
 
1975 1975
         $header    = pack("vv", $record, $length);
1976 1976
         $data      = pack("d", $margin);
@@ -1986,10 +1986,10 @@  discard block
 block discarded – undo
1986 1986
      */
1987 1987
     private function writePrintHeaders()
1988 1988
     {
1989
-        $record      = 0x002a;                   // Record identifier
1990
-        $length      = 0x0002;                   // Bytes to follow
1989
+        $record      = 0x002a; // Record identifier
1990
+        $length      = 0x0002; // Bytes to follow
1991 1991
 
1992
-        $fPrintRwCol = $this->_print_headers;     // Boolean flag
1992
+        $fPrintRwCol = $this->_print_headers; // Boolean flag
1993 1993
 
1994 1994
         $header      = pack("vv", $record, $length);
1995 1995
         $data        = pack("v", $fPrintRwCol);
@@ -2002,13 +2002,13 @@  discard block
 block discarded – undo
2002 2002
      */
2003 2003
     private function writePrintGridlines()
2004 2004
     {
2005
-        $record      = 0x002b;                    // Record identifier
2006
-        $length      = 0x0002;                    // Bytes to follow
2005
+        $record      = 0x002b; // Record identifier
2006
+        $length      = 0x0002; // Bytes to follow
2007 2007
 
2008
-        $fPrintGrid  = $this->phpSheet->getPrintGridlines() ? 1 : 0;    // Boolean flag
2008
+        $fPrintGrid  = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
2009 2009
 
2010 2010
         $header      = pack("vv", $record, $length);
2011
-        $data      = pack("v", $fPrintGrid);
2011
+        $data = pack("v", $fPrintGrid);
2012 2012
         $this->append($header . $data);
2013 2013
     }
2014 2014
 
@@ -2018,10 +2018,10 @@  discard block
 block discarded – undo
2018 2018
      */
2019 2019
     private function writeGridset()
2020 2020
     {
2021
-        $record      = 0x0082;                        // Record identifier
2022
-        $length      = 0x0002;                        // Bytes to follow
2021
+        $record      = 0x0082; // Record identifier
2022
+        $length      = 0x0002; // Bytes to follow
2023 2023
 
2024
-        $fGridSet    = !$this->phpSheet->getPrintGridlines();     // Boolean flag
2024
+        $fGridSet    = !$this->phpSheet->getPrintGridlines(); // Boolean flag
2025 2025
 
2026 2026
         $header      = pack("vv", $record, $length);
2027 2027
         $data        = pack("v", $fGridSet);
@@ -2033,8 +2033,8 @@  discard block
 block discarded – undo
2033 2033
      */
2034 2034
     private function writeAutoFilterInfo()
2035 2035
     {
2036
-        $record      = 0x009D;                        // Record identifier
2037
-        $length      = 0x0002;                        // Bytes to follow
2036
+        $record      = 0x009D; // Record identifier
2037
+        $length      = 0x0002; // Bytes to follow
2038 2038
 
2039 2039
         $rangeBounds = \PHPExcel\Cell::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange());
2040 2040
         $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0];
@@ -2053,11 +2053,11 @@  discard block
 block discarded – undo
2053 2053
      */
2054 2054
     private function writeGuts()
2055 2055
     {
2056
-        $record      = 0x0080;   // Record identifier
2057
-        $length      = 0x0008;   // Bytes to follow
2056
+        $record      = 0x0080; // Record identifier
2057
+        $length      = 0x0008; // Bytes to follow
2058 2058
 
2059
-        $dxRwGut     = 0x0000;   // Size of row gutter
2060
-        $dxColGut    = 0x0000;   // Size of col gutter
2059
+        $dxRwGut     = 0x0000; // Size of row gutter
2060
+        $dxColGut    = 0x0000; // Size of col gutter
2061 2061
 
2062 2062
         // determine maximum row outline level
2063 2063
         $maxRowOutlineLevel = 0;
@@ -2065,7 +2065,7 @@  discard block
 block discarded – undo
2065 2065
             $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel());
2066 2066
         }
2067 2067
 
2068
-        $col_level   = 0;
2068
+        $col_level = 0;
2069 2069
 
2070 2070
         // Calculate the maximum column outline level. The equivalent calculation
2071 2071
         // for the row outline level is carried out in writeRow().
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
         $header      = pack("vv", $record, $length);
2089 2089
         $data        = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level);
2090 2090
 
2091
-        $this->append($header.$data);
2091
+        $this->append($header . $data);
2092 2092
     }
2093 2093
 
2094 2094
     /**
@@ -2097,15 +2097,15 @@  discard block
 block discarded – undo
2097 2097
      */
2098 2098
     private function writeWsbool()
2099 2099
     {
2100
-        $record      = 0x0081;   // Record identifier
2101
-        $length      = 0x0002;   // Bytes to follow
2100
+        $record      = 0x0081; // Record identifier
2101
+        $length      = 0x0002; // Bytes to follow
2102 2102
         $grbit       = 0x0000;
2103 2103
 
2104 2104
         // The only option that is of interest is the flag for fit to page. So we
2105 2105
         // set all the options in one go.
2106 2106
         //
2107 2107
         // Set the option flags
2108
-        $grbit |= 0x0001;                           // Auto page breaks visible
2108
+        $grbit |= 0x0001; // Auto page breaks visible
2109 2109
         if ($this->outlineStyle) {
2110 2110
             $grbit |= 0x0020; // Auto outline styles
2111 2111
         }
@@ -2165,9 +2165,9 @@  discard block
 block discarded – undo
2165 2165
                 array_shift($hbreaks);
2166 2166
             }
2167 2167
 
2168
-            $record  = 0x001b;               // Record identifier
2169
-            $cbrk    = count($hbreaks);       // Number of page breaks
2170
-            $length  = 2 + 6 * $cbrk;      // Bytes to follow
2168
+            $record  = 0x001b; // Record identifier
2169
+            $cbrk    = count($hbreaks); // Number of page breaks
2170
+            $length  = 2 + 6 * $cbrk; // Bytes to follow
2171 2171
 
2172 2172
             $header  = pack("vv", $record, $length);
2173 2173
             $data    = pack("v", $cbrk);
@@ -2192,9 +2192,9 @@  discard block
 block discarded – undo
2192 2192
                 array_shift($vbreaks);
2193 2193
             }
2194 2194
 
2195
-            $record  = 0x001a;               // Record identifier
2196
-            $cbrk    = count($vbreaks);       // Number of page breaks
2197
-            $length  = 2 + 6 * $cbrk;      // Bytes to follow
2195
+            $record  = 0x001a; // Record identifier
2196
+            $cbrk    = count($vbreaks); // Number of page breaks
2197
+            $length  = 2 + 6 * $cbrk; // Bytes to follow
2198 2198
 
2199 2199
             $header  = pack("vv", $record, $length);
2200 2200
             $data    = pack("v", $cbrk);
@@ -2218,15 +2218,15 @@  discard block
 block discarded – undo
2218 2218
             return;
2219 2219
         }
2220 2220
 
2221
-        $record      = 0x0012;             // Record identifier
2222
-        $length      = 0x0002;             // Bytes to follow
2221
+        $record      = 0x0012; // Record identifier
2222
+        $length      = 0x0002; // Bytes to follow
2223 2223
 
2224
-        $fLock      = 1;    // Worksheet is protected
2224
+        $fLock = 1; // Worksheet is protected
2225 2225
 
2226
-        $header      = pack("vv", $record, $length);
2227
-        $data      = pack("v", $fLock);
2226
+        $header = pack("vv", $record, $length);
2227
+        $data = pack("v", $fLock);
2228 2228
 
2229
-        $this->append($header.$data);
2229
+        $this->append($header . $data);
2230 2230
     }
2231 2231
 
2232 2232
     /**
@@ -2287,10 +2287,10 @@  discard block
 block discarded – undo
2287 2287
             return;
2288 2288
         }
2289 2289
 
2290
-        $record      = 0x0013;               // Record identifier
2291
-        $length      = 0x0002;               // Bytes to follow
2290
+        $record      = 0x0013; // Record identifier
2291
+        $length      = 0x0002; // Bytes to follow
2292 2292
 
2293
-        $wPassword   = hexdec($this->phpSheet->getProtection()->getPassword());     // Encoded password
2293
+        $wPassword   = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password
2294 2294
 
2295 2295
         $header      = pack("vv", $record, $length);
2296 2296
         $data        = pack("v", $wPassword);
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
         $lcb         = $size;
2331 2331
 
2332 2332
         $header      = pack("vvvvV", $record, $length, $cf, $env, $lcb);
2333
-        $this->append($header.$data);
2333
+        $this->append($header . $data);
2334 2334
     }
2335 2335
 
2336 2336
     /**
@@ -2387,8 +2387,8 @@  discard block
 block discarded – undo
2387 2387
     public function positionImage($col_start, $row_start, $x1, $y1, $width, $height)
2388 2388
     {
2389 2389
         // Initialise end cell to the same as the start cell
2390
-        $col_end    = $col_start;  // Col containing lower right corner of object
2391
-        $row_end    = $row_start;  // Row containing bottom right corner of object
2390
+        $col_end    = $col_start; // Col containing lower right corner of object
2391
+        $row_end    = $row_start; // Row containing bottom right corner of object
2392 2392
 
2393 2393
         // Zero the specified offset if greater than the cell dimensions
2394 2394
         if ($x1 >= \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_start))) {
@@ -2398,8 +2398,8 @@  discard block
 block discarded – undo
2398 2398
             $y1 = 0;
2399 2399
         }
2400 2400
 
2401
-        $width      = $width  + $x1 -1;
2402
-        $height     = $height + $y1 -1;
2401
+        $width      = $width + $x1 - 1;
2402
+        $height     = $height + $y1 - 1;
2403 2403
 
2404 2404
         // Subtract the underlying cell widths to find the end cell of the image
2405 2405
         while ($width >= \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_end))) {
@@ -2419,21 +2419,21 @@  discard block
 block discarded – undo
2419 2419
         if (\PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_start)) == 0) {
2420 2420
             return;
2421 2421
         }
2422
-        if (\PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_end))   == 0) {
2422
+        if (\PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_end)) == 0) {
2423 2423
             return;
2424 2424
         }
2425 2425
         if (\PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) == 0) {
2426 2426
             return;
2427 2427
         }
2428
-        if (\PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1)   == 0) {
2428
+        if (\PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) {
2429 2429
             return;
2430 2430
         }
2431 2431
 
2432 2432
         // Convert the pixel values to the percentage value expected by Excel
2433
-        $x1 = $x1     / \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_start))   * 1024;
2434
-        $y1 = $y1     / \PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1)   *  256;
2435
-        $x2 = $width  / \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_end))     * 1024; // Distance to right side of object
2436
-        $y2 = $height / \PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1)     *  256; // Distance to bottom of object
2433
+        $x1 = $x1 / \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_start)) * 1024;
2434
+        $y1 = $y1 / \PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256;
2435
+        $x2 = $width / \PHPExcel\Shared\Excel5::sizeCol($this->phpSheet, \PHPExcel\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
2436
+        $y2 = $height / \PHPExcel\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object
2437 2437
 
2438 2438
         $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2);
2439 2439
     }
@@ -2453,33 +2453,33 @@  discard block
 block discarded – undo
2453 2453
      */
2454 2454
     private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB)
2455 2455
     {
2456
-        $record      = 0x005d;   // Record identifier
2457
-        $length      = 0x003c;   // Bytes to follow
2458
-
2459
-        $cObj        = 0x0001;   // Count of objects in file (set to 1)
2460
-        $OT          = 0x0008;   // Object type. 8 = Picture
2461
-        $id          = 0x0001;   // Object ID
2462
-        $grbit       = 0x0614;   // Option flags
2463
-
2464
-        $cbMacro     = 0x0000;   // Length of FMLA structure
2465
-        $Reserved1   = 0x0000;   // Reserved
2466
-        $Reserved2   = 0x0000;   // Reserved
2467
-
2468
-        $icvBack     = 0x09;     // Background colour
2469
-        $icvFore     = 0x09;     // Foreground colour
2470
-        $fls         = 0x00;     // Fill pattern
2471
-        $fAuto       = 0x00;     // Automatic fill
2472
-        $icv         = 0x08;     // Line colour
2473
-        $lns         = 0xff;     // Line style
2474
-        $lnw         = 0x01;     // Line weight
2475
-        $fAutoB      = 0x00;     // Automatic border
2476
-        $frs         = 0x0000;   // Frame style
2477
-        $cf          = 0x0009;   // Image format, 9 = bitmap
2478
-        $Reserved3   = 0x0000;   // Reserved
2479
-        $cbPictFmla  = 0x0000;   // Length of FMLA structure
2480
-        $Reserved4   = 0x0000;   // Reserved
2481
-        $grbit2      = 0x0001;   // Option flags
2482
-        $Reserved5   = 0x0000;   // Reserved
2456
+        $record      = 0x005d; // Record identifier
2457
+        $length      = 0x003c; // Bytes to follow
2458
+
2459
+        $cObj        = 0x0001; // Count of objects in file (set to 1)
2460
+        $OT          = 0x0008; // Object type. 8 = Picture
2461
+        $id          = 0x0001; // Object ID
2462
+        $grbit       = 0x0614; // Option flags
2463
+
2464
+        $cbMacro     = 0x0000; // Length of FMLA structure
2465
+        $Reserved1   = 0x0000; // Reserved
2466
+        $Reserved2   = 0x0000; // Reserved
2467
+
2468
+        $icvBack     = 0x09; // Background colour
2469
+        $icvFore     = 0x09; // Foreground colour
2470
+        $fls         = 0x00; // Fill pattern
2471
+        $fAuto       = 0x00; // Automatic fill
2472
+        $icv         = 0x08; // Line colour
2473
+        $lns         = 0xff; // Line style
2474
+        $lnw         = 0x01; // Line weight
2475
+        $fAutoB      = 0x00; // Automatic border
2476
+        $frs         = 0x0000; // Frame style
2477
+        $cf          = 0x0009; // Image format, 9 = bitmap
2478
+        $Reserved3   = 0x0000; // Reserved
2479
+        $cbPictFmla  = 0x0000; // Length of FMLA structure
2480
+        $Reserved4   = 0x0000; // Reserved
2481
+        $grbit2      = 0x0001; // Option flags
2482
+        $Reserved5   = 0x0000; // Reserved
2483 2483
 
2484 2484
 
2485 2485
         $header      = pack("vv", $record, $length);
@@ -2530,16 +2530,16 @@  discard block
 block discarded – undo
2530 2530
         $height = imagesy($image);
2531 2531
 
2532 2532
         $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
2533
-        for ($j=$height; $j--;) {
2534
-            for ($i=0; $i < $width; ++$i) {
2533
+        for ($j = $height; $j--;) {
2534
+            for ($i = 0; $i < $width; ++$i) {
2535 2535
                 $color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
2536 2536
                 foreach (array("red", "green", "blue") as $key) {
2537 2537
                     $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127);
2538 2538
                 }
2539 2539
                 $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
2540 2540
             }
2541
-            if (3*$width % 4) {
2542
-                $data .= str_repeat("\x00", 4 - 3*$width % 4);
2541
+            if (3 * $width % 4) {
2542
+                $data .= str_repeat("\x00", 4 - 3 * $width % 4);
2543 2543
             }
2544 2544
         }
2545 2545
 
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
         // Read and remove the bitmap size. This is more reliable than reading
2584 2584
         // the data size at offset 0x22.
2585 2585
         //
2586
-        $size_array   = unpack("Vsa", substr($data, 0, 4));
2586
+        $size_array = unpack("Vsa", substr($data, 0, 4));
2587 2587
         $size   = $size_array['sa'];
2588 2588
         $data   = substr($data, 4);
2589 2589
         $size  -= 0x36; // Subtract size of bitmap header.
@@ -2644,8 +2644,8 @@  discard block
 block discarded – undo
2644 2644
             return;
2645 2645
         }
2646 2646
 
2647
-        $record      = 0x00A0;               // Record identifier
2648
-        $length      = 0x0004;               // Bytes to follow
2647
+        $record      = 0x00A0; // Record identifier
2648
+        $length      = 0x0004; // Bytes to follow
2649 2649
 
2650 2650
         $header      = pack("vv", $record, $length);
2651 2651
         $data        = pack("vv", $this->phpSheet->getSheetView()->getZoomScale(), 100);
@@ -2690,10 +2690,10 @@  discard block
 block discarded – undo
2690 2690
             $nm = count($spOffsets) - 1; // number of shapes excluding first shape
2691 2691
             for ($i = 1; $i <= $nm; ++$i) {
2692 2692
                 // MSODRAWING record
2693
-                $record = 0x00EC;            // Record identifier
2693
+                $record = 0x00EC; // Record identifier
2694 2694
 
2695 2695
                 // chunk of Escher stream for one shape
2696
-                $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]);
2696
+                $dataChunk = substr($data, $spOffsets[$i - 1], $spOffsets[$i] - $spOffsets[$i - 1]);
2697 2697
 
2698 2698
                 $length = strlen($dataChunk);
2699 2699
                 $header = pack("vv", $record, $length);
@@ -2768,20 +2768,20 @@  discard block
 block discarded – undo
2768 2768
         // Write data validations?
2769 2769
         if (!empty($dataValidationCollection)) {
2770 2770
             // DATAVALIDATIONS record
2771
-            $record = 0x01B2;      // Record identifier
2772
-            $length = 0x0012;      // Bytes to follow
2771
+            $record = 0x01B2; // Record identifier
2772
+            $length = 0x0012; // Bytes to follow
2773 2773
 
2774
-            $grbit  = 0x0000;       // Prompt box at cell, no cached validity data at DV records
2775
-            $horPos = 0x00000000;  // Horizontal position of prompt box, if fixed position
2776
-            $verPos = 0x00000000;  // Vertical position of prompt box, if fixed position
2777
-            $objId  = 0xFFFFFFFF;  // Object identifier of drop down arrow object, or -1 if not visible
2774
+            $grbit  = 0x0000; // Prompt box at cell, no cached validity data at DV records
2775
+            $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
2776
+            $verPos = 0x00000000; // Vertical position of prompt box, if fixed position
2777
+            $objId  = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
2778 2778
 
2779 2779
             $header = pack('vv', $record, $length);
2780 2780
             $data   = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection));
2781
-            $this->append($header.$data);
2781
+            $this->append($header . $data);
2782 2782
 
2783 2783
             // DATAVALIDATION records
2784
-            $record = 0x01BE;              // Record identifier
2784
+            $record = 0x01BE; // Record identifier
2785 2785
 
2786 2786
             foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) {
2787 2787
                 // initialize record data
@@ -2981,8 +2981,8 @@  discard block
 block discarded – undo
2981 2981
      */
2982 2982
     private function writePageLayoutView()
2983 2983
     {
2984
-        $record      = 0x088B;               // Record identifier
2985
-        $length      = 0x0010;               // Bytes to follow
2984
+        $record      = 0x088B; // Record identifier
2985
+        $length      = 0x0010; // Bytes to follow
2986 2986
 
2987 2987
         $rt         = 0x088B; // 2
2988 2988
         $grbitFrt   = 0x0000; // 2
@@ -2998,12 +2998,12 @@  discard block
 block discarded – undo
2998 2998
         $fRulerVisible     = 0;
2999 2999
         $fWhitespaceHidden = 0;
3000 3000
 
3001
-        $grbit      = $fPageLayoutView; // 2
3002
-        $grbit        |= $fRulerVisible       << 1;
3003
-        $grbit        |= $fWhitespaceHidden  << 3;
3001
+        $grbit = $fPageLayoutView; // 2
3002
+        $grbit        |= $fRulerVisible << 1;
3003
+        $grbit        |= $fWhitespaceHidden << 3;
3004 3004
 
3005
-        $header      = pack("vv", $record, $length);
3006
-        $data      = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit);
3005
+        $header = pack("vv", $record, $length);
3006
+        $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit);
3007 3007
         $this->append($header . $data);
3008 3008
     }
3009 3009
 
@@ -3013,7 +3013,7 @@  discard block
 block discarded – undo
3013 3013
      */
3014 3014
     private function writeCFRule(\PHPExcel\Style\Conditional $conditional)
3015 3015
     {
3016
-        $record      = 0x01B1;               // Record identifier
3016
+        $record = 0x01B1; // Record identifier
3017 3017
 
3018 3018
         // $type : Type of the CF
3019 3019
         // $operatorType : Comparison operator
@@ -3133,49 +3133,49 @@  discard block
 block discarded – undo
3133 3133
         }
3134 3134
         // Alignment
3135 3135
         $flags = 0;
3136
-        $flags |= (1 == $bAlignHz      ? 0x00000001 : 0);
3137
-        $flags |= (1 == $bAlignVt      ? 0x00000002 : 0);
3138
-        $flags |= (1 == $bAlignWrapTx  ? 0x00000004 : 0);
3139
-        $flags |= (1 == $bTxRotation   ? 0x00000008 : 0);
3136
+        $flags |= (1 == $bAlignHz ? 0x00000001 : 0);
3137
+        $flags |= (1 == $bAlignVt ? 0x00000002 : 0);
3138
+        $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0);
3139
+        $flags |= (1 == $bTxRotation ? 0x00000008 : 0);
3140 3140
         // Justify last line flag
3141
-        $flags |= (1 == 1              ? 0x00000010 : 0);
3142
-        $flags |= (1 == $bIndent       ? 0x00000020 : 0);
3143
-        $flags |= (1 == $bShrinkToFit  ? 0x00000040 : 0);
3141
+        $flags |= (1 == 1 ? 0x00000010 : 0);
3142
+        $flags |= (1 == $bIndent ? 0x00000020 : 0);
3143
+        $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0);
3144 3144
         // Default
3145
-        $flags |= (1 == 1              ? 0x00000080 : 0);
3145
+        $flags |= (1 == 1 ? 0x00000080 : 0);
3146 3146
         // Protection
3147
-        $flags |= (1 == $bProtLocked   ? 0x00000100 : 0);
3148
-        $flags |= (1 == $bProtHidden   ? 0x00000200 : 0);
3147
+        $flags |= (1 == $bProtLocked ? 0x00000100 : 0);
3148
+        $flags |= (1 == $bProtHidden ? 0x00000200 : 0);
3149 3149
         // Border
3150
-        $flags |= (1 == $bBorderLeft   ? 0x00000400 : 0);
3151
-        $flags |= (1 == $bBorderRight  ? 0x00000800 : 0);
3152
-        $flags |= (1 == $bBorderTop    ? 0x00001000 : 0);
3150
+        $flags |= (1 == $bBorderLeft ? 0x00000400 : 0);
3151
+        $flags |= (1 == $bBorderRight ? 0x00000800 : 0);
3152
+        $flags |= (1 == $bBorderTop ? 0x00001000 : 0);
3153 3153
         $flags |= (1 == $bBorderBottom ? 0x00002000 : 0);
3154
-        $flags |= (1 == 1              ? 0x00004000 : 0); // Top left to Bottom right border
3155
-        $flags |= (1 == 1              ? 0x00008000 : 0); // Bottom left to Top right border
3154
+        $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border
3155
+        $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border
3156 3156
         // Pattern
3157
-        $flags |= (1 == $bFillStyle    ? 0x00010000 : 0);
3158
-        $flags |= (1 == $bFillColor    ? 0x00020000 : 0);
3159
-        $flags |= (1 == $bFillColorBg  ? 0x00040000 : 0);
3160
-        $flags |= (1 == 1              ? 0x00380000 : 0);
3157
+        $flags |= (1 == $bFillStyle ? 0x00010000 : 0);
3158
+        $flags |= (1 == $bFillColor ? 0x00020000 : 0);
3159
+        $flags |= (1 == $bFillColorBg ? 0x00040000 : 0);
3160
+        $flags |= (1 == 1 ? 0x00380000 : 0);
3161 3161
         // Font
3162
-        $flags |= (1 == $bFormatFont   ? 0x04000000 : 0);
3162
+        $flags |= (1 == $bFormatFont ? 0x04000000 : 0);
3163 3163
         // Alignment:
3164
-        $flags |= (1 == $bFormatAlign  ? 0x08000000 : 0);
3164
+        $flags |= (1 == $bFormatAlign ? 0x08000000 : 0);
3165 3165
         // Border
3166 3166
         $flags |= (1 == $bFormatBorder ? 0x10000000 : 0);
3167 3167
         // Pattern
3168
-        $flags |= (1 == $bFormatFill   ? 0x20000000 : 0);
3168
+        $flags |= (1 == $bFormatFill ? 0x20000000 : 0);
3169 3169
         // Protection
3170
-        $flags |= (1 == $bFormatProt   ? 0x40000000 : 0);
3170
+        $flags |= (1 == $bFormatProt ? 0x40000000 : 0);
3171 3171
         // Text direction
3172
-        $flags |= (1 == 0              ? 0x80000000 : 0);
3172
+        $flags |= (1 == 0 ? 0x80000000 : 0);
3173 3173
 
3174 3174
         // Data Blocks
3175 3175
         if ($bFormatFont == 1) {
3176 3176
             // Font Name
3177 3177
             if ($conditional->getStyle()->getFont()->getName() == null) {
3178
-                $dataBlockFont =  pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
3178
+                $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
3179 3179
                 $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
3180 3180
             } else {
3181 3181
                 $dataBlockFont = \PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
@@ -3414,11 +3414,11 @@  discard block
 block discarded – undo
3414 3414
             // Options flags for modified font attributes
3415 3415
             $optionsFlags = 0;
3416 3416
             $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0);
3417
-            $optionsFlags |= (1 == $optionsFlagsBold  ? 0x00000002 : 0);
3418
-            $optionsFlags |= (1 == 1                  ? 0x00000008 : 0);
3419
-            $optionsFlags |= (1 == 1                  ? 0x00000010 : 0);
3420
-            $optionsFlags |= (1 == 0                  ? 0x00000020 : 0);
3421
-            $optionsFlags |= (1 == 1                  ? 0x00000080 : 0);
3417
+            $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0);
3418
+            $optionsFlags |= (1 == 1 ? 0x00000008 : 0);
3419
+            $optionsFlags |= (1 == 1 ? 0x00000010 : 0);
3420
+            $optionsFlags |= (1 == 0 ? 0x00000020 : 0);
3421
+            $optionsFlags |= (1 == 1 ? 0x00000080 : 0);
3422 3422
             $dataBlockFont .= pack('V', $optionsFlags);
3423 3423
             // Escapement type
3424 3424
             $dataBlockFont .= pack('V', $fontEscapement);
@@ -3789,10 +3789,10 @@  discard block
 block discarded – undo
3789 3789
                     break;
3790 3790
                 case \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR:
3791 3791
                     $blockFillPatternStyle = 0x00;
3792
-                    break;    // does not exist in BIFF8
3792
+                    break; // does not exist in BIFF8
3793 3793
                 case \PHPExcel\Style\Fill::FILL_GRADIENT_PATH:
3794 3794
                     $blockFillPatternStyle = 0x00;
3795
-                    break;    // does not exist in BIFF8
3795
+                    break; // does not exist in BIFF8
3796 3796
                 default:
3797 3797
                     $blockFillPatternStyle = 0x00;
3798 3798
                     break;
@@ -4180,7 +4180,7 @@  discard block
 block discarded – undo
4180 4180
         if (!is_null($operand2)) {
4181 4181
             $data .= $operand2;
4182 4182
         }
4183
-        $header      = pack('vv', $record, strlen($data));
4183
+        $header = pack('vv', $record, strlen($data));
4184 4184
         $this->append($header . $data);
4185 4185
     }
4186 4186
 
@@ -4189,8 +4189,8 @@  discard block
 block discarded – undo
4189 4189
      */
4190 4190
     private function writeCFHeader()
4191 4191
     {
4192
-        $record      = 0x01B0;               // Record identifier
4193
-        $length      = 0x0016;               // Bytes to follow
4192
+        $record      = 0x01B0; // Record identifier
4193
+        $length      = 0x0016; // Bytes to follow
4194 4194
 
4195 4195
         $numColumnMin = null;
4196 4196
         $numColumnMax = null;
@@ -4225,9 +4225,9 @@  discard block
 block discarded – undo
4225 4225
             }
4226 4226
         }
4227 4227
         $needRedraw = 1;
4228
-        $cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1);
4228
+        $cellRange = pack('vvvv', $numRowMin - 1, $numRowMax - 1, $numColumnMin - 1, $numColumnMax - 1);
4229 4229
 
4230
-        $header      = pack('vv', $record, $length);
4230
+        $header = pack('vv', $record, $length);
4231 4231
         $data      = pack('vv', count($arrConditional), $needRedraw);
4232 4232
         $data     .= $cellRange;
4233 4233
         $data     .= pack('v', 0x0001);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel2007.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @var Excel2007\WriterPart[]
43 43
      */
44
-    private $writerParts    = array();
44
+    private $writerParts = array();
45 45
 
46 46
     /**
47 47
      * Private Spreadsheet
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @var string[]
57 57
      */
58
-    private $stringTable    = array();
58
+    private $stringTable = array();
59 59
 
60 60
     /**
61 61
      * Private unique \PHPExcel\Style\Conditional HashTable
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @var \PHPExcel\HashTable
92 92
      */
93
-    private $bordersHashTable ;
93
+    private $bordersHashTable;
94 94
 
95 95
     /**
96 96
      * Private unique \PHPExcel\Style\NumberFormat HashTable
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
             $this->writerParts[$writer] = new $class($this);
139 139
         }
140 140
 
141
-        $hashTablesArray = array( 'stylesConditionalHashTable',    'fillHashTable',        'fontHashTable',
142
-                                  'bordersHashTable',                'numFmtHashTable',        'drawingHashTable',
141
+        $hashTablesArray = array('stylesConditionalHashTable', 'fillHashTable', 'fontHashTable',
142
+                                  'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
143 143
                                   'styleHashTable'
144 144
                                 );
145 145
 
146 146
         // Set HashTable variables
147 147
         foreach ($hashTablesArray as $tableName) {
148
-            $this->$tableName     = new \PHPExcel\HashTable();
148
+            $this->$tableName = new \PHPExcel\HashTable();
149 149
         }
150 150
     }
151 151
 
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 
234 234
             //if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
235 235
             if ($this->spreadSheet->hasMacros()) {
236
-                $macrosCode=$this->spreadSheet->getMacrosCode();
236
+                $macrosCode = $this->spreadSheet->getMacrosCode();
237 237
                 if (!is_null($macrosCode)) {// we have the code ?
238
-                    $objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
238
+                    $objZip->addFromString('xl/vbaProject.bin', $macrosCode); //allways in 'xl', allways named vbaProject.bin
239 239
                     if ($this->spreadSheet->hasMacrosCertificate()) {//signed macros ?
240 240
                         // Yes : add the certificate file and the related rels file
241 241
                         $objZip->addFromString('xl/vbaProjectSignature.bin', $this->spreadSheet->getMacrosCertificate());
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
             }
246 246
             //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
247 247
             if ($this->spreadSheet->hasRibbon()) {
248
-                $tmpRibbonTarget=$this->spreadSheet->getRibbonXMLData('target');
248
+                $tmpRibbonTarget = $this->spreadSheet->getRibbonXMLData('target');
249 249
                 $objZip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data'));
250 250
                 if ($this->spreadSheet->hasRibbonBinObjects()) {
251
-                    $tmpRootPath=dirname($tmpRibbonTarget).'/';
252
-                    $ribbonBinObjects=$this->spreadSheet->getRibbonBinObjects('data');//the files to write
251
+                    $tmpRootPath = dirname($tmpRibbonTarget) . '/';
252
+                    $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write
253 253
                     foreach ($ribbonBinObjects as $aPath => $aContent) {
254
-                        $objZip->addFromString($tmpRootPath.$aPath, $aContent);
254
+                        $objZip->addFromString($tmpRootPath . $aPath, $aContent);
255 255
                     }
256 256
                     //the rels for files
257
-                    $objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet));
257
+                    $objZip->addFromString($tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet));
258 258
                 }
259 259
             }
260 260
 
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Writer/Excel5.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
                     ++$countShapes[$sheetIndex];
340 340
 
341 341
                     // create an Drawing Object for the dropdown
342
-                    $oDrawing  = new \PHPExcel\Worksheet\BaseDrawing();
342
+                    $oDrawing = new \PHPExcel\Worksheet\BaseDrawing();
343 343
                     // get the coordinates of drawing
344
-                    $cDrawing   = \PHPExcel\Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1];
344
+                    $cDrawing = \PHPExcel\Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1];
345 345
                     $oDrawing->setCoordinates($cDrawing);
346 346
                     $oDrawing->setWorksheet($sheet);
347 347
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
           $dataProp .= pack('v', 0x000A);
624 624
           $dataProp .= pack('v', 0x0000);
625 625
           // value
626
-          $dataProp .= 'Worksheet'.chr(0);
626
+          $dataProp .= 'Worksheet' . chr(0);
627 627
 
628 628
         $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
629 629
                                'offset' => array('pack' => 'V'),
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
                 $dataProp['data']['data'] .= chr(0);
698 698
                 $dataProp['data']['length'] += 1;
699 699
                 // Complete the string with null string for being a %4
700
-                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
700
+                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4));
701 701
                 $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
702 702
 
703 703
                 $dataSection_Content .= pack('V', $dataProp['data']['length']);
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 $dataProp['data']['data'] .= chr(0);
874 874
                 $dataProp['data']['length'] += 1;
875 875
                 // Complete the string with null string for being a %4
876
-                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
876
+                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4));
877 877
                 $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
878 878
 
879 879
                 $dataSection_Content .= pack('V', $dataProp['data']['length']);
Please login to merge, or discard this patch.