Completed
Pull Request — master (#25)
by Pavel
64:50
created
src/Components/Notifier.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace Tylercd100\LERN\Components;
4 4
 
5 5
 use Exception;
6
-use Illuminate\Container\Container;
7 6
 use Monolog\Handler\HandlerInterface;
8 7
 use Monolog\Logger;
9 8
 use Tylercd100\LERN\Exceptions\NotifierFailedException;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         if (is_callable($this->messageCb)) {
61 61
             return $this->messageCb->__invoke($e);
62 62
         } else {
63
-            $msg = get_class($e) . " was thrown! \n" . $e->getMessage();
63
+            $msg = get_class($e)." was thrown! \n".$e->getMessage();
64 64
             if ($this->config['includeExceptionStackTrace'] === true) {
65
-                $msg .= "\n\n" . $e->getTraceAsString();
65
+                $msg .= "\n\n".$e->getTraceAsString();
66 66
             }
67 67
             return $msg;
68 68
         }
@@ -143,55 +143,55 @@  discard block
 block discarded – undo
143 143
         $app = app();
144 144
 
145 145
         // Add sound ro pushover
146
-        if(in_array('pushover', $this->config['drivers']))
146
+        if (in_array('pushover', $this->config['drivers']))
147 147
         {
148 148
             $context['sound'] = $this->config['pushover']['sound'];
149 149
         }
150 150
 
151 151
         // Add exception context for raven for better handling in Sentry
152
-        if(in_array('raven', $this->config['drivers']))
152
+        if (in_array('raven', $this->config['drivers']))
153 153
         {
154 154
             $context['exception'] = $e;
155 155
         }
156 156
 
157 157
         // Add auth data if available.
158
-        if(isset($app['auth']) && $user = $app['auth']->user())
158
+        if (isset($app['auth']) && $user = $app['auth']->user())
159 159
         {
160
-            if(empty($context['user']) or !is_array($context['user']))
160
+            if (empty($context['user']) or !is_array($context['user']))
161 161
             {
162 162
                 $context['user'] = [];
163 163
             }
164 164
 
165
-            if(!isset($context['user']['id']) && method_exists($user, 'getAuthIdentifier'))
165
+            if (!isset($context['user']['id']) && method_exists($user, 'getAuthIdentifier'))
166 166
             {
167 167
                 $context['user']['id'] = $user->getAuthIdentifier();
168 168
             }
169 169
 
170
-            if(!isset($context['user']['id']) && method_exists($user, 'getKey'))
170
+            if (!isset($context['user']['id']) && method_exists($user, 'getKey'))
171 171
             {
172 172
                 $context['user']['id'] = $user->getKey();
173 173
             }
174 174
 
175
-            if(!isset($context['user']['id']) && isset($user->id))
175
+            if (!isset($context['user']['id']) && isset($user->id))
176 176
             {
177 177
                 $context['user']['id'] = $user->id;
178 178
             }
179 179
         }
180 180
 
181 181
         // Add session data if available.
182
-        if(isset($app['session']) && $session = $app['session']->all())
182
+        if (isset($app['session']) && $session = $app['session']->all())
183 183
         {
184
-            if(empty($context['user']) or !is_array($context['user']))
184
+            if (empty($context['user']) or !is_array($context['user']))
185 185
             {
186 186
                 $context['user'] = [];
187 187
             }
188 188
 
189
-            if(!isset($context['user']['id']))
189
+            if (!isset($context['user']['id']))
190 190
             {
191 191
                 $context['user']['id'] = $app->session->getId();
192 192
             }
193 193
 
194
-            if(isset($context['user']['data']))
194
+            if (isset($context['user']['data']))
195 195
             {
196 196
                 $context['user']['data'] = array_merge($session, $context['user']['data']);
197 197
             } else
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         ];
208 208
 
209 209
         // Add tags to context.
210
-        if(isset($context['tags']))
210
+        if (isset($context['tags']))
211 211
         {
212 212
             $context['tags'] = array_merge($tags, $context['tags']);
213 213
         } else
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $extra = array_merge($extra, array_except($context, ['user', 'tags', 'level', 'extra']));
226 226
 
227 227
         // Add extra to context.
228
-        if(isset($context['extra']))
228
+        if (isset($context['extra']))
229 229
         {
230 230
             $context['extra'] = array_merge($extra, $context['extra']);
231 231
         } else
Please login to merge, or discard this patch.