forked from niklasravnsborg/laravel-pdf
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made package extendable and PHP version update
- Loading branch information
1 parent
7a89720
commit ea9af48
Showing
19 changed files
with
437 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
# IDE | ||
.idea/ | ||
.project/ | ||
nbproject/ | ||
.buildpath/ | ||
.settings/ | ||
*.sublime-* | ||
|
||
# OS | ||
.DS_Store | ||
*.AppleDouble | ||
*.AppleDB | ||
*.AppleDesktop | ||
|
||
# tooling | ||
vendor/ | ||
composer.lock | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<policy domain="coder" rights="read|write" pattern="PDF" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="vendor/autoload.php" backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace misterspelik\LaravelPdf; | ||
|
||
use Config; | ||
use misterspelik\LaravelPdf\Wrapper\PdfWrapper; | ||
use misterspelik\LaravelPdf\Wrapper\PdfWrapperInterface; | ||
|
||
class LaravelPdfFactory | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected const PDF_WRAPPER_CONFIG_KEY = 'pdfWrapper'; | ||
|
||
/** | ||
* @return \misterspelik\LaravelPdf\Wrapper\PdfWrapperInterface | ||
*/ | ||
public function createPdfWrapper(): PdfWrapperInterface | ||
{ | ||
$class = $this->getConfigKey(static::PDF_WRAPPER_CONFIG_KEY); | ||
if ($class !== null) { | ||
return new $class; | ||
} | ||
|
||
return new PdfWrapper(); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* | ||
* @return mixed | ||
*/ | ||
protected function getConfigKey(string $key) | ||
{ | ||
return Config::get('pdf.' . $key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.