@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Create a new job instance. |
38 | 38 | * |
39 | - * @param array|\Illuminate\Support\Collection $webhooks |
|
39 | + * @param \Illuminate\Support\Collection $webhooks |
|
40 | 40 | * @param mixed $eventData |
41 | 41 | */ |
42 | 42 | public function __construct($webhooks, $eventData) |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Resolves a string or callable to a valid callable. |
50 | 50 | * @param string|callable $transformer |
51 | - * @param $defaultMethodName |
|
51 | + * @param string $defaultMethodName |
|
52 | 52 | * @return callable |
53 | 53 | */ |
54 | 54 | private function resolveCallable($transformer, $defaultMethodName) |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | private function resolveCallable($transformer, $defaultMethodName) |
55 | 55 | { |
56 | 56 | if (is_string($transformer)) { |
57 | - return function () use ($transformer, $defaultMethodName) { |
|
57 | + return function() use ($transformer, $defaultMethodName) { |
|
58 | 58 | list($class, $method) = Str::parseCallback($transformer, $defaultMethodName); |
59 | 59 | |
60 | 60 | return call_user_func_array([app($class), $method], func_get_args()); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } elseif (is_callable($transformer)) { |
63 | 63 | return $transformer; |
64 | 64 | } |
65 | - return function(){}; |
|
65 | + return function() {}; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | $webhook->logs()->orderBy('updated_at', 'desc')->first()->delete(); |
87 | 87 | } |
88 | 88 | $log = new WebhookLog([ |
89 | - 'webhook_id' => $webhook[ 'id' ], |
|
90 | - 'url' => $webhook[ 'url' ], |
|
89 | + 'webhook_id' => $webhook['id'], |
|
90 | + 'url' => $webhook['url'], |
|
91 | 91 | ]); |
92 | - $middleware = Middleware::tap(function (RequestInterface $request, $options) use ($log) { |
|
92 | + $middleware = Middleware::tap(function(RequestInterface $request, $options) use ($log) { |
|
93 | 93 | $log->payload_format = isset($request->getHeader('Content-Type')[0]) ? $request->getHeader('Content-Type')[0] : null; |
94 | 94 | $log->payload = $request->getBody()->getContents(); |
95 | - }, function ($request, $options, PromiseInterface $response) use ($log, $webhook, $responseCallback) { |
|
96 | - $response->then(function (ResponseInterface $response) use ($log, $webhook, $responseCallback) { |
|
95 | + }, function($request, $options, PromiseInterface $response) use ($log, $webhook, $responseCallback) { |
|
96 | + $response->then(function(ResponseInterface $response) use ($log, $webhook, $responseCallback) { |
|
97 | 97 | $log->status = $response->getStatusCode(); |
98 | 98 | $log->response = $response->getBody()->getContents(); |
99 | 99 | $log->response_format = $log->payload_format = isset($response->getHeader('Content-Type')[0]) ? $response->getHeader('Content-Type')[0] : null; |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | }); |
110 | 110 | }); |
111 | 111 | |
112 | - $client->post($webhook[ 'url' ], [ |
|
112 | + $client->post($webhook['url'], [ |
|
113 | 113 | 'exceptions' => false, |
114 | 114 | 'body' => $transformer($this->eventData, $webhook), |
115 | 115 | 'verify' => false, |
116 | 116 | 'handler' => $middleware($client->getConfig('handler')), |
117 | 117 | ]); |
118 | 118 | } else { |
119 | - $client->post($webhook[ 'url' ], [ |
|
119 | + $client->post($webhook['url'], [ |
|
120 | 120 | 'exceptions' => false, |
121 | 121 | 'body' => $transformer($this->eventData, $webhook), |
122 | 122 | 'verify' => false, |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | | The tenant_id field can be used for verification. |
31 | 31 | | |
32 | 32 | */ |
33 | - 'filter' => function ($webhook) { |
|
33 | + 'filter' => function($webhook) { |
|
34 | 34 | return true; |
35 | 35 | }, |
36 | 36 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | | You can also use the 'Foo\Class@transform' notation if you want. |
49 | 49 | | |
50 | 50 | */ |
51 | - 'transformer' => function ($eventData, $webhook) { |
|
51 | + 'transformer' => function($eventData, $webhook) { |
|
52 | 52 | return json_encode($eventData); |
53 | 53 | }, |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | | You can also use the 'Foo\Class@handle' notation if you want. |
66 | 66 | | |
67 | 67 | */ |
68 | - 'response_callback' => function ($webhook, $response) { |
|
68 | + 'response_callback' => function($webhook, $response) { |
|
69 | 69 | // Handle custom response status codes, ... |
70 | 70 | }, |
71 | 71 |