@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function __construct() |
18 | 18 | { |
19 | - parent::__construct('product_image', [ 'id' ], [ 'product_id', 'url_slug', 'image' ]); |
|
19 | + parent::__construct('product_image', ['id'], ['product_id', 'url_slug', 'image']); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -96,7 +96,7 @@ |
||
96 | 96 | return null; |
97 | 97 | } |
98 | 98 | |
99 | - $value->category =(new Category())->findById((int) $value->product_type_id)->data(); |
|
99 | + $value->category = (new Category())->findById((int) $value->product_type_id)->data(); |
|
100 | 100 | $value->ProductImage = (new ProductImage())->findAllByProductId((int) $value->id); |
101 | 101 | |
102 | 102 | return $value; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | $this->assertEquals(0, count($stack)); |
11 | 11 | |
12 | 12 | array_push($stack, 'foo'); |
13 | - $this->assertEquals('foo', $stack[count($stack)-1]); |
|
13 | + $this->assertEquals('foo', $stack[count($stack) - 1]); |
|
14 | 14 | $this->assertEquals(1, count($stack)); |
15 | 15 | |
16 | 16 | $this->assertEquals('foo', array_pop($stack)); |
@@ -100,8 +100,7 @@ |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | return true; |
103 | - } |
|
104 | - catch (\Exception $e) { |
|
103 | + } catch (\Exception $e) { |
|
105 | 104 | \writeLog($e->getMessage()); |
106 | 105 | \writeLog($this->mail->ErrorInfo); |
107 | 106 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | switch ($message->type) { |
63 | 63 | case 'confirmEmail': |
64 | - $Email = new Email([ $message->content->email ], true); |
|
64 | + $Email = new Email([$message->content->email], true); |
|
65 | 65 | |
66 | 66 | if (!$Email->SendMail(ConfirmEmail::bind('127.0.0.1:80/confirm'), 'Confirm your email')) { |
67 | 67 | \writeLog('Confirm email not delivered for: ', $message->content->email); |
@@ -73,12 +73,10 @@ |
||
73 | 73 | |
74 | 74 | default: \writeLog(json_encode($message)); $handledMessage = true; break; |
75 | 75 | } |
76 | - } |
|
77 | - catch (\Throwable $exception) { |
|
76 | + } catch (\Throwable $exception) { |
|
78 | 77 | \writeLog($exception->getMessage()); |
79 | 78 | $handledMessage = true; |
80 | - } |
|
81 | - finally { |
|
79 | + } finally { |
|
82 | 80 | /** |
83 | 81 | * Verify if the message are received and if yes, send the ack for the queue |
84 | 82 | */ |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | set_time_limit(0); |
11 | 11 | |
12 | 12 | if (isset($argv)) { |
13 | - if (in_array('--debug', $argv)) { |
|
14 | - $filename = pathinfo(__FILE__, PATHINFO_FILENAME); |
|
13 | + if (in_array('--debug', $argv)) { |
|
14 | + $filename = pathinfo(__FILE__, PATHINFO_FILENAME); |
|
15 | 15 | openlog($filename, LOG_PID | LOG_PERROR, LOG_LOCAL0); |
16 | - } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | require __DIR__ . '/vendor/autoload.php'; |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | // Shutdown function |
27 | 27 | function shutdown(): void |
28 | 28 | { |
29 | - \writeLog('Stoping E-mail Service...'); |
|
29 | + \writeLog('Stoping E-mail Service...'); |
|
30 | 30 | |
31 | - // Closing connection with syslog |
|
32 | - if (isset($argv)) { |
|
31 | + // Closing connection with syslog |
|
32 | + if (isset($argv)) { |
|
33 | 33 | if (in_array('--debug', $argv)) { |
34 | 34 | closelog(); |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - exit(); |
|
38 | + exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | register_shutdown_function('shutdown'); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(ticks = 1); |
|
3 | +declare(ticks=1); |
|
4 | 4 | |
5 | -declare(strict_types = 1); |
|
5 | +declare(strict_types=1); |
|
6 | 6 | |
7 | 7 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); |
8 | 8 |
@@ -49,8 +49,7 @@ |
||
49 | 49 | try { |
50 | 50 | sleep(2); |
51 | 51 | $RabbitReceiver = new Listener(RABBITMQ_QUEUE, RABBITMQ_EXCHANGER); |
52 | - } |
|
53 | - catch (\Throwable $exception) { |
|
52 | + } catch (\Throwable $exception) { |
|
54 | 53 | \writeLog($exception->getMessage()); |
55 | 54 | |
56 | 55 | if (!empty($RabbitReceiver)) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | public function __construct(string $message = null, int $code = 0) |
44 | 44 | { |
45 | 45 | if (!$message) { |
46 | - throw new $this('Unknown '. get_class($this)); |
|
46 | + throw new $this('Unknown ' . get_class($this)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | parent::__construct($message, $code); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | protected function consume() |
28 | 28 | { |
29 | - $callback = function ($message) { $this->handler($message); }; |
|
29 | + $callback = function($message) { $this->handler($message); }; |
|
30 | 30 | $this->channel->basic_consume($this->getQueue(), 'consumer', false, $this->getReply(), false, false, $callback); |
31 | 31 | |
32 | 32 | $pid = pcntl_fork(); |