Skip to content

Commit

Permalink
samples and better exception
Browse files Browse the repository at this point in the history
  • Loading branch information
maztch committed Jun 12, 2017
1 parent bfa0d15 commit 0793807
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion samples/protect_basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//if manual installation has been used comment line that requires the autoload and uncomment this line:
//require_once('../init.php');

use Ilovepdf\UnlockTask;
use Ilovepdf\ProtectTask;


// you can call task class directly
Expand Down
2 changes: 1 addition & 1 deletion samples/watermark_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$myTask->setFontFamily("Arial");

// set mode to text
$myTask->setFontStyle("italic");
$myTask->setFontStyle("Italic");

// set the font size
$myTask->setFontSize("12");
Expand Down
5 changes: 3 additions & 2 deletions src/Exceptions/ExtendedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public function __construct($message, $code = 0, Exception $previous = null, $re
if (isset($response->body->error->param)) {
$this->params = $response->body->error->param;
}
if (is_array($this->params) && isset($this->params[0]) && isset($this->params[0]->error)) {
parent::__construct($message . ' (' . $this->params[0]->error . ')', $code, $previous);
if ($this->params) {
$firstError = reset(json_decode(json_encode($this->params), true));
parent::__construct($message . ' (' . $firstError[0] . ')', $code, $previous);
} else {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ilovepdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Ilovepdf
// @var string|null The version of the Ilovepdf API to use for requests.
public static $apiVersion = 'v1';

const VERSION = 'php.1.1.1';
const VERSION = 'php.1.1.2';

public $token = null;

Expand Down

0 comments on commit 0793807

Please sign in to comment.