File tree Expand file tree Collapse file tree 5 files changed +18
-13
lines changed
Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 77use KnpLabs \Snappy \Core \FileToPdf ;
88use KnpLabs \Snappy \Core \StringToPdf ;
99use Psr \Http \Message \StreamInterface ;
10- use SplFileInfo ;
1110
1211final class FromFileToStringToPdf implements FileToPdf
1312{
1413 public function __construct (private StringToPdf $ stringToPdf )
1514 {
1615 }
1716
18- public function generate ( SplFileInfo $ file , ArrayAccess |array $ options = []): StreamInterface
17+ public function generateFromFile ( \ SplFileInfo $ file , \ ArrayAccess |array $ options = []): StreamInterface
1918 {
20- return $ this ->stringToPdf ->generate (
19+ return $ this ->stringToPdf ->generateFromString (
2120 file_get_contents ($ file ->getPathname ()),
2221 $ options ,
2322 );
Original file line number Diff line number Diff line change 77use KnpLabs \Snappy \Core \FileToPdf ;
88use KnpLabs \Snappy \Core \StringToPdf ;
99use Psr \Http \Message \StreamInterface ;
10- use SplFileInfo ;
1110
1211final class FromStringToFileToPdf implements StringToPdf
1312{
1413 public function __construct (private FileToPdf $ fileToPdf )
1514 {
1615 }
1716
18- public function generate (string $ html , ArrayAccess |array $ options = []): StreamInterface
17+ public function generateFromString (string $ html , \ ArrayAccess |array $ options = []): StreamInterface
1918 {
2019 $ path = tempnam (sys_get_temp_dir (), 'snappy_ ' );
2120
2221 try {
2322 file_put_contents ($ path , $ html );
2423
25- $ file = new SplFileInfo ($ path );
24+ $ file = new \ SplFileInfo ($ path );
2625
27- $ stream = $ this ->fileToPdf ->generate ($ file , $ options );
26+ $ stream = $ this ->fileToPdf ->generateFromFile ($ file , $ options );
2827 } finally {
2928 unlink ($ path );
3029 }
Original file line number Diff line number Diff line change 22
33namespace KnpLabs \Snappy \Core ;
44
5- use ArrayAccess ;
65use Psr \Http \Message \StreamInterface ;
7- use SplFileInfo ;
86
97interface FileToPdf
108{
11- public function generate ( SplFileInfo $ file , ArrayAccess |array $ options = []): StreamInterface ;
9+ public function generateFromFile ( \ SplFileInfo $ file , \ ArrayAccess |array $ options = []): StreamInterface ;
1210}
Original file line number Diff line number Diff line change 22
33namespace KnpLabs \Snappy \Core ;
44
5- use ArrayAccess ;
65use Psr \Http \Message \StreamInterface ;
7- use SplFileInfo ;
86
97interface StringToPdf
108{
11- public function generate (string $ html , ArrayAccess |array $ options = []): StreamInterface ;
9+ public function generateFromString (string $ html , \ ArrayAccess |array $ options = []): StreamInterface ;
1210}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace KnpLabs \Snappy \Core ;
4+
5+ use Psr \Http \Message \StreamInterface ;
6+ use Psr \Http \Message \UriInterface ;
7+
8+ interface UriToPdf
9+ {
10+ public function generateFromUri (UriInterface $ url , \ArrayAccess |array $ options = []): StreamInterface ;
11+ }
You can’t perform that action at this time.
0 commit comments