From c57765d206c68ef76465f54dd3fe0414f08b0e34 Mon Sep 17 00:00:00 2001 From: Kayla Daniels Date: Sat, 18 Jun 2016 03:21:25 -0400 Subject: [PATCH 1/5] ensure encrypter exists --- src/Illuminate/Queue/Queue.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index b1588911572d..596845713539 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -4,6 +4,7 @@ use Closure; use DateTime; +use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Support\Arr; use SuperClosure\Serializer; use Illuminate\Container\Container; @@ -19,6 +20,11 @@ abstract class Queue */ protected $container; + /** + * @var \Illuminate\Contracts\Encryption\Encrypter + */ + protected $crypt; + /** * Push a new job onto the queue. * @@ -144,7 +150,7 @@ protected function prepareQueueableEntity($value) */ protected function createClosurePayload($job, $data) { - $closure = $this->crypt->encrypt((new Serializer)->serialize($job)); + $closure = $this->getEncrypter()->encrypt((new Serializer)->serialize($job)); return ['job' => 'IlluminateQueueClosure', 'data' => compact('closure')]; } @@ -210,4 +216,20 @@ public function setEncrypter(EncrypterContract $crypt) { $this->crypt = $crypt; } + + + /** + * @return EncrypterContract + * + * @throws EncryptException + */ + public function getEncrypter() + { + if (null === $this->crypt) { + throw new EncryptException("No encrypter set for Queue"); + } + + return $this->crypt; + } + } From f77e1d72668d40831128fab55b44811759471411 Mon Sep 17 00:00:00 2001 From: Kayla Daniels Date: Sat, 18 Jun 2016 03:23:45 -0400 Subject: [PATCH 2/5] fix whitespace --- src/Illuminate/Queue/Queue.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index 596845713539..7acf95029878 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -217,7 +217,6 @@ public function setEncrypter(EncrypterContract $crypt) $this->crypt = $crypt; } - /** * @return EncrypterContract * From ea17d24d5e7387dcc369e2cf910d16c22ea6e53a Mon Sep 17 00:00:00 2001 From: Kayla Daniels Date: Sat, 18 Jun 2016 03:28:33 -0400 Subject: [PATCH 3/5] styling --- src/Illuminate/Queue/Queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index 7acf95029878..7b190178dd41 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -225,7 +225,7 @@ public function setEncrypter(EncrypterContract $crypt) public function getEncrypter() { if (null === $this->crypt) { - throw new EncryptException("No encrypter set for Queue"); + throw new EncryptException('No encrypter set for Queue'); } return $this->crypt; From 6177b9f5c5c9a1b370410272592f096e157e11af Mon Sep 17 00:00:00 2001 From: Kayla Daniels Date: Sat, 18 Jun 2016 03:28:59 -0400 Subject: [PATCH 4/5] styling --- src/Illuminate/Queue/Queue.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index 7b190178dd41..5e8eff43db00 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -230,5 +230,4 @@ public function getEncrypter() return $this->crypt; } - } From 5c4595a6727ab9f7b1a8993978a11cdf9de7aacc Mon Sep 17 00:00:00 2001 From: Kayla Daniels Date: Sat, 18 Jun 2016 03:29:51 -0400 Subject: [PATCH 5/5] change method to protected --- src/Illuminate/Queue/Queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index 5e8eff43db00..1b792f17d71d 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -222,7 +222,7 @@ public function setEncrypter(EncrypterContract $crypt) * * @throws EncryptException */ - public function getEncrypter() + protected function getEncrypter() { if (null === $this->crypt) { throw new EncryptException('No encrypter set for Queue');