@@ -39,6 +39,5 @@ |
||
| 39 | 39 | * @class DocxTemplateException |
| 40 | 40 | * @package Platine\DocxTemplate\Exception |
| 41 | 41 | */ |
| 42 | -class DocxTemplateException extends Exception |
|
| 43 | -{ |
|
| 42 | +class DocxTemplateException extends Exception { |
|
| 44 | 43 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class PlatineTemplateRenderer |
| 54 | 54 | * @package Platine\DocxTemplate\Renderer |
| 55 | 55 | */ |
| 56 | -class PlatineTemplateRenderer implements DocxTemplateRendererInterface |
|
| 57 | -{ |
|
| 56 | +class PlatineTemplateRenderer implements DocxTemplateRendererInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The template instance to use |
| 60 | 59 | * @var Template |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * Create new instance |
| 66 | 65 | * @param Template $template |
| 67 | 66 | */ |
| 68 | - public function __construct(Template $template) |
|
| 69 | - { |
|
| 67 | + public function __construct(Template $template) { |
|
| 70 | 68 | $this->template = $template; |
| 71 | 69 | } |
| 72 | 70 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | */ |
| 88 | 88 | protected function fixSplitTemplateTags(string $content): string |
| 89 | 89 | { |
| 90 | - /* |
|
| 90 | + /* |
|
| 91 | 91 | * If part of the tag is formatted differently we won't get a match. |
| 92 | 92 | * Best explained with an example: |
| 93 | 93 | * |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | ZipArchive::CREATE | ZipArchive::OVERWRITE |
| 85 | 85 | ); |
| 86 | 86 | if ($create === true) { |
| 87 | - // Create recursive directory iterator |
|
| 87 | + // Create recursive directory iterator |
|
| 88 | 88 | $files = new RecursiveIteratorIterator( |
| 89 | 89 | new RecursiveDirectoryIterator( |
| 90 | 90 | $folder, |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * @class Zip |
| 58 | 58 | * @package Platine\DocxTemplate\Archive |
| 59 | 59 | */ |
| 60 | -class Zip implements DocxExtractorInterface |
|
| 61 | -{ |
|
| 60 | +class Zip implements DocxExtractorInterface { |
|
| 62 | 61 | /** |
| 63 | 62 | * The zip archive instance |
| 64 | 63 | * @var ZipArchive |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * Create new instance |
| 70 | 69 | * @param ZipArchive|null $zip |
| 71 | 70 | */ |
| 72 | - public function __construct(?ZipArchive $zip = null) |
|
| 73 | - { |
|
| 71 | + public function __construct(?ZipArchive $zip = null) { |
|
| 74 | 72 | $this->zip = $zip ?? new ZipArchive(); |
| 75 | 73 | } |
| 76 | 74 | |
@@ -39,6 +39,5 @@ |
||
| 39 | 39 | * @class DocxArchiveException |
| 40 | 40 | * @package Platine\DocxTemplate\Exception |
| 41 | 41 | */ |
| 42 | -class DocxArchiveException extends Exception |
|
| 43 | -{ |
|
| 42 | +class DocxArchiveException extends Exception { |
|
| 44 | 43 | } |
@@ -33,49 +33,49 @@ |
||
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | $l->setTemplateFile(dirname(__FILE__) . '/invoice.docx') |
| 36 | - ->setData([ |
|
| 37 | - 'company' => [ |
|
| 38 | - 'name' => 'Galaxy Finance', |
|
| 39 | - 'address' => 'PK 15 Road of Boali', |
|
| 40 | - 'phone' => '+236-72000000', |
|
| 41 | - ], |
|
| 42 | - 'customer' => [ |
|
| 43 | - 'name' => 'Banabool Kitoko', |
|
| 44 | - 'phone' => '+236-75111111', |
|
| 45 | - 'email' => '[email protected]', |
|
| 46 | - ], |
|
| 47 | - 'invoice' => [ |
|
| 48 | - 'no' => '2021090500033', |
|
| 49 | - 'date' => '2021-09-05 11:25:08', |
|
| 50 | - 'sub_total' => '3,450 FCFA', |
|
| 51 | - 'tax' => '19 %', |
|
| 52 | - 'total_amount' => '4,105 FCFA', |
|
| 53 | - 'due_days' => 15, |
|
| 54 | - ], |
|
| 55 | - 'items' => [ |
|
| 56 | - [ |
|
| 57 | - 'no' => 1, |
|
| 58 | - 'name' => 'Savon', |
|
| 59 | - 'price' => 250, |
|
| 60 | - 'quantity' => 2, |
|
| 61 | - 'total' => 500, |
|
| 62 | - ], |
|
| 63 | - [ |
|
| 64 | - 'no' => 2, |
|
| 65 | - 'name' => 'Sucre', |
|
| 66 | - 'price' => 500, |
|
| 67 | - 'quantity' => 5, |
|
| 68 | - 'total' => 2500, |
|
| 69 | - ], |
|
| 70 | - [ |
|
| 71 | - 'no' => 3, |
|
| 72 | - 'name' => 'Omo', |
|
| 73 | - 'price' => 150, |
|
| 74 | - 'quantity' => 3, |
|
| 75 | - 'total' => 450, |
|
| 76 | - ] |
|
| 77 | - ], |
|
| 78 | - ]); |
|
| 36 | + ->setData([ |
|
| 37 | + 'company' => [ |
|
| 38 | + 'name' => 'Galaxy Finance', |
|
| 39 | + 'address' => 'PK 15 Road of Boali', |
|
| 40 | + 'phone' => '+236-72000000', |
|
| 41 | + ], |
|
| 42 | + 'customer' => [ |
|
| 43 | + 'name' => 'Banabool Kitoko', |
|
| 44 | + 'phone' => '+236-75111111', |
|
| 45 | + 'email' => '[email protected]', |
|
| 46 | + ], |
|
| 47 | + 'invoice' => [ |
|
| 48 | + 'no' => '2021090500033', |
|
| 49 | + 'date' => '2021-09-05 11:25:08', |
|
| 50 | + 'sub_total' => '3,450 FCFA', |
|
| 51 | + 'tax' => '19 %', |
|
| 52 | + 'total_amount' => '4,105 FCFA', |
|
| 53 | + 'due_days' => 15, |
|
| 54 | + ], |
|
| 55 | + 'items' => [ |
|
| 56 | + [ |
|
| 57 | + 'no' => 1, |
|
| 58 | + 'name' => 'Savon', |
|
| 59 | + 'price' => 250, |
|
| 60 | + 'quantity' => 2, |
|
| 61 | + 'total' => 500, |
|
| 62 | + ], |
|
| 63 | + [ |
|
| 64 | + 'no' => 2, |
|
| 65 | + 'name' => 'Sucre', |
|
| 66 | + 'price' => 500, |
|
| 67 | + 'quantity' => 5, |
|
| 68 | + 'total' => 2500, |
|
| 69 | + ], |
|
| 70 | + [ |
|
| 71 | + 'no' => 3, |
|
| 72 | + 'name' => 'Omo', |
|
| 73 | + 'price' => 150, |
|
| 74 | + 'quantity' => 3, |
|
| 75 | + 'total' => 450, |
|
| 76 | + ] |
|
| 77 | + ], |
|
| 78 | + ]); |
|
| 79 | 79 | $l->process(); |
| 80 | 80 | $l->convert(); |
| 81 | 81 | |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | * @class DocxTemplate |
| 57 | 57 | * @package Platine\DocxTemplate |
| 58 | 58 | */ |
| 59 | -class DocxTemplate |
|
| 60 | -{ |
|
| 59 | +class DocxTemplate { |
|
| 61 | 60 | /** |
| 62 | 61 | * The convertor instance to use |
| 63 | 62 | * @var DocxConvertorInterface |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class DocxTemplateRendererInterface |
| 52 | 52 | * @package Platine\DocxTemplate |
| 53 | 53 | */ |
| 54 | -interface DocxTemplateRendererInterface |
|
| 55 | -{ |
|
| 54 | +interface DocxTemplateRendererInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Render the template content |
| 58 | 57 | * @param string $content |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class NullRenderer |
| 53 | 53 | * @package Platine\DocxTemplate\Renderer |
| 54 | 54 | */ |
| 55 | -class NullRenderer implements DocxTemplateRendererInterface |
|
| 56 | -{ |
|
| 55 | +class NullRenderer implements DocxTemplateRendererInterface { |
|
| 57 | 56 | /** |
| 58 | 57 | * {@inheritdoc} |
| 59 | 58 | */ |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class NullExtractor |
| 53 | 53 | * @package Platine\DocxTemplate\Archive |
| 54 | 54 | */ |
| 55 | -class NullExtractor implements DocxExtractorInterface |
|
| 56 | -{ |
|
| 55 | +class NullExtractor implements DocxExtractorInterface { |
|
| 57 | 56 | /** |
| 58 | 57 | * {@inheritdoc} |
| 59 | 58 | */ |