1 | <?php |
||
10 | class BugNotifier |
||
11 | { |
||
12 | /** |
||
13 | * Notification drivers. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $drivers = [ |
||
18 | 'mail' => MailDriver::class, |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * Fire a notification for the given exception. |
||
23 | * |
||
24 | * @param \Exception $e |
||
25 | * |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function exception(\Exception $e) |
||
39 | |||
40 | /** |
||
41 | * Send notificaiton using the given driver. |
||
42 | * |
||
43 | * @param \FlyingLuscas\BugNotifier\Message $message |
||
44 | * @param \FlyingLuscas\BugNotifier\Drivers\DriverContract $driver |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | private function sendNotification(Message $message, DriverContract $driver) |
||
52 | |||
53 | /** |
||
54 | * Get the notification driver that should be used. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | private function getNotificationDriver() |
||
68 | |||
69 | /** |
||
70 | * Check if the package should run on the current environment. |
||
71 | * |
||
72 | * @return bool |
||
73 | */ |
||
74 | private function shouldRunOnThisEnvironment() |
||
78 | |||
79 | /** |
||
80 | * Check if a given exception should be reported. |
||
81 | * |
||
82 | * @param \Exception $e |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | private function shouldBeReported(\Exception $e) |
||
90 | } |
||
91 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.