File tree Expand file tree Collapse file tree 6 files changed +35
-19
lines changed Expand file tree Collapse file tree 6 files changed +35
-19
lines changed Original file line number Diff line number Diff line change 6
6
/pdf-parser /var
7
7
/.phpunit.result.cache
8
8
.php_cs.cache
9
- composer.lock
9
+ composer.lock
10
+ /.php-cs-fixer.cache
Original file line number Diff line number Diff line change 5
5
->in (__DIR__ . '/src ' )
6
6
;
7
7
8
- return PhpCsFixer \Config::create ()
9
- ->setRules ([
10
- '@PSR2 ' => true ,
8
+ $ config = new PhpCsFixer \Config ();
9
+ return $ config ->setRules ([
11
10
'@Symfony ' => true ,
12
- //'strict_param' => true,
13
- 'cast_spaces ' => ['space ' => 'none ' ],
14
- 'array_syntax ' => ['syntax ' => 'short ' ],
15
- 'no_unneeded_curly_braces ' => false ,
16
- 'no_unset_on_property ' => false ,
17
- 'php_unit_method_casing ' => ['case ' => 'snake_case ' ],
18
- 'phpdoc_align ' => ['align ' => 'left ' ],
11
+
12
+ /*
13
+ * Personal opinion.
14
+ */
19
15
'yoda_style ' => false ,
16
+ 'phpdoc_align ' => ['align ' => 'left ' ],
17
+ 'php_unit_method_casing ' => ['case ' => 'snake_case ' ],
18
+
20
19
])
21
20
->setFinder ($ finder )
22
- ;
21
+ ;
Original file line number Diff line number Diff line change 16
16
"minimum-stability" : " stable" ,
17
17
"require" : {
18
18
"laravel/framework" : " ^7.0 || ^8.0" ,
19
- "typesetsh/typesetsh" : " ^0.18 "
19
+ "typesetsh/typesetsh" : " ^0.19 "
20
20
},
21
21
"require-dev" : {
22
- "friendsofphp/php-cs-fixer" : " ^2.16 "
22
+ "friendsofphp/php-cs-fixer" : " ~v3.4.0 "
23
23
},
24
24
"autoload" : {
25
25
"psr-4" : {
Original file line number Diff line number Diff line change 23
23
|
24
24
| The base directory to use for relative paths.
25
25
|
26
+ | Use public_path() to convert any /some-file.css to your public directory.
27
+ | Use an empty '' string if you prefer absolute paths in your source.
28
+ |
29
+ | Make sure the paths you pick are inside the allowed_directories.
26
30
*/
27
31
28
- 'base_dir ' => '/ ' ,
32
+ 'base_dir ' => '' ,
29
33
30
34
/*
31
35
|--------------------------------------------------------------------------
Original file line number Diff line number Diff line change 13
13
14
14
class ServiceProvider extends Support \ServiceProvider implements Contracts \Support \DeferrableProvider
15
15
{
16
- const CONFIG_PATH = __DIR__ .'/../config/typesetsh.php ' ;
16
+ public const CONFIG_PATH = __DIR__ .'/../config/typesetsh.php ' ;
17
17
18
18
/**
19
19
* Register the service provider.
@@ -39,9 +39,9 @@ protected function registerPdfRenderer(): void
39
39
$ baseDir = $ app ['config ' ]['typesetsh.base_dir ' ] ?? [];
40
40
$ allowProtocols = $ app ['config ' ]['typesetsh.allowed_protocols ' ] ?? [];
41
41
$ cacheDir = $ app ['config ' ]['typesetsh.cache_dir ' ] ?? null ;
42
- $ timeout = (int )($ app ['config ' ]['typesetsh.timeout ' ] ?? 15 );
43
- $ downloadLimit = (int )($ app ['config ' ]['typesetsh.download_limit ' ] ?? 1024 * 1024 * 5 );
44
- $ pdfVersion = (string )($ app ['config ' ]['typesetsh.pdf_version ' ] ?? '1.6 ' );
42
+ $ timeout = (int ) ($ app ['config ' ]['typesetsh.timeout ' ] ?? 15 );
43
+ $ downloadLimit = (int ) ($ app ['config ' ]['typesetsh.download_limit ' ] ?? 1024 * 1024 * 5 );
44
+ $ pdfVersion = (string ) ($ app ['config ' ]['typesetsh.pdf_version ' ] ?? '1.6 ' );
45
45
46
46
$ schemes = [];
47
47
$ schemes ['data ' ] = new UriResolver \Data ($ cacheDir );
Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ public function render(string $html): Result
37
37
$ result = $ this ->html2pdf ->render ($ html , $ this ->uriResolver );
38
38
$ result ->version = $ this ->version ;
39
39
40
+ // Append any issues from URI resolver to result
41
+ if ($ this ->uriResolver instanceof UriResolver && $ this ->uriResolver ->errors ) {
42
+ array_push ($ result ->issues , ...$ this ->uriResolver ->errors );
43
+ $ this ->uriResolver ->errors = [];
44
+ }
45
+
40
46
return $ result ;
41
47
}
42
48
@@ -48,6 +54,12 @@ public function renderMultiple(array $html): Result
48
54
$ result = $ this ->html2pdf ->renderMultiple ($ html , $ this ->uriResolver );
49
55
$ result ->version = $ this ->version ;
50
56
57
+ // Append any issues from URI resolver to result
58
+ if ($ this ->uriResolver instanceof UriResolver && $ this ->uriResolver ->errors ) {
59
+ array_push ($ result ->issues , ...$ this ->uriResolver ->errors );
60
+ $ this ->uriResolver ->errors = [];
61
+ }
62
+
51
63
return $ result ;
52
64
}
53
65
}
You can’t perform that action at this time.
0 commit comments