improve code

This commit is contained in:
Daniel Seifert 2020-06-02 10:12:35 +02:00
bovenliggende efdc63225e
commit 895ea19f89
Getekend door: DanielS
GPG sleutel-ID: 8A7C4C6ED1915C6F
4 gewijzigde bestanden met toevoegingen van 12 en 8 verwijderingen

Bestand weergeven

@ -36,19 +36,17 @@ class orderOverviewPdfGenerator
*/
public function generatePdf(Order $order, $sFilename, $iSelLang = 0, $target = 'I')
{
$Pdf= $this->getPdfClass($order);
$Pdf= $this->getPdfClass();
$Pdf->setOrder($order);
$Pdf->genPdf($sFilename, $iSelLang, $target);
}
/**
* @param Order $order
*
* @return pdfdocumentsOrderInterface
* @throws noPdfHandlerFoundException
*/
public function getPdfClass(Order $order)
public function getPdfClass()
{
$requestedType = Registry::getRequest()->getRequestParameter('pdftype');

Bestand weergeven

@ -15,9 +15,11 @@
namespace D3\PdfDocuments\Application\Model\Exceptions;
use Exception;
class noBaseObjectSetException extends pdfGeneratorExceptionAbstract
{
public function __construct( $sMessage = "no base object (e.g. order) for pdf generator set", $iCode = 0, \Exception $previous = null )
public function __construct( $sMessage = "no base object (e.g. order) for pdf generator set", $iCode = 0, Exception $previous = null )
{
parent::__construct( $sMessage, $iCode, $previous );
}

Bestand weergeven

@ -15,6 +15,8 @@
namespace D3\PdfDocuments\Application\Model\Exceptions;
use Exception;
class noPdfHandlerFoundException extends pdfGeneratorExceptionAbstract
{
/**
@ -23,9 +25,9 @@ class noPdfHandlerFoundException extends pdfGeneratorExceptionAbstract
* @param $requestId
* @param string $sMessage
* @param int $iCode
* @param \Exception|null $previous
* @param Exception|null $previous
*/
public function __construct( $requestId, $sMessage = "no pdf handler defined for given request id", $iCode = 0, \Exception $previous = null )
public function __construct( $requestId, $sMessage = "no pdf handler defined for given request id", $iCode = 0, Exception $previous = null )
{
$sMessage .= ' "'.$requestId.'"';
parent::__construct( $sMessage, $iCode, $previous );

Bestand weergeven

@ -15,9 +15,11 @@
namespace D3\PdfDocuments\Application\Model\Exceptions;
use Exception;
class wrongPdfGeneratorInterface extends pdfGeneratorExceptionAbstract
{
public function __construct( $requiredInterface, $sMessage = "generator class doesn't fulfilled the interface", $iCode = 0, \Exception $previous = null ) {
public function __construct( $requiredInterface, $sMessage = "generator class doesn't fulfilled the interface", $iCode = 0, Exception $previous = null ) {
$sMessage .= $requiredInterface;