| @@ -107,7 +107,7 @@ | ||
| 107 | 107 | |
| 108 | 108 | /** | 
| 109 | 109 | * Validates that the subject is an unempty string | 
| 110 | - * @param mixed $subject The value to check | |
| 110 | + * @param string $subject The value to check | |
| 111 | 111 | * @return void | 
| 112 | 112 | */ | 
| 113 | 113 |      private function checkSubject($subject) { | 
| @@ -3,8 +3,8 @@ | ||
| 3 | 3 | namespace Tylercd100\LERN\Notifications; | 
| 4 | 4 | |
| 5 | 5 | use Exception; | 
| 6 | -use Monolog\Logger; | |
| 7 | 6 | use Monolog\Handler\HandlerInterface; | 
| 7 | +use Monolog\Logger; | |
| 8 | 8 | use Tylercd100\LERN\Notifications\MonologHandlerFactory; | 
| 9 | 9 | |
| 10 | 10 |  class Notifier { | 
| @@ -5,8 +5,8 @@ | ||
| 5 | 5 | use Exception; | 
| 6 | 6 | use Monolog\Handler\HandlerInterface; | 
| 7 | 7 | use Monolog\Logger; | 
| 8 | -use Tylercd100\LERN\Factories\MonologHandlerFactory; | |
| 9 | 8 | use Tylercd100\LERN\Exceptions\NotifierFailedException; | 
| 9 | +use Tylercd100\LERN\Factories\MonologHandlerFactory; | |
| 10 | 10 | |
| 11 | 11 |  class Notifier extends Component { | 
| 12 | 12 | protected $config; | 
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 | */ | 
| 111 | 111 |      public function send(Exception $e, array $context = []) { | 
| 112 | 112 | |
| 113 | -        if($this->shouldntHandle($e)){ | |
| 113 | +        if ($this->shouldntHandle($e)) { | |
| 114 | 114 | return false; | 
| 115 | 115 | } | 
| 116 | 116 | |
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | $message = $this->getMessage($e); | 
| 121 | 121 | $subject = $this->getSubject($e); | 
| 122 | 122 | |
| 123 | -        try{ | |
| 123 | +        try { | |
| 124 | 124 |              foreach ($drivers as $driver) { | 
| 125 | 125 | $handler = $factory->create($driver, $subject); | 
| 126 | 126 | $this->log->pushHandler($handler); | 
| @@ -141,8 +141,8 @@ discard block | ||
| 141 | 141 | * @param array $context Additional information that you would like to pass to Monolog | 
| 142 | 142 | * @return array The modified context array | 
| 143 | 143 | */ | 
| 144 | -    protected function buildContext(array $context = []){ | |
| 145 | -        if(in_array('pushover', $this->drivers)){ | |
| 144 | +    protected function buildContext(array $context = []) { | |
| 145 | +        if (in_array('pushover', $this->drivers)) { | |
| 146 | 146 | $context['sound'] = $this->config['pushover']['sound']; | 
| 147 | 147 | } | 
| 148 | 148 | return $context; | 
| @@ -86,8 +86,9 @@ | ||
| 86 | 86 | case 'data': | 
| 87 | 87 | return $this->getData(); | 
| 88 | 88 | case 'status_code': | 
| 89 | - if($e===null) | |
| 90 | - return 0; | |
| 89 | +                if($e===null) { | |
| 90 | + return 0; | |
| 91 | + } | |
| 91 | 92 | return $this->getStatusCode($e); | 
| 92 | 93 | default: | 
| 93 | 94 |                  throw new Exception("{$key} is not supported! Therefore it cannot be collected!"); | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | use Tylercd100\LERN\Exceptions\RecorderFailedException; | 
| 11 | 11 | use Tylercd100\LERN\Models\ExceptionModel; | 
| 12 | 12 | |
| 13 | -class Recorder extends Component{ | |
| 13 | +class Recorder extends Component { | |
| 14 | 14 | |
| 15 | 15 | /** | 
| 16 | 16 | * @var mixed | 
| @@ -31,7 +31,7 @@ discard block | ||
| 31 | 31 | */ | 
| 32 | 32 | public function record(Exception $e) | 
| 33 | 33 |      { | 
| 34 | -        if($this->shouldntHandle($e)){ | |
| 34 | +        if ($this->shouldntHandle($e)) { | |
| 35 | 35 | return false; | 
| 36 | 36 | } | 
| 37 | 37 | |
| @@ -76,7 +76,7 @@ discard block | ||
| 76 | 76 | /** | 
| 77 | 77 | * @param string $key | 
| 78 | 78 | */ | 
| 79 | -    protected function collect($key,Exception $e = null){ | |
| 79 | +    protected function collect($key, Exception $e = null) { | |
| 80 | 80 |          switch ($key) { | 
| 81 | 81 | case 'user_id': | 
| 82 | 82 | return $this->getUserId(); | 
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | case 'data': | 
| 88 | 88 | return $this->getData(); | 
| 89 | 89 | case 'status_code': | 
| 90 | - if($e===null) | |
| 90 | + if ($e === null) | |
| 91 | 91 | return 0; | 
| 92 | 92 | return $this->getStatusCode($e); | 
| 93 | 93 | default: | 
| @@ -166,12 +166,12 @@ discard block | ||
| 166 | 166 | * @param array &$data [description] | 
| 167 | 167 | * @return void | 
| 168 | 168 | */ | 
| 169 | -    protected function excludeKeys(array $data){ | |
| 169 | +    protected function excludeKeys(array $data) { | |
| 170 | 170 | $keys = $this->config['excludeKeys']; | 
| 171 | 171 |          foreach ($data as $key => &$value) { | 
| 172 | -            if(in_array($key,$keys)){ | |
| 172 | +            if (in_array($key, $keys)) { | |
| 173 | 173 | unset($data[$key]); | 
| 174 | -            } else if(is_array($value)){ | |
| 174 | +            } else if (is_array($value)) { | |
| 175 | 175 | $value = $this->excludeKeys($value); | 
| 176 | 176 | } | 
| 177 | 177 | } | 
| @@ -25,8 +25,8 @@ | ||
| 25 | 25 | * @param \Exception $e | 
| 26 | 26 | * @return bool | 
| 27 | 27 | */ | 
| 28 | -    protected function shouldntHandle(Exception $e){ | |
| 29 | - $dontHandle = array_merge($this->dontHandle,$this->absolutelyDontHandle); | |
| 28 | +    protected function shouldntHandle(Exception $e) { | |
| 29 | + $dontHandle = array_merge($this->dontHandle, $this->absolutelyDontHandle); | |
| 30 | 30 | |
| 31 | 31 |          foreach ($dontHandle as $type) { | 
| 32 | 32 |              if ($e instanceof $type) { | 
| @@ -2,6 +2,6 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Tylercd100\LERN\Exceptions; | 
| 4 | 4 | |
| 5 | -class RecorderFailedException extends \Exception{ | |
| 5 | +class RecorderFailedException extends \Exception { | |
| 6 | 6 | |
| 7 | 7 | } | 
| 8 | 8 | \ No newline at end of file | 
| @@ -2,6 +2,6 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Tylercd100\LERN\Exceptions; | 
| 4 | 4 | |
| 5 | -class NotifierFailedException extends \Exception{ | |
| 5 | +class NotifierFailedException extends \Exception { | |
| 6 | 6 | |
| 7 | 7 | } | 
| 8 | 8 | \ No newline at end of file | 
| @@ -44,7 +44,7 @@ | ||
| 44 | 44 | 'pushover'=>[ | 
| 45 | 45 |              'token' => env('PUSHOVER_APP_TOKEN'), | 
| 46 | 46 |              'user'  => env('PUSHOVER_USER_KEY'), | 
| 47 | -            'sound' => env('PUSHOVER_SOUND_ERROR','siren'), // https://pushover.net/api#sounds | |
| 47 | +            'sound' => env('PUSHOVER_SOUND_ERROR', 'siren'), // https://pushover.net/api#sounds | |
| 48 | 48 | ], | 
| 49 | 49 | |
| 50 | 50 | /** |