@@ -299,7 +299,7 @@ |
||
| 299 | 299 | */ |
| 300 | 300 | public function testDocumentTemplate($format) |
| 301 | 301 | { |
| 302 | - $document = $this->getDocument('documentTemplate.' . $format, $format); |
|
| 302 | + $document = $this->getDocument('documentTemplate.'.$format, $format); |
|
| 303 | 303 | static::assertNotNull($document, 'Document does not exist'); |
| 304 | 304 | |
| 305 | 305 | $sheet = $document->getSheet(0); |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | $appVariable->setRequestStack($requestStack); |
| 61 | 61 | |
| 62 | 62 | // generate source from template |
| 63 | - $source = static::$environment->loadTemplate($templateName . '.twig')->render(['app' => $appVariable]); |
|
| 63 | + $source = static::$environment->loadTemplate($templateName.'.twig')->render(['app' => $appVariable]); |
|
| 64 | 64 | |
| 65 | 65 | // create paths |
| 66 | - $tempDirPath = __DIR__ . static::$TEMP_PATH; |
|
| 67 | - $tempFilePath = $tempDirPath . $templateName . '.' . $format; |
|
| 66 | + $tempDirPath = __DIR__.static::$TEMP_PATH; |
|
| 67 | + $tempFilePath = $tempDirPath.$templateName.'.'.$format; |
|
| 68 | 68 | |
| 69 | 69 | // save source |
| 70 | 70 | static::$fileSystem->dumpFile($tempFilePath, $source); |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | static::$fileSystem = new Filesystem(); |
| 109 | 109 | |
| 110 | - $twigFileSystem = new Twig_Loader_Filesystem([__DIR__ . static::$RESOURCE_PATH]); |
|
| 111 | - $twigFileSystem->addPath( __DIR__ . static::$TEMPLATE_PATH, 'templates'); |
|
| 110 | + $twigFileSystem = new Twig_Loader_Filesystem([__DIR__.static::$RESOURCE_PATH]); |
|
| 111 | + $twigFileSystem->addPath(__DIR__.static::$TEMPLATE_PATH, 'templates'); |
|
| 112 | 112 | |
| 113 | 113 | static::$environment = new Twig_Environment($twigFileSystem, ['strict_variables' => true]); |
| 114 | 114 | static::$environment->addExtension(new TwigExcelExtension()); |
| 115 | - static::$environment->setCache(__DIR__ . static::$TEMP_PATH); |
|
| 115 | + static::$environment->setCache(__DIR__.static::$TEMP_PATH); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public static function tearDownAfterClass() |
| 123 | 123 | { |
| 124 | 124 | if (in_array(getenv('DELETE_TEMP_FILES'), ['true', '1', 1, true], true)) { |
| 125 | - static::$fileSystem->remove(__DIR__ . static::$TEMP_PATH); |
|
| 125 | + static::$fileSystem->remove(__DIR__.static::$TEMP_PATH); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -60,61 +60,61 @@ |
||
| 60 | 60 | |
| 61 | 61 | protected function initializeMappings() |
| 62 | 62 | { |
| 63 | - $this->mappings['break'] = function ($value) { |
|
| 63 | + $this->mappings['break'] = function($value) { |
|
| 64 | 64 | $this->sheetWrapper->getObject()->setBreak($this->object->getCoordinate(), $value); |
| 65 | 65 | }; |
| 66 | - $this->mappings['dataType'] = function ($value) { |
|
| 66 | + $this->mappings['dataType'] = function($value) { |
|
| 67 | 67 | $this->object->setDataType($value); |
| 68 | 68 | }; |
| 69 | - $this->mappings['dataValidation']['allowBlank'] = function ($value) { |
|
| 69 | + $this->mappings['dataValidation']['allowBlank'] = function($value) { |
|
| 70 | 70 | $this->object->getDataValidation()->setAllowBlank($value); |
| 71 | 71 | }; |
| 72 | - $this->mappings['dataValidation']['error'] = function ($value) { |
|
| 72 | + $this->mappings['dataValidation']['error'] = function($value) { |
|
| 73 | 73 | $this->object->getDataValidation()->setError($value); |
| 74 | 74 | }; |
| 75 | - $this->mappings['dataValidation']['errorStyle'] = function ($value) { |
|
| 75 | + $this->mappings['dataValidation']['errorStyle'] = function($value) { |
|
| 76 | 76 | $this->object->getDataValidation()->setErrorStyle($value); |
| 77 | 77 | }; |
| 78 | - $this->mappings['dataValidation']['errorTitle'] = function ($value) { |
|
| 78 | + $this->mappings['dataValidation']['errorTitle'] = function($value) { |
|
| 79 | 79 | $this->object->getDataValidation()->setErrorTitle($value); |
| 80 | 80 | }; |
| 81 | - $this->mappings['dataValidation']['formula1'] = function ($value) { |
|
| 81 | + $this->mappings['dataValidation']['formula1'] = function($value) { |
|
| 82 | 82 | $this->object->getDataValidation()->setFormula1($value); |
| 83 | 83 | }; |
| 84 | - $this->mappings['dataValidation']['formula2'] = function ($value) { |
|
| 84 | + $this->mappings['dataValidation']['formula2'] = function($value) { |
|
| 85 | 85 | $this->object->getDataValidation()->setFormula2($value); |
| 86 | 86 | }; |
| 87 | - $this->mappings['dataValidation']['operator'] = function ($value) { |
|
| 87 | + $this->mappings['dataValidation']['operator'] = function($value) { |
|
| 88 | 88 | $this->object->getDataValidation()->setOperator($value); |
| 89 | 89 | }; |
| 90 | - $this->mappings['dataValidation']['prompt'] = function ($value) { |
|
| 90 | + $this->mappings['dataValidation']['prompt'] = function($value) { |
|
| 91 | 91 | $this->object->getDataValidation()->setPrompt($value); |
| 92 | 92 | }; |
| 93 | - $this->mappings['dataValidation']['promptTitle'] = function ($value) { |
|
| 93 | + $this->mappings['dataValidation']['promptTitle'] = function($value) { |
|
| 94 | 94 | $this->object->getDataValidation()->setPromptTitle($value); |
| 95 | 95 | }; |
| 96 | - $this->mappings['dataValidation']['showDropDown'] = function ($value) { |
|
| 96 | + $this->mappings['dataValidation']['showDropDown'] = function($value) { |
|
| 97 | 97 | $this->object->getDataValidation()->setShowDropDown($value); |
| 98 | 98 | }; |
| 99 | - $this->mappings['dataValidation']['showErrorMessage'] = function ($value) { |
|
| 99 | + $this->mappings['dataValidation']['showErrorMessage'] = function($value) { |
|
| 100 | 100 | $this->object->getDataValidation()->setShowErrorMessage($value); |
| 101 | 101 | }; |
| 102 | - $this->mappings['dataValidation']['showInputMessage'] = function ($value) { |
|
| 102 | + $this->mappings['dataValidation']['showInputMessage'] = function($value) { |
|
| 103 | 103 | $this->object->getDataValidation()->setShowInputMessage($value); |
| 104 | 104 | }; |
| 105 | - $this->mappings['dataValidation']['type'] = function ($value) { |
|
| 105 | + $this->mappings['dataValidation']['type'] = function($value) { |
|
| 106 | 106 | $this->object->getDataValidation()->setType($value); |
| 107 | 107 | }; |
| 108 | - $this->mappings['merge'] = function ($value) { |
|
| 108 | + $this->mappings['merge'] = function($value) { |
|
| 109 | 109 | if (is_int($value)) { |
| 110 | - $value = PHPExcel_Cell::stringFromColumnIndex($value) . $this->sheetWrapper->getRow(); |
|
| 110 | + $value = PHPExcel_Cell::stringFromColumnIndex($value).$this->sheetWrapper->getRow(); |
|
| 111 | 111 | } |
| 112 | 112 | $this->sheetWrapper->getObject()->mergeCells(sprintf('%s:%s', $this->object->getCoordinate(), $value)); |
| 113 | 113 | }; |
| 114 | - $this->mappings['style'] = function ($value) { |
|
| 114 | + $this->mappings['style'] = function($value) { |
|
| 115 | 115 | $this->sheetWrapper->getObject()->getStyle($this->object->getCoordinate())->applyFromArray($value); |
| 116 | 116 | }; |
| 117 | - $this->mappings['url'] = function ($value) { |
|
| 117 | + $this->mappings['url'] = function($value) { |
|
| 118 | 118 | $this->object->getHyperlink()->setUrl($value); |
| 119 | 119 | }; |
| 120 | 120 | } |
@@ -60,61 +60,79 @@ |
||
| 60 | 60 | |
| 61 | 61 | protected function initializeMappings() |
| 62 | 62 | { |
| 63 | - $this->mappings['break'] = function ($value) { |
|
| 63 | + $this->mappings['break'] = function ($value) |
|
| 64 | + { |
|
| 64 | 65 | $this->sheetWrapper->getObject()->setBreak($this->object->getCoordinate(), $value); |
| 65 | 66 | }; |
| 66 | - $this->mappings['dataType'] = function ($value) { |
|
| 67 | + $this->mappings['dataType'] = function ($value) |
|
| 68 | + { |
|
| 67 | 69 | $this->object->setDataType($value); |
| 68 | 70 | }; |
| 69 | - $this->mappings['dataValidation']['allowBlank'] = function ($value) { |
|
| 71 | + $this->mappings['dataValidation']['allowBlank'] = function ($value) |
|
| 72 | + { |
|
| 70 | 73 | $this->object->getDataValidation()->setAllowBlank($value); |
| 71 | 74 | }; |
| 72 | - $this->mappings['dataValidation']['error'] = function ($value) { |
|
| 75 | + $this->mappings['dataValidation']['error'] = function ($value) |
|
| 76 | + { |
|
| 73 | 77 | $this->object->getDataValidation()->setError($value); |
| 74 | 78 | }; |
| 75 | - $this->mappings['dataValidation']['errorStyle'] = function ($value) { |
|
| 79 | + $this->mappings['dataValidation']['errorStyle'] = function ($value) |
|
| 80 | + { |
|
| 76 | 81 | $this->object->getDataValidation()->setErrorStyle($value); |
| 77 | 82 | }; |
| 78 | - $this->mappings['dataValidation']['errorTitle'] = function ($value) { |
|
| 83 | + $this->mappings['dataValidation']['errorTitle'] = function ($value) |
|
| 84 | + { |
|
| 79 | 85 | $this->object->getDataValidation()->setErrorTitle($value); |
| 80 | 86 | }; |
| 81 | - $this->mappings['dataValidation']['formula1'] = function ($value) { |
|
| 87 | + $this->mappings['dataValidation']['formula1'] = function ($value) |
|
| 88 | + { |
|
| 82 | 89 | $this->object->getDataValidation()->setFormula1($value); |
| 83 | 90 | }; |
| 84 | - $this->mappings['dataValidation']['formula2'] = function ($value) { |
|
| 91 | + $this->mappings['dataValidation']['formula2'] = function ($value) |
|
| 92 | + { |
|
| 85 | 93 | $this->object->getDataValidation()->setFormula2($value); |
| 86 | 94 | }; |
| 87 | - $this->mappings['dataValidation']['operator'] = function ($value) { |
|
| 95 | + $this->mappings['dataValidation']['operator'] = function ($value) |
|
| 96 | + { |
|
| 88 | 97 | $this->object->getDataValidation()->setOperator($value); |
| 89 | 98 | }; |
| 90 | - $this->mappings['dataValidation']['prompt'] = function ($value) { |
|
| 99 | + $this->mappings['dataValidation']['prompt'] = function ($value) |
|
| 100 | + { |
|
| 91 | 101 | $this->object->getDataValidation()->setPrompt($value); |
| 92 | 102 | }; |
| 93 | - $this->mappings['dataValidation']['promptTitle'] = function ($value) { |
|
| 103 | + $this->mappings['dataValidation']['promptTitle'] = function ($value) |
|
| 104 | + { |
|
| 94 | 105 | $this->object->getDataValidation()->setPromptTitle($value); |
| 95 | 106 | }; |
| 96 | - $this->mappings['dataValidation']['showDropDown'] = function ($value) { |
|
| 107 | + $this->mappings['dataValidation']['showDropDown'] = function ($value) |
|
| 108 | + { |
|
| 97 | 109 | $this->object->getDataValidation()->setShowDropDown($value); |
| 98 | 110 | }; |
| 99 | - $this->mappings['dataValidation']['showErrorMessage'] = function ($value) { |
|
| 111 | + $this->mappings['dataValidation']['showErrorMessage'] = function ($value) |
|
| 112 | + { |
|
| 100 | 113 | $this->object->getDataValidation()->setShowErrorMessage($value); |
| 101 | 114 | }; |
| 102 | - $this->mappings['dataValidation']['showInputMessage'] = function ($value) { |
|
| 115 | + $this->mappings['dataValidation']['showInputMessage'] = function ($value) |
|
| 116 | + { |
|
| 103 | 117 | $this->object->getDataValidation()->setShowInputMessage($value); |
| 104 | 118 | }; |
| 105 | - $this->mappings['dataValidation']['type'] = function ($value) { |
|
| 119 | + $this->mappings['dataValidation']['type'] = function ($value) |
|
| 120 | + { |
|
| 106 | 121 | $this->object->getDataValidation()->setType($value); |
| 107 | 122 | }; |
| 108 | - $this->mappings['merge'] = function ($value) { |
|
| 123 | + $this->mappings['merge'] = function ($value) |
|
| 124 | + { |
|
| 109 | 125 | if (is_int($value)) { |
| 110 | 126 | $value = PHPExcel_Cell::stringFromColumnIndex($value) . $this->sheetWrapper->getRow(); |
| 111 | 127 | } |
| 112 | 128 | $this->sheetWrapper->getObject()->mergeCells(sprintf('%s:%s', $this->object->getCoordinate(), $value)); |
| 113 | 129 | }; |
| 114 | - $this->mappings['style'] = function ($value) { |
|
| 130 | + $this->mappings['style'] = function ($value) |
|
| 131 | + { |
|
| 115 | 132 | $this->sheetWrapper->getObject()->getStyle($this->object->getCoordinate())->applyFromArray($value); |
| 116 | 133 | }; |
| 117 | - $this->mappings['url'] = function ($value) { |
|
| 134 | + $this->mappings['url'] = function ($value) |
|
| 135 | + { |
|
| 118 | 136 | $this->object->getHyperlink()->setUrl($value); |
| 119 | 137 | }; |
| 120 | 138 | } |