@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $fs = new Filesystem(); |
| 28 | 28 | if (!$fs->isAbsolutePath($config)) { |
| 29 | - $config = __DIR__ . '/config/' .$config; |
|
| 29 | + $config = __DIR__.'/config/'.$config; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (!file_exists($config)) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getCacheDir() |
| 66 | 66 | { |
| 67 | - return __DIR__ . '/../../tmp/cache'; |
|
| 67 | + return __DIR__.'/../../tmp/cache'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -72,6 +72,6 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getLogDir() |
| 74 | 74 | { |
| 75 | - return __DIR__ . '/../../tmp/logs'; |
|
| 75 | + return __DIR__.'/../../tmp/logs'; |
|
| 76 | 76 | } |
| 77 | 77 | } |
@@ -45,16 +45,16 @@ |
||
| 45 | 45 | $compiler->addDebugInfo($this) |
| 46 | 46 | ->write('$documentProperties = ') |
| 47 | 47 | ->subcompile($this->getNode('properties')) |
| 48 | - ->raw(';' . PHP_EOL) |
|
| 49 | - ->write('$context[\'phpExcel\'] = new MewesK\TwigExcelBundle\Wrapper\PhpExcelWrapper($context, $this->env);' . PHP_EOL) |
|
| 50 | - ->write('$context[\'phpExcel\']->startDocument($documentProperties);' . PHP_EOL) |
|
| 51 | - ->write('unset($documentProperties);' . PHP_EOL) |
|
| 48 | + ->raw(';'.PHP_EOL) |
|
| 49 | + ->write('$context[\'phpExcel\'] = new MewesK\TwigExcelBundle\Wrapper\PhpExcelWrapper($context, $this->env);'.PHP_EOL) |
|
| 50 | + ->write('$context[\'phpExcel\']->startDocument($documentProperties);'.PHP_EOL) |
|
| 51 | + ->write('unset($documentProperties);'.PHP_EOL) |
|
| 52 | 52 | ->subcompile($this->getNode('body')) |
| 53 | 53 | ->addDebugInfo($this) |
| 54 | - ->write('$context[\'phpExcel\']->endDocument(' . |
|
| 55 | - ($this->preCalculateFormulas ? 'true' : 'false') . ', ' . |
|
| 56 | - ($this->diskCachingDirectory ? '\'' . $this->diskCachingDirectory . '\'' : 'null') . ');' . PHP_EOL) |
|
| 57 | - ->write('unset($context[\'phpExcel\']);' . PHP_EOL); |
|
| 54 | + ->write('$context[\'phpExcel\']->endDocument('. |
|
| 55 | + ($this->preCalculateFormulas ? 'true' : 'false').', '. |
|
| 56 | + ($this->diskCachingDirectory ? '\''.$this->diskCachingDirectory.'\'' : 'null').');'.PHP_EOL) |
|
| 57 | + ->write('unset($context[\'phpExcel\']);'.PHP_EOL); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -78,171 +78,171 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | protected function initializeMappings() |
| 80 | 80 | { |
| 81 | - $this->mappings['autoFilter'] = function ($value) { |
|
| 81 | + $this->mappings['autoFilter'] = function($value) { |
|
| 82 | 82 | $this->object->setAutoFilter($value); |
| 83 | 83 | }; |
| 84 | 84 | $this->mappings['columnDimension']['__multi'] = true; |
| 85 | - $this->mappings['columnDimension']['__object'] = function ($key = 'default') { |
|
| 85 | + $this->mappings['columnDimension']['__object'] = function($key = 'default') { |
|
| 86 | 86 | return $key === 'default' ? $this->object->getDefaultColumnDimension() : $this->object->getColumnDimension($key); |
| 87 | 87 | }; |
| 88 | - $this->mappings['columnDimension']['autoSize'] = function ($key, $value) { |
|
| 88 | + $this->mappings['columnDimension']['autoSize'] = function($key, $value) { |
|
| 89 | 89 | $this->mappings['columnDimension']['__object']($key)->setAutoSize($value); |
| 90 | 90 | }; |
| 91 | - $this->mappings['columnDimension']['collapsed'] = function ($key, $value) { |
|
| 91 | + $this->mappings['columnDimension']['collapsed'] = function($key, $value) { |
|
| 92 | 92 | $this->mappings['columnDimension']['__object']($key)->setCollapsed($value); |
| 93 | 93 | }; |
| 94 | - $this->mappings['columnDimension']['columnIndex'] = function ($key, $value) { |
|
| 94 | + $this->mappings['columnDimension']['columnIndex'] = function($key, $value) { |
|
| 95 | 95 | $this->mappings['columnDimension']['__object']($key)->setColumnIndex($value); |
| 96 | 96 | }; |
| 97 | - $this->mappings['columnDimension']['outlineLevel'] = function ($key, $value) { |
|
| 97 | + $this->mappings['columnDimension']['outlineLevel'] = function($key, $value) { |
|
| 98 | 98 | $this->mappings['columnDimension']['__object']($key)->setOutlineLevel($value); |
| 99 | 99 | }; |
| 100 | - $this->mappings['columnDimension']['visible'] = function ($key, $value) { |
|
| 100 | + $this->mappings['columnDimension']['visible'] = function($key, $value) { |
|
| 101 | 101 | $this->mappings['columnDimension']['__object']($key)->setVisible($value); |
| 102 | 102 | }; |
| 103 | - $this->mappings['columnDimension']['width'] = function ($key, $value) { |
|
| 103 | + $this->mappings['columnDimension']['width'] = function($key, $value) { |
|
| 104 | 104 | $this->mappings['columnDimension']['__object']($key)->setWidth($value); |
| 105 | 105 | }; |
| 106 | - $this->mappings['columnDimension']['xfIndex'] = function ($key, $value) { |
|
| 106 | + $this->mappings['columnDimension']['xfIndex'] = function($key, $value) { |
|
| 107 | 107 | $this->mappings['columnDimension']['__object']($key)->setXfIndex($value); |
| 108 | 108 | }; |
| 109 | - $this->mappings['pageMargins']['top'] = function ($value) { |
|
| 109 | + $this->mappings['pageMargins']['top'] = function($value) { |
|
| 110 | 110 | $this->object->getPageMargins()->setTop($value); |
| 111 | 111 | }; |
| 112 | - $this->mappings['pageMargins']['bottom'] = function ($value) { |
|
| 112 | + $this->mappings['pageMargins']['bottom'] = function($value) { |
|
| 113 | 113 | $this->object->getPageMargins()->setBottom($value); |
| 114 | 114 | }; |
| 115 | - $this->mappings['pageMargins']['left'] = function ($value) { |
|
| 115 | + $this->mappings['pageMargins']['left'] = function($value) { |
|
| 116 | 116 | $this->object->getPageMargins()->setLeft($value); |
| 117 | 117 | }; |
| 118 | - $this->mappings['pageMargins']['right'] = function ($value) { |
|
| 118 | + $this->mappings['pageMargins']['right'] = function($value) { |
|
| 119 | 119 | $this->object->getPageMargins()->setRight($value); |
| 120 | 120 | }; |
| 121 | - $this->mappings['pageMargins']['header'] = function ($value) { |
|
| 121 | + $this->mappings['pageMargins']['header'] = function($value) { |
|
| 122 | 122 | $this->object->getPageMargins()->setHeader($value); |
| 123 | 123 | }; |
| 124 | - $this->mappings['pageMargins']['footer'] = function ($value) { |
|
| 124 | + $this->mappings['pageMargins']['footer'] = function($value) { |
|
| 125 | 125 | $this->object->getPageMargins()->setFooter($value); |
| 126 | 126 | }; |
| 127 | - $this->mappings['pageSetup']['fitToHeight'] = function ($value) { |
|
| 127 | + $this->mappings['pageSetup']['fitToHeight'] = function($value) { |
|
| 128 | 128 | $this->object->getPageSetup()->setFitToHeight($value); |
| 129 | 129 | }; |
| 130 | - $this->mappings['pageSetup']['fitToPage'] = function ($value) { |
|
| 130 | + $this->mappings['pageSetup']['fitToPage'] = function($value) { |
|
| 131 | 131 | $this->object->getPageSetup()->setFitToPage($value); |
| 132 | 132 | }; |
| 133 | - $this->mappings['pageSetup']['fitToWidth'] = function ($value) { |
|
| 133 | + $this->mappings['pageSetup']['fitToWidth'] = function($value) { |
|
| 134 | 134 | $this->object->getPageSetup()->setFitToWidth($value); |
| 135 | 135 | }; |
| 136 | - $this->mappings['pageSetup']['horizontalCentered'] = function ($value) { |
|
| 136 | + $this->mappings['pageSetup']['horizontalCentered'] = function($value) { |
|
| 137 | 137 | $this->object->getPageSetup()->setHorizontalCentered($value); |
| 138 | 138 | }; |
| 139 | - $this->mappings['pageSetup']['orientation'] = function ($value) { |
|
| 139 | + $this->mappings['pageSetup']['orientation'] = function($value) { |
|
| 140 | 140 | $this->object->getPageSetup()->setOrientation($value); |
| 141 | 141 | }; |
| 142 | - $this->mappings['pageSetup']['paperSize'] = function ($value) { |
|
| 142 | + $this->mappings['pageSetup']['paperSize'] = function($value) { |
|
| 143 | 143 | $this->object->getPageSetup()->setPaperSize($value); |
| 144 | 144 | }; |
| 145 | - $this->mappings['pageSetup']['printArea'] = function ($value) { |
|
| 145 | + $this->mappings['pageSetup']['printArea'] = function($value) { |
|
| 146 | 146 | $this->object->getPageSetup()->setPrintArea($value); |
| 147 | 147 | }; |
| 148 | - $this->mappings['pageSetup']['scale'] = function ($value) { |
|
| 148 | + $this->mappings['pageSetup']['scale'] = function($value) { |
|
| 149 | 149 | $this->object->getPageSetup()->setScale($value); |
| 150 | 150 | }; |
| 151 | - $this->mappings['pageSetup']['verticalCentered'] = function ($value) { |
|
| 151 | + $this->mappings['pageSetup']['verticalCentered'] = function($value) { |
|
| 152 | 152 | $this->object->getPageSetup()->setVerticalCentered($value); |
| 153 | 153 | }; |
| 154 | - $this->mappings['printGridlines'] = function ($value) { |
|
| 154 | + $this->mappings['printGridlines'] = function($value) { |
|
| 155 | 155 | $this->object->setPrintGridlines($value); |
| 156 | 156 | }; |
| 157 | - $this->mappings['protection']['autoFilter'] = function ($value) { |
|
| 157 | + $this->mappings['protection']['autoFilter'] = function($value) { |
|
| 158 | 158 | $this->object->getProtection()->setAutoFilter($value); |
| 159 | 159 | }; |
| 160 | - $this->mappings['protection']['deleteColumns'] = function ($value) { |
|
| 160 | + $this->mappings['protection']['deleteColumns'] = function($value) { |
|
| 161 | 161 | $this->object->getProtection()->setDeleteColumns($value); |
| 162 | 162 | }; |
| 163 | - $this->mappings['protection']['deleteRows'] = function ($value) { |
|
| 163 | + $this->mappings['protection']['deleteRows'] = function($value) { |
|
| 164 | 164 | $this->object->getProtection()->setDeleteRows($value); |
| 165 | 165 | }; |
| 166 | - $this->mappings['protection']['formatCells'] = function ($value) { |
|
| 166 | + $this->mappings['protection']['formatCells'] = function($value) { |
|
| 167 | 167 | $this->object->getProtection()->setFormatCells($value); |
| 168 | 168 | }; |
| 169 | - $this->mappings['protection']['formatColumns'] = function ($value) { |
|
| 169 | + $this->mappings['protection']['formatColumns'] = function($value) { |
|
| 170 | 170 | $this->object->getProtection()->setFormatColumns($value); |
| 171 | 171 | }; |
| 172 | - $this->mappings['protection']['formatRows'] = function ($value) { |
|
| 172 | + $this->mappings['protection']['formatRows'] = function($value) { |
|
| 173 | 173 | $this->object->getProtection()->setFormatRows($value); |
| 174 | 174 | }; |
| 175 | - $this->mappings['protection']['insertColumns'] = function ($value) { |
|
| 175 | + $this->mappings['protection']['insertColumns'] = function($value) { |
|
| 176 | 176 | $this->object->getProtection()->setInsertColumns($value); |
| 177 | 177 | }; |
| 178 | - $this->mappings['protection']['insertHyperlinks'] = function ($value) { |
|
| 178 | + $this->mappings['protection']['insertHyperlinks'] = function($value) { |
|
| 179 | 179 | $this->object->getProtection()->setInsertHyperlinks($value); |
| 180 | 180 | }; |
| 181 | - $this->mappings['protection']['insertRows'] = function ($value) { |
|
| 181 | + $this->mappings['protection']['insertRows'] = function($value) { |
|
| 182 | 182 | $this->object->getProtection()->setInsertRows($value); |
| 183 | 183 | }; |
| 184 | - $this->mappings['protection']['objects'] = function ($value) { |
|
| 184 | + $this->mappings['protection']['objects'] = function($value) { |
|
| 185 | 185 | $this->object->getProtection()->setObjects($value); |
| 186 | 186 | }; |
| 187 | - $this->mappings['protection']['password'] = function ($value) { |
|
| 187 | + $this->mappings['protection']['password'] = function($value) { |
|
| 188 | 188 | $this->object->getProtection()->setPassword($value); |
| 189 | 189 | }; |
| 190 | - $this->mappings['protection']['pivotTables'] = function ($value) { |
|
| 190 | + $this->mappings['protection']['pivotTables'] = function($value) { |
|
| 191 | 191 | $this->object->getProtection()->setPivotTables($value); |
| 192 | 192 | }; |
| 193 | - $this->mappings['protection']['scenarios'] = function ($value) { |
|
| 193 | + $this->mappings['protection']['scenarios'] = function($value) { |
|
| 194 | 194 | $this->object->getProtection()->setScenarios($value); |
| 195 | 195 | }; |
| 196 | - $this->mappings['protection']['selectLockedCells'] = function ($value) { |
|
| 196 | + $this->mappings['protection']['selectLockedCells'] = function($value) { |
|
| 197 | 197 | $this->object->getProtection()->setSelectLockedCells($value); |
| 198 | 198 | }; |
| 199 | - $this->mappings['protection']['selectUnlockedCells'] = function ($value) { |
|
| 199 | + $this->mappings['protection']['selectUnlockedCells'] = function($value) { |
|
| 200 | 200 | $this->object->getProtection()->setSelectUnlockedCells($value); |
| 201 | 201 | }; |
| 202 | - $this->mappings['protection']['sheet'] = function ($value) { |
|
| 202 | + $this->mappings['protection']['sheet'] = function($value) { |
|
| 203 | 203 | $this->object->getProtection()->setSheet($value); |
| 204 | 204 | }; |
| 205 | - $this->mappings['protection']['sort'] = function ($value) { |
|
| 205 | + $this->mappings['protection']['sort'] = function($value) { |
|
| 206 | 206 | $this->object->getProtection()->setSort($value); |
| 207 | 207 | }; |
| 208 | - $this->mappings['rightToLeft'] = function ($value) { |
|
| 208 | + $this->mappings['rightToLeft'] = function($value) { |
|
| 209 | 209 | $this->object->setRightToLeft($value); |
| 210 | 210 | }; |
| 211 | 211 | $this->mappings['rowDimension']['__multi'] = true; |
| 212 | - $this->mappings['rowDimension']['__object'] = function ($key) { |
|
| 212 | + $this->mappings['rowDimension']['__object'] = function($key) { |
|
| 213 | 213 | return $key === 'default' ? $this->object->getDefaultRowDimension() : $this->object->getRowDimension($key); |
| 214 | 214 | }; |
| 215 | - $this->mappings['rowDimension']['collapsed'] = function ($key, $value) { |
|
| 215 | + $this->mappings['rowDimension']['collapsed'] = function($key, $value) { |
|
| 216 | 216 | $this->mappings['rowDimension']['__object']($key)->setCollapsed($value); |
| 217 | 217 | }; |
| 218 | - $this->mappings['rowDimension']['outlineLevel'] = function ($key, $value) { |
|
| 218 | + $this->mappings['rowDimension']['outlineLevel'] = function($key, $value) { |
|
| 219 | 219 | $this->mappings['rowDimension']['__object']($key)->setOutlineLevel($value); |
| 220 | 220 | }; |
| 221 | - $this->mappings['rowDimension']['rowHeight'] = function ($key, $value) { |
|
| 221 | + $this->mappings['rowDimension']['rowHeight'] = function($key, $value) { |
|
| 222 | 222 | $this->mappings['rowDimension']['__object']($key)->setRowHeight($value); |
| 223 | 223 | }; |
| 224 | - $this->mappings['rowDimension']['rowIndex'] = function ($key, $value) { |
|
| 224 | + $this->mappings['rowDimension']['rowIndex'] = function($key, $value) { |
|
| 225 | 225 | $this->mappings['rowDimension']['__object']($key)->setRowIndex($value); |
| 226 | 226 | }; |
| 227 | - $this->mappings['rowDimension']['visible'] = function ($key, $value) { |
|
| 227 | + $this->mappings['rowDimension']['visible'] = function($key, $value) { |
|
| 228 | 228 | $this->mappings['rowDimension']['__object']($key)->setVisible($value); |
| 229 | 229 | }; |
| 230 | - $this->mappings['rowDimension']['xfIndex'] = function ($key, $value) { |
|
| 230 | + $this->mappings['rowDimension']['xfIndex'] = function($key, $value) { |
|
| 231 | 231 | $this->mappings['rowDimension']['__object']($key)->setXfIndex($value); |
| 232 | 232 | }; |
| 233 | - $this->mappings['rowDimension']['zeroHeight'] = function ($key, $value) { |
|
| 233 | + $this->mappings['rowDimension']['zeroHeight'] = function($key, $value) { |
|
| 234 | 234 | $this->mappings['rowDimension']['__object']($key)->setZeroHeight($value); |
| 235 | 235 | }; |
| 236 | - $this->mappings['sheetState'] = function ($value) { |
|
| 236 | + $this->mappings['sheetState'] = function($value) { |
|
| 237 | 237 | $this->object->setSheetState($value); |
| 238 | 238 | }; |
| 239 | - $this->mappings['showGridlines'] = function ($value) { |
|
| 239 | + $this->mappings['showGridlines'] = function($value) { |
|
| 240 | 240 | $this->object->setShowGridlines($value); |
| 241 | 241 | }; |
| 242 | - $this->mappings['tabColor'] = function ($value) { |
|
| 242 | + $this->mappings['tabColor'] = function($value) { |
|
| 243 | 243 | $this->object->getTabColor()->setRGB($value); |
| 244 | 244 | }; |
| 245 | - $this->mappings['zoomScale'] = function ($value) { |
|
| 245 | + $this->mappings['zoomScale'] = function($value) { |
|
| 246 | 246 | $this->object->getSheetView()->setZoomScale($value); |
| 247 | 247 | }; |
| 248 | 248 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function start($index, array $properties = null) |
| 256 | 256 | { |
| 257 | - if (is_int($index) && $index <$this->documentWrapper->getObject()->getSheetCount()) { |
|
| 257 | + if (is_int($index) && $index < $this->documentWrapper->getObject()->getSheetCount()) { |
|
| 258 | 258 | $this->object = $this->documentWrapper->getObject()->setActiveSheetIndex($index); |
| 259 | 259 | } elseif (is_string($index)) { |
| 260 | 260 | if (!$this->documentWrapper->getObject()->sheetNameExists($index)) { |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $this->documentWrapper->getObject()->createSheet()->setTitle($index); |
| 263 | 263 | } |
| 264 | 264 | $this->object = $this->documentWrapper->getObject()->setActiveSheetIndexByName($index); |
| 265 | - } else { |
|
| 265 | + } else { |
|
| 266 | 266 | // create new sheet without a name |
| 267 | 267 | $this->documentWrapper->getObject()->createSheet(); |
| 268 | 268 | $this->object = $this->documentWrapper->getObject()->setActiveSheetIndex(0); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | && is_array($this->attributes['properties']['columnDimension']) |
| 286 | 286 | ) { |
| 287 | 287 | foreach ($this->attributes['properties']['columnDimension'] as $key => $value) { |
| 288 | - if(true === is_array($value) && true === isset($value['autoSize'])) { |
|
| 288 | + if (true === is_array($value) && true === isset($value['autoSize'])) { |
|
| 289 | 289 | if ('default' == $key) { |
| 290 | 290 | $cellIterator = $this->object->getRowIterator()->current()->getCellIterator(); |
| 291 | 291 | $cellIterator->setIterateOnlyExistingCells(true); |