Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added abstract isUsable methode to AbstractPdfCreator
- Loading branch information
Showing
6 changed files
with
97 additions
and
16 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
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
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,52 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2021 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\PdfCreator\Exception; | ||
|
||
use Throwable; | ||
|
||
class MissingDependenciesException extends \Exception | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $type; | ||
/** | ||
* @var array | ||
*/ | ||
protected $dependencies; | ||
|
||
public function __construct(string $type, array $dependencies = [], $message = '', $code = 0, Throwable $previous = null) | ||
{ | ||
if (empty($message)) { | ||
$message = 'There are missing dependencies the %type% pdf creator type needs to work. %dependencies%'; | ||
} | ||
|
||
$message = str_replace('%type%', $type, $message); | ||
|
||
if (!empty($dependencies)) { | ||
$message = str_replace('%dependencies%', "\nMissing dependencies:\n".implode("\n", $dependencies), $message); | ||
} else { | ||
$message = trim(str_replace('%dependencies%', '', $message)); | ||
} | ||
|
||
parent::__construct($message, $code, $previous); | ||
$this->type = $type; | ||
$this->dependencies = $dependencies; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function getDependencies(): array | ||
{ | ||
return $this->dependencies; | ||
} | ||
} |
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