Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
sten committed Mar 14, 2024
2 parents c4d0319 + 4db5da6 commit 5a4a433
Show file tree
Hide file tree
Showing 11 changed files with 344 additions and 340 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.6
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `statikbe/laravel-puppeteer-pdf-converter` will be documented in this file.

## v1.2.0 - 2023-04-05

Laravel 10 support

## v1.1.0 - 2022-10-11

- Fix bug in convertRoute to pass PdfOptions
Expand Down
20 changes: 10 additions & 10 deletions src/Exceptions/ConfigurationException.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

class ConfigurationException extends \Exception
{
public string $field;
class ConfigurationException extends \Exception
{
public string $field;

public static function create(string $field): self
{
$exception = new ConfigurationException("The Laravel Puppeteer PDF Converter library is not properly configured. Check if $field is properly configured.");
$exception->field = $field;
public static function create(string $field): self
{
$exception = new ConfigurationException("The Laravel Puppeteer PDF Converter library is not properly configured. Check if $field is properly configured.");
$exception->field = $field;

return $exception;
}
return $exception;
}
}
20 changes: 10 additions & 10 deletions src/Exceptions/ConversionException.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

/**
* If an error occurs during the PDF conversion, this error is thrown.
* Class ConversionException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/
/**
* If an error occurs during the PDF conversion, this error is thrown.
* Class ConversionException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/


class ConversionException extends PdfApiException
{
public const API_ERROR_TYPE = 'CONVERSION_ERROR';
}
class ConversionException extends PdfApiException
{
public const API_ERROR_TYPE = 'CONVERSION_ERROR';
}
8 changes: 4 additions & 4 deletions src/Exceptions/InvalidMarginUnitException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

class InvalidMarginUnitException extends \Exception
{
}
class InvalidMarginUnitException extends \Exception
{
}
18 changes: 9 additions & 9 deletions src/Exceptions/PdfApiException.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

class PdfApiException extends \Exception
class PdfApiException extends \Exception
{
public function setApiError(array $apiErrorFields): self
{
public function setApiError(array $apiErrorFields): self
{
if (array_key_exists('message', $apiErrorFields)) {
$this->message = $apiErrorFields['message'];
}

return $this;
if (array_key_exists('message', $apiErrorFields)) {
$this->message = $apiErrorFields['message'];
}

return $this;
}
}
20 changes: 10 additions & 10 deletions src/Exceptions/TimeoutException.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

/**
* If the PDF conversion API times out, this exception is thrown.
* Class TimeoutException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/
/**
* If the PDF conversion API times out, this exception is thrown.
* Class TimeoutException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/


class TimeoutException extends PdfApiException
{
public const API_ERROR_TYPE = 'TIMEOUT_ERROR';
}
class TimeoutException extends PdfApiException
{
public const API_ERROR_TYPE = 'TIMEOUT_ERROR';
}
56 changes: 28 additions & 28 deletions src/Exceptions/UnsuccessfulHttpResponseException.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<?php

namespace Statikbe\PuppeteerPdfConverter\Exceptions;

/**
* If the web page that needs to be converted to PDF returns an HTTP status code that is not successful (i.e. 2xx),
* this exception is thrown.
*
* Class UnsuccessfulHttpResponseException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/
namespace Statikbe\PuppeteerPdfConverter\Exceptions;

/**
* If the web page that needs to be converted to PDF returns an HTTP status code that is not successful (i.e. 2xx),
* this exception is thrown.
*
* Class UnsuccessfulHttpResponseException
* @package Statikbe\PuppeteerPdfConverter\Exceptions
*/

class UnsuccessfulHttpResponseException extends PdfApiException
{
public const API_ERROR_TYPE = 'UNSUCCESSFUL_HTTP_RESPONSE';

protected $websiteStatusCode = null;
class UnsuccessfulHttpResponseException extends PdfApiException
{
public const API_ERROR_TYPE = 'UNSUCCESSFUL_HTTP_RESPONSE';

public function setApiError(array $apiErrorFields): parent
{
parent::setApiError($apiErrorFields);
if (array_key_exists('websiteStatusCode', $apiErrorFields)) {
$this->websiteStatusCode = $apiErrorFields['websiteStatusCode'];
}
protected $websiteStatusCode = null;

return $this;
public function setApiError(array $apiErrorFields): parent
{
parent::setApiError($apiErrorFields);
if (array_key_exists('websiteStatusCode', $apiErrorFields)) {
$this->websiteStatusCode = $apiErrorFields['websiteStatusCode'];
}

/**
* Returns the HTTP status code that was returned by the webpage url that was requested to be converted.
* @return int
*/
public function getWebsiteStatusCode(): int
{
return $this->websiteStatusCode;
}
return $this;
}

/**
* Returns the HTTP status code that was returned by the webpage url that was requested to be converted.
* @return int
*/
public function getWebsiteStatusCode(): int
{
return $this->websiteStatusCode;
}
}
Loading

0 comments on commit 5a4a433

Please sign in to comment.