@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class DocxTemplate |
55 | 55 | * @package Platine\DocxTemplate |
56 | 56 | */ |
57 | -class DocxTemplate |
|
58 | -{ |
|
57 | +class DocxTemplate { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * The convertor instance to use |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class NullConvertor |
53 | 53 | * @package Platine\DocxTemplate\Convertor |
54 | 54 | */ |
55 | -class NullConvertor implements DocxConvertorInterface |
|
56 | -{ |
|
55 | +class NullConvertor implements DocxConvertorInterface { |
|
57 | 56 | /** |
58 | 57 | * {@inheritodc} |
59 | 58 | */ |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class LibreOfficePDFConvertor |
53 | 53 | * @package Platine\DocxTemplate\Convertor |
54 | 54 | */ |
55 | -class LibreOfficePDFConvertor implements DocxConvertorInterface |
|
56 | -{ |
|
55 | +class LibreOfficePDFConvertor implements DocxConvertorInterface { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * {@inheritodc} |
@@ -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 | /** |
58 | 57 | * Render the template content |
@@ -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 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * @class DocxConvertorInterface |
52 | 52 | * @package Platine\DocxTemplate |
53 | 53 | */ |
54 | -interface DocxConvertorInterface |
|
55 | -{ |
|
54 | +interface DocxConvertorInterface { |
|
56 | 55 | |
57 | 56 | /** |
58 | 57 | * Convert the template file |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // coem with the expected content |
98 | 98 | $variables = (string) preg_replace_callback( |
99 | 99 | '/{{(.*?)}}/', |
100 | - function ($match) { |
|
100 | + function($match) { |
|
101 | 101 | return strip_tags($match[0]); |
102 | 102 | }, |
103 | 103 | (string) preg_replace('/(?<!{){(?!{)<\/w:t>[\s\S]*?<w:t>{/', '{{', $content) |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | return (string) preg_replace_callback( |
107 | 107 | '/{%(.*?)%}/', |
108 | - function ($match) { |
|
108 | + function($match) { |
|
109 | 109 | return strip_tags($match[0]); |
110 | 110 | }, |
111 | 111 | (string) preg_replace('/(?<!{){(?!{)<\/w:t>[\s\S]*?<w:t>{/', '{%', $variables) |
@@ -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 |
@@ -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 | * {@inheritodc} |
59 | 58 | */ |
@@ -31,49 +31,49 @@ |
||
31 | 31 | ); |
32 | 32 | |
33 | 33 | $l->setTemplateFile(dirname(__FILE__) . '/invoice.docx') |
34 | - ->setData([ |
|
35 | - 'company' => [ |
|
36 | - 'name' => 'Galaxy Finance', |
|
37 | - 'address' => 'PK 15 Road of Boali', |
|
38 | - 'phone' => '+236-72000000', |
|
39 | - ], |
|
40 | - 'customer' => [ |
|
41 | - 'name' => 'Banabool Kitoko', |
|
42 | - 'phone' => '+236-75111111', |
|
43 | - 'email' => '[email protected]', |
|
44 | - ], |
|
45 | - 'invoice' => [ |
|
46 | - 'no' => '2021090500033', |
|
47 | - 'date' => '2021-09-05 11:25:08', |
|
48 | - 'sub_total' => '3,450 FCFA', |
|
49 | - 'tax' => '19 %', |
|
50 | - 'total_amount' => '4,105 FCFA', |
|
51 | - 'due_days' => 15, |
|
52 | - ], |
|
53 | - 'items' => [ |
|
54 | - [ |
|
55 | - 'no' => 1, |
|
56 | - 'name' => 'Savon', |
|
57 | - 'price' => 250, |
|
58 | - 'quantity' => 2, |
|
59 | - 'total' => 500, |
|
60 | - ], |
|
61 | - [ |
|
62 | - 'no' => 2, |
|
63 | - 'name' => 'Sucre', |
|
64 | - 'price' => 500, |
|
65 | - 'quantity' => 5, |
|
66 | - 'total' => 2500, |
|
67 | - ], |
|
68 | - [ |
|
69 | - 'no' => 3, |
|
70 | - 'name' => 'Omo', |
|
71 | - 'price' => 150, |
|
72 | - 'quantity' => 3, |
|
73 | - 'total' => 450, |
|
74 | - ] |
|
75 | - ], |
|
76 | - ]); |
|
34 | + ->setData([ |
|
35 | + 'company' => [ |
|
36 | + 'name' => 'Galaxy Finance', |
|
37 | + 'address' => 'PK 15 Road of Boali', |
|
38 | + 'phone' => '+236-72000000', |
|
39 | + ], |
|
40 | + 'customer' => [ |
|
41 | + 'name' => 'Banabool Kitoko', |
|
42 | + 'phone' => '+236-75111111', |
|
43 | + 'email' => '[email protected]', |
|
44 | + ], |
|
45 | + 'invoice' => [ |
|
46 | + 'no' => '2021090500033', |
|
47 | + 'date' => '2021-09-05 11:25:08', |
|
48 | + 'sub_total' => '3,450 FCFA', |
|
49 | + 'tax' => '19 %', |
|
50 | + 'total_amount' => '4,105 FCFA', |
|
51 | + 'due_days' => 15, |
|
52 | + ], |
|
53 | + 'items' => [ |
|
54 | + [ |
|
55 | + 'no' => 1, |
|
56 | + 'name' => 'Savon', |
|
57 | + 'price' => 250, |
|
58 | + 'quantity' => 2, |
|
59 | + 'total' => 500, |
|
60 | + ], |
|
61 | + [ |
|
62 | + 'no' => 2, |
|
63 | + 'name' => 'Sucre', |
|
64 | + 'price' => 500, |
|
65 | + 'quantity' => 5, |
|
66 | + 'total' => 2500, |
|
67 | + ], |
|
68 | + [ |
|
69 | + 'no' => 3, |
|
70 | + 'name' => 'Omo', |
|
71 | + 'price' => 150, |
|
72 | + 'quantity' => 3, |
|
73 | + 'total' => 450, |
|
74 | + ] |
|
75 | + ], |
|
76 | + ]); |
|
77 | 77 | $l->process(); |
78 | 78 | $l->convert(); |
79 | 79 |