From a951a8d9859ac78f2b993d72cf8c670dd51af6f7 Mon Sep 17 00:00:00 2001 From: Steffen Persch Date: Wed, 11 May 2016 00:10:58 +0200 Subject: [PATCH 1/8] remove string from parameter class --- src/PrintNode/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintNode/Request.php b/src/PrintNode/Request.php index 5727991..6f772b9 100755 --- a/src/PrintNode/Request.php +++ b/src/PrintNode/Request.php @@ -489,7 +489,7 @@ public function getPrintJobsByPrinters() * @param string $computerId id of computer to find scales * @return Entity[] * */ - public function getScales(string $computerId) + public function getScales($computerId) { $endPointUrl = $this->apiurl."/computer/"; $endPointUrl.= $computerId; From 9493f4f0a6b24e9b0e237f34660db2ff11bfca3e Mon Sep 17 00:00:00 2001 From: Steffen Persch Date: Wed, 11 May 2016 00:11:13 +0200 Subject: [PATCH 2/8] fix typo --- src/PrintNode/Scale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintNode/Scale.php b/src/PrintNode/Scale.php index 3b60eb3..6fee6e1 100755 --- a/src/PrintNode/Scale.php +++ b/src/PrintNode/Scale.php @@ -29,7 +29,7 @@ class Scale extends Entity protected $port; protected $count; protected $measurement; - protected $clientReprotedCreateTimestamp; + protected $clientReportedCreateTimestamp; protected $ntpOffset; protected $ageOfData; protected $computerId; From e0efed36491a99eb3119245791ffe87dd86b2e02 Mon Sep 17 00:00:00 2001 From: Steffen Persch Date: Wed, 11 May 2016 00:11:25 +0200 Subject: [PATCH 3/8] proper DateTime reference --- src/PrintNode/Scale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintNode/Scale.php b/src/PrintNode/Scale.php index 6fee6e1..4f6af81 100755 --- a/src/PrintNode/Scale.php +++ b/src/PrintNode/Scale.php @@ -13,7 +13,7 @@ * @property-read string $port * @property-read int $count * @property-read int[string] $measurement - * @property-read DateTime $clientReportedCreateTimestamp + * @property-read \DateTime $clientReportedCreateTimestamp * @property-read string $ntpOffset * @property-read int $ageOfData * @property-read int $computerId From a245277d8bda6a6494b304f47e92ae31179a4a8a Mon Sep 17 00:00:00 2001 From: Steffen Persch Date: Mon, 16 May 2016 06:24:11 +0200 Subject: [PATCH 4/8] [REF] InvalidArgumentException namespace --- src/PrintNode/Request.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PrintNode/Request.php b/src/PrintNode/Request.php index 6f772b9..62cb9f3 100755 --- a/src/PrintNode/Request.php +++ b/src/PrintNode/Request.php @@ -522,7 +522,7 @@ public function getPrintersByComputers() $arguments = func_get_args(); if (count($arguments) > 2) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( sprintf( 'Too many arguments given to getPrintersByComputers.' ) @@ -570,7 +570,7 @@ public function __call($methodName, $arguments) $arguments = array_shift($arguments); if (!is_string($arguments)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( sprintf( 'Invalid argument type passed to %s. Expecting a string got %s', $methodName, @@ -614,7 +614,7 @@ public function __call($methodName, $arguments) public function patch(Entity $entity) { if (!($entity instanceof Entity)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( sprintf( 'Invalid argument type passed to patch. Expecting Entity got %s', gettype($entity) @@ -644,7 +644,7 @@ public function patch(Entity $entity) public function post(Entity $entity) { if (!($entity instanceof Entity)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( sprintf( 'Invalid argument type passed to patch. Expecting Entity got %s', gettype($entity) @@ -677,7 +677,7 @@ public function put() $entity = array_shift($arguments); if (!($entity instanceof Entity)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( sprintf( 'Invalid argument type passed to patch. Expecting Entity got %s', gettype($entity) From a64c576535258e014b3b782d2388c3a9c28dcadc Mon Sep 17 00:00:00 2001 From: Ben Lippincott Date: Tue, 28 Jun 2016 10:18:17 -0400 Subject: [PATCH 5/8] Fixed typo emailpassword should be emailPassword --- src/PrintNode/Credentials.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintNode/Credentials.php b/src/PrintNode/Credentials.php index 571375a..1f11a8a 100755 --- a/src/PrintNode/Credentials.php +++ b/src/PrintNode/Credentials.php @@ -35,7 +35,7 @@ public function setEmailPassword($email, $password) "ApiKey already set." ); } - $this->emailpassword = $email.': '.$password; + $this->emailPassword = $email.': '.$password; return $this; } From fff7052381a566ab0550a7857c6473c2e740662a Mon Sep 17 00:00:00 2001 From: Luke Cousins Date: Tue, 25 Apr 2017 09:26:13 +0100 Subject: [PATCH 6/8] Adding ability to add options (such as copies) --- src/PrintNode/PrintJob.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PrintNode/PrintJob.php b/src/PrintNode/PrintJob.php index 610713c..42ca00f 100755 --- a/src/PrintNode/PrintJob.php +++ b/src/PrintNode/PrintJob.php @@ -13,6 +13,7 @@ * @property string $contentType * @property string $content * @property string $source + * @property string $options * @property-read int $filesize * @property-read DateTime $createTimestamp * @property-read string $state @@ -29,6 +30,7 @@ class PrintJob extends Entity protected $createTimestamp; protected $state; protected $expireAt; + protected $options; public function foreignKeyEntityMap() { From 5ef5f88a3365045e5f54aea19848efcf7774d50b Mon Sep 17 00:00:00 2001 From: Luke Cousins Date: Tue, 25 Apr 2017 09:29:56 +0100 Subject: [PATCH 7/8] Correcting doc comment --- src/PrintNode/PrintJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintNode/PrintJob.php b/src/PrintNode/PrintJob.php index 42ca00f..70932ae 100755 --- a/src/PrintNode/PrintJob.php +++ b/src/PrintNode/PrintJob.php @@ -13,7 +13,7 @@ * @property string $contentType * @property string $content * @property string $source - * @property string $options + * @property array $options * @property-read int $filesize * @property-read DateTime $createTimestamp * @property-read string $state From 98acbf55bd6c3fd38024895455d1feeb29019150 Mon Sep 17 00:00:00 2001 From: Simon Tiplady <62300999+shakethatweight-simon@users.noreply.github.com> Date: Mon, 23 Nov 2020 13:44:15 +0000 Subject: [PATCH 8/8] Typehinting highlighted a problem with example 1. Fixes the following error ```Fatal error: Uncaught TypeError: Argument 1 passed to PrintNode\Request::__construct() must be an instance of PrintNode\Credentials, instance of PrintNode\ApiKey given, called in my-file.php on line 13 and defined in vendor/printnode/printnode-php/src/PrintNode/Request.php:85 Stack trace: #0 /var/www/vhosts/shakepack.co.uk/public/printnode.php(13): PrintNode\Request->__construct(Object(PrintNode\ApiKey)) #1 {main} thrown in /var/www/vhosts/shakepack.co.uk/vendor/printnode/printnode-php/src/PrintNode/Request.php on line 85``` --- examples/example-1-submitting-a-printjob.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/example-1-submitting-a-printjob.php b/examples/example-1-submitting-a-printjob.php index 3baefc0..5a8553a 100644 --- a/examples/example-1-submitting-a-printjob.php +++ b/examples/example-1-submitting-a-printjob.php @@ -11,9 +11,8 @@ // You first need to establish a connection to PrintNode. // This can be done by using a PrintNode\ApiKey instance using your api-key. -$credentials = new PrintNode\ApiKey( - PRINTNODE_APIKEY -); +$credentials = new PrintNode\Credentials(); +$credentials->setApiKey($config['PRINTNODE_APIKEY']); // Hint: Your API username is in the format description.integer, where description // is the name given to the API key when you created it, followed by a dot (.) and an integer.