Completed
Pull Request — master (#17)
by Lucas
02:21
created
src/Mpociot/CaptainHook/Webhook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
     {
33 33
         parent::boot();
34 34
 
35
-        static::created(function ($results) {
35
+        static::created(function($results) {
36 36
             Cache::forget(self::CACHE_KEY);
37 37
         });
38 38
 
39
-        static::deleted(function ($results) {
39
+        static::deleted(function($results) {
40 40
             Cache::forget(self::CACHE_KEY);
41 41
         });
42 42
     }
Please login to merge, or discard this patch.
src/database/2015_10_29_000000_captain_hook_setup_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('webhooks', function (Blueprint $table) {
15
+        Schema::create('webhooks', function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
             $table->integer('tenant_id')->nullable();
18 18
             $table->string('url');
Please login to merge, or discard this patch.
src/config/config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     | subject data of an event and convert it to a format that will then
44 44
     | be posted to the webhooks. By default, all data is json encoded.
45 45
     */
46
-    'transformer' => function ($eventData) {
46
+    'transformer' => function($eventData) {
47 47
         return json_encode($eventData);
48 48
     },
49 49
 
Please login to merge, or discard this patch.
src/Mpociot/CaptainHook/Jobs/TriggerWebhooksJob.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
         foreach ($this->webhooks as $webhook) {
64 64
             if ($logging) {
65 65
                 $log = new CaptainHookLog([
66
-                    'webhook_id' => $webhook[ 'id' ],
67
-                    'url' => $webhook[ 'url' ],
66
+                    'webhook_id' => $webhook['id'],
67
+                    'url' => $webhook['url'],
68 68
                 ]);
69
-                $middleware = Middleware::tap(function (RequestInterface $request, $options) use ($log) {
69
+                $middleware = Middleware::tap(function(RequestInterface $request, $options) use ($log) {
70 70
                     $log->payload_format = isset($request->getHeader('Content-Type')[0]) ? $request->getHeader('Content-Type')[0] : null;
71 71
                     $log->payload = $request->getBody()->getContents();
72
-                }, function ($request, $options, Promise $response) use ($log) {
73
-                    $response->then(function (ResponseInterface $response) use ($log) {
72
+                }, function($request, $options, Promise $response) use ($log) {
73
+                    $response->then(function(ResponseInterface $response) use ($log) {
74 74
                         $log->status = $response->getStatusCode();
75 75
                         $log->response = $response->getBody()->getContents();
76 76
                         $log->response_format = $log->payload_format = isset($response->getHeader('Content-Type')[0]) ? $response->getHeader('Content-Type')[0] : null;
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
                     });
80 80
                 });
81 81
 
82
-                $client->post($webhook[ 'url' ], [
82
+                $client->post($webhook['url'], [
83 83
                     'body' => $this->eventData,
84 84
                     'handler' => $middleware($client->getConfig('handler')),
85 85
                 ]);
86 86
             } else {
87
-                $client->postAsync($webhook[ 'url' ], [
87
+                $client->postAsync($webhook['url'], [
88 88
                     'body' => $this->eventData,
89 89
                     'verify' => false,
90 90
                     'future' => true,
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     /**
35 35
      * Create a new job instance.
36 36
      *
37
-     * @param array|\Illuminate\Support\Collection $webhooks
37
+     * @param \Illuminate\Support\Collection $webhooks
38 38
      * @param mixed $eventData
39 39
      */
40 40
     public function __construct($webhooks, $eventData)
Please login to merge, or discard this patch.
src/database/2015_10_29_000001_captain_hook_setup_logs_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('webhook_logs', function (Blueprint $table) {
15
+        Schema::create('webhook_logs', function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
             $table->integer('webhook_id')->unsigned()->nullable();
18 18
             $table->foreign('webhook_id')->references('id')->on('webhooks')->onDelete('set null');
Please login to merge, or discard this patch.
src/Mpociot/CaptainHook/CaptainHookServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $migrations = [
82 82
             __DIR__ . '/../../database/2015_10_29_000000_captain_hook_setup_table.php' => database_path('/migrations/' . date('Y_m_d_His') . '_captain_hook_setup_table.php'),
83
-            __DIR__ . '/../../database/2015_10_29_000001_captain_hook_setup_logs_table.php' => database_path('/migrations/' . date('Y_m_d_His', strtotime('+1s')).'_captain_hook_setup_logs.php'),
83
+            __DIR__ . '/../../database/2015_10_29_000001_captain_hook_setup_logs_table.php' => database_path('/migrations/' . date('Y_m_d_His', strtotime('+1s')) . '_captain_hook_setup_logs.php'),
84 84
         ];
85 85
 
86 86
         foreach ($migrations as $migration => $toPath) {
87 87
             preg_match('/_captain_hook_.*\.php/', $migration, $match);
88
-            $published_migration = glob(database_path('/migrations/*'.$match[0]));
88
+            $published_migration = glob(database_path('/migrations/*' . $match[0]));
89 89
             if (count($published_migration) !== 0) {
90 90
                 unset($migrations[$migration]);
91 91
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     protected function publishConfig()
101 101
     {
102 102
         $this->publishes([
103
-            __DIR__.'/../../config/config.php' => config_path('captain_hook.php'),
103
+            __DIR__ . '/../../config/config.php' => config_path('captain_hook.php'),
104 104
         ]);
105 105
     }
106 106
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     protected function registerEventListeners()
111 111
     {
112 112
         foreach ($this->listeners as $eventName) {
113
-            $this->app[ 'events' ]->listen($eventName, [$this, 'handleEvent']);
113
+            $this->app['events']->listen($eventName, [$this, 'handleEvent']);
114 114
         }
115 115
     }
116 116
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     public function setWebhooks($webhooks)
131 131
     {
132 132
         $this->webhooks = $webhooks;
133
-        $this->getCache()->rememberForever(Webhook::CACHE_KEY, function () {
133
+        $this->getCache()->rememberForever(Webhook::CACHE_KEY, function() {
134 134
             return $this->webhooks;
135 135
         });
136 136
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function getWebhooks()
142 142
     {
143 143
         if (!$this->getCache()->has(Webhook::CACHE_KEY)) {
144
-            $this->getCache()->rememberForever(Webhook::CACHE_KEY, function () {
144
+            $this->getCache()->rememberForever(Webhook::CACHE_KEY, function() {
145 145
                 return Webhook::all();
146 146
             });
147 147
         }
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function registerCommands()
202 202
     {
203
-        $this->app[ 'hook.list' ] = $this->app->share(function () {
203
+        $this->app['hook.list'] = $this->app->share(function() {
204 204
             return new ListWebhooks();
205 205
         });
206 206
 
207
-        $this->app[ 'hook.add' ] = $this->app->share(function () {
207
+        $this->app['hook.add'] = $this->app->share(function() {
208 208
             return new AddWebhook();
209 209
         });
210 210
 
211
-        $this->app[ 'hook.delete' ] = $this->app->share(function () {
211
+        $this->app['hook.delete'] = $this->app->share(function() {
212 212
             return new DeleteWebhook();
213 213
         });
214 214
 
Please login to merge, or discard this patch.