@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function serialize(array $payload): string |
| 20 | 20 | { |
| 21 | - try { |
|
| 21 | + try{ |
|
| 22 | 22 | return serialize($payload); |
| 23 | - } catch (\Throwable $e) { |
|
| 23 | + }catch (\Throwable $e){ |
|
| 24 | 24 | throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function deserialize(string $payload): array |
| 32 | 32 | { |
| 33 | - try { |
|
| 33 | + try{ |
|
| 34 | 34 | return (array)unserialize($payload); |
| 35 | - } catch (\Throwable $e) { |
|
| 35 | + }catch (\Throwable $e){ |
|
| 36 | 36 | throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -18,9 +18,12 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function serialize(array $payload): string |
| 20 | 20 | { |
| 21 | - try { |
|
| 21 | + try |
|
| 22 | + { |
|
| 22 | 23 | return serialize($payload); |
| 23 | - } catch (\Throwable $e) { |
|
| 24 | + } |
|
| 25 | + catch (\Throwable $e) |
|
| 26 | + { |
|
| 24 | 27 | throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e); |
| 25 | 28 | } |
| 26 | 29 | } |
@@ -30,9 +33,12 @@ discard block |
||
| 30 | 33 | */ |
| 31 | 34 | public function deserialize(string $payload): array |
| 32 | 35 | { |
| 33 | - try { |
|
| 36 | + try |
|
| 37 | + { |
|
| 34 | 38 | return (array)unserialize($payload); |
| 35 | - } catch (\Throwable $e) { |
|
| 39 | + } |
|
| 40 | + catch (\Throwable $e) |
|
| 41 | + { |
|
| 36 | 42 | throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e); |
| 37 | 43 | } |
| 38 | 44 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function getSerializer(string $jobType): SerializerInterface |
| 30 | 30 | { |
| 31 | - if (!$this->hasSerializer($jobType)) { |
|
| 31 | + if (!$this->hasSerializer($jobType)){ |
|
| 32 | 32 | return $this->default; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function addSerializer(string $jobType, SerializerInterface $serializer): void |
| 39 | 39 | { |
| 40 | - if (!$this->hasSerializer($jobType)) { |
|
| 40 | + if (!$this->hasSerializer($jobType)){ |
|
| 41 | 41 | $this->serializers[$jobType] = $serializer; |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -28,7 +28,8 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function getSerializer(string $jobType): SerializerInterface |
| 30 | 30 | { |
| 31 | - if (!$this->hasSerializer($jobType)) { |
|
| 31 | + if (!$this->hasSerializer($jobType)) |
|
| 32 | + { |
|
| 32 | 33 | return $this->default; |
| 33 | 34 | } |
| 34 | 35 | |
@@ -37,7 +38,8 @@ discard block |
||
| 37 | 38 | |
| 38 | 39 | public function addSerializer(string $jobType, SerializerInterface $serializer): void |
| 39 | 40 | { |
| 40 | - if (!$this->hasSerializer($jobType)) { |
|
| 41 | + if (!$this->hasSerializer($jobType)) |
|
| 42 | + { |
|
| 41 | 43 | $this->serializers[$jobType] = $serializer; |
| 42 | 44 | } |
| 43 | 45 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | $result = \serialize($payload); |
| 14 | 14 | |
| 15 | - if ($result === false) { |
|
| 15 | + if ($result === false){ |
|
| 16 | 16 | throw new SerializationException('Failed to serialize data.'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $result = \unserialize($payload); |
| 25 | 25 | |
| 26 | - if ($result === false) { |
|
| 26 | + if ($result === false){ |
|
| 27 | 27 | throw new SerializationException('Failed to unserialize data.'); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -12,7 +12,8 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | $result = \serialize($payload); |
| 14 | 14 | |
| 15 | - if ($result === false) { |
|
| 15 | + if ($result === false) |
|
| 16 | + { |
|
| 16 | 17 | throw new SerializationException('Failed to serialize data.'); |
| 17 | 18 | } |
| 18 | 19 | |
@@ -23,7 +24,8 @@ discard block |
||
| 23 | 24 | { |
| 24 | 25 | $result = \unserialize($payload); |
| 25 | 26 | |
| 26 | - if ($result === false) { |
|
| 27 | + if ($result === false) |
|
| 28 | + { |
|
| 27 | 29 | throw new SerializationException('Failed to unserialize data.'); |
| 28 | 30 | } |
| 29 | 31 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | $config = $container->get(QueueConfig::class); |
| 63 | 63 | $serializersRegistry = $container->get(SerializerRegistryInterface::class); |
| 64 | 64 | |
| 65 | - foreach ($config->getRegistryHandlers() as $jobType => $handler) { |
|
| 65 | + foreach ($config->getRegistryHandlers() as $jobType => $handler){ |
|
| 66 | 66 | $registry->setHandler($jobType, $handler); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - foreach ($config->getRegistrySerializers() as $jobType => $serializer) { |
|
| 70 | - if ($serializer instanceof Autowire || \is_string($serializer)) { |
|
| 69 | + foreach ($config->getRegistrySerializers() as $jobType => $serializer){ |
|
| 70 | + if ($serializer instanceof Autowire || \is_string($serializer)){ |
|
| 71 | 71 | $serializer = $container->get($serializer); |
| 72 | 72 | } |
| 73 | 73 | $serializersRegistry->addSerializer($jobType, $serializer); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $default = $config->getDefaultSerializer(); |
| 99 | 99 | |
| 100 | - if ($default instanceof Autowire || \is_string($default)) { |
|
| 100 | + if ($default instanceof Autowire || \is_string($default)){ |
|
| 101 | 101 | $default = $container->get($default); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -62,12 +62,15 @@ discard block |
||
| 62 | 62 | $config = $container->get(QueueConfig::class); |
| 63 | 63 | $serializersRegistry = $container->get(SerializerRegistryInterface::class); |
| 64 | 64 | |
| 65 | - foreach ($config->getRegistryHandlers() as $jobType => $handler) { |
|
| 65 | + foreach ($config->getRegistryHandlers() as $jobType => $handler) |
|
| 66 | + { |
|
| 66 | 67 | $registry->setHandler($jobType, $handler); |
| 67 | 68 | } |
| 68 | 69 | |
| 69 | - foreach ($config->getRegistrySerializers() as $jobType => $serializer) { |
|
| 70 | - if ($serializer instanceof Autowire || \is_string($serializer)) { |
|
| 70 | + foreach ($config->getRegistrySerializers() as $jobType => $serializer) |
|
| 71 | + { |
|
| 72 | + if ($serializer instanceof Autowire || \is_string($serializer)) |
|
| 73 | + { |
|
| 71 | 74 | $serializer = $container->get($serializer); |
| 72 | 75 | } |
| 73 | 76 | $serializersRegistry->addSerializer($jobType, $serializer); |
@@ -97,7 +100,8 @@ discard block |
||
| 97 | 100 | { |
| 98 | 101 | $default = $config->getDefaultSerializer(); |
| 99 | 102 | |
| 100 | - if ($default instanceof Autowire || \is_string($default)) { |
|
| 103 | + if ($default instanceof Autowire || \is_string($default)) |
|
| 104 | + { |
|
| 101 | 105 | $default = $container->get($default); |
| 102 | 106 | } |
| 103 | 107 | |