Skip to content

Commit

Permalink
non-composer updates
Browse files Browse the repository at this point in the history
  • Loading branch information
maztch committed May 15, 2017
1 parent 2a1dfab commit 81280ef
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 36 deletions.
64 changes: 31 additions & 33 deletions init.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
<?php

//Ilovepdf
require_once dirname(__FILE__) . '/src/Ilovepdf.php';
require_once dirname(__FILE__) . '/src/Task.php';


//Specific processes
require_once dirname(__FILE__) . '/src/CompressTask.php';
require_once dirname(__FILE__) . '/src/ImagepdfTask.php';
require_once dirname(__FILE__) . '/src/MergeTask.php';
require_once dirname(__FILE__) . '/src/OfficepdfTask.php';
require_once dirname(__FILE__) . '/src/PagenumberTask.php';
require_once dirname(__FILE__) . '/src/PdfaTask.php';
require_once dirname(__FILE__) . '/src/PdfjpgTask.php';
require_once dirname(__FILE__) . '/src/ProtectTask.php';
require_once dirname(__FILE__) . '/src/RepairTask.php';
require_once dirname(__FILE__) . '/src/RotateTask.php';
require_once dirname(__FILE__) . '/src/SplitTask.php';
require_once dirname(__FILE__) . '/src/UnlockTask.php';
require_once dirname(__FILE__) . '/src/WatermarkTask.php';
//Helpers
require_once __DIR__ . '/src/JWT.php';
require_once __DIR__ . '/src/File.php';
require_once __DIR__ . '/src/Method.php';
require_once __DIR__ . '/src/Response.php';
require_once __DIR__ . '/src/Request.php';
require_once __DIR__ . '/src/Request/Body.php';

//Exceptions
require_once __DIR__ . '/src/Exceptions/ExtendedException.php';
require_once __DIR__ . '/src/Exceptions/DownloadException.php';
require_once __DIR__ . '/src/Exceptions/ProcessException.php';
require_once __DIR__ . '/src/Exceptions/UploadException.php';
require_once __DIR__ . '/src/Exceptions/StartException.php';
require_once __DIR__ . '/src/Exceptions/AuthException.php';

//Helpers
require_once dirname(__FILE__) . '/src/JWT.php';
require_once dirname(__FILE__) . '/src/File.php';
require_once dirname(__FILE__) . '/src/Method.php';
require_once dirname(__FILE__) . '/src/Response.php';
require_once dirname(__FILE__) . '/src/Request.php';
require_once dirname(__FILE__) . '/src/Request/Body.php';
//Ilovepdf
require_once __DIR__ . '/src/Ilovepdf.php';
require_once __DIR__ . '/src/Task.php';

//Specific processes
require_once __DIR__ . '/src/CompressTask.php';
require_once __DIR__ . '/src/ImagepdfTask.php';
require_once __DIR__ . '/src/MergeTask.php';
require_once __DIR__ . '/src/OfficepdfTask.php';
require_once __DIR__ . '/src/PagenumberTask.php';
require_once __DIR__ . '/src/PdfaTask.php';
require_once __DIR__ . '/src/PdfjpgTask.php';
require_once __DIR__ . '/src/ProtectTask.php';
require_once __DIR__ . '/src/RepairTask.php';
require_once __DIR__ . '/src/RotateTask.php';
require_once __DIR__ . '/src/SplitTask.php';
require_once __DIR__ . '/src/UnlockTask.php';
require_once __DIR__ . '/src/WatermarkTask.php';

//Exceptions
require_once dirname(__FILE__) . '/src/Exceptions/ExtendedException.php';
require_once dirname(__FILE__) . '/src/Exceptions/DownloadException.php';
require_once dirname(__FILE__) . '/src/Exceptions/ProcessException.php';
require_once dirname(__FILE__) . '/src/Exceptions/UploadException.php';
require_once dirname(__FILE__) . '/src/Exceptions/StartException.php';
require_once dirname(__FILE__) . '/src/Exceptions/AuthException.php';
8 changes: 6 additions & 2 deletions src/Exceptions/ExtendedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Ilovepdf\Exceptions;

class ExtendedException extends \Exception
use Exception;

class ExtendedException extends Exception
{

private $params;
Expand All @@ -17,7 +19,9 @@ class ExtendedException extends \Exception
*/
public function __construct($message, $code = 0, Exception $previous = null, $response)
{
$this->type = $response->body->error->type;
if(isset($response->body->error) && $response->body->error->type){
$this->type = $response->body->error->type;
}
if (isset($response->body->error->param)) {
$this->params = $response->body->error->param;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ilovepdf;

use Ilovepdf\Exceptions\StartException;
use Ilovepdf\Request\Body;

/**
* Class Ilovepdf
Expand Down Expand Up @@ -32,7 +33,7 @@ function __construct($publicKey, $secretKey)
{
parent::__construct($publicKey, $secretKey);
$data = array('v'=> self::VERSION);
$body = Request\Body::Form($data);
$body = Body::Form($data);
$response = parent::sendRequest('get', 'start/' . $this->tool, $body);
if (empty($response->body->server)) {
throw new StartException('no server assigned on start');
Expand Down

0 comments on commit 81280ef

Please sign in to comment.