@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * Creates a handler for a specified driver |
| 14 | 14 | * @param string $driver Lowercase driver string that is also in the config/lern.php file |
| 15 | 15 | * @param array $subject Title or Subject line for the notification |
| 16 | - * @return Monolog\Handler\HandlerInterface A handler to use with a Monolog\Logger instance |
|
| 16 | + * @return \Monolog\Handler\HandlerInterface A handler to use with a Monolog\Logger instance |
|
| 17 | 17 | */ |
| 18 | 18 | public function create($driver,$subject = null) |
| 19 | 19 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Creates Pushover Monolog Handler |
| 27 | 27 | * @param array $subject Title or Subject line for the notification |
| 28 | - * @return PushoverHandler A handler to use with a Monolog\Logger instance |
|
| 28 | + * @return \Monolog\Handler\PushoverHandler A handler to use with a Monolog\Logger instance |
|
| 29 | 29 | */ |
| 30 | 30 | protected function pushover($subject) |
| 31 | 31 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Creates Mail Monolog Handler |
| 43 | 43 | * @param array $subject Title or Subject line for the notification |
| 44 | - * @return NativeMailerHandler A handler to use with a Monolog\Logger instance |
|
| 44 | + * @return \Monolog\Handler\NativeMailerHandler A handler to use with a Monolog\Logger instance |
|
| 45 | 45 | */ |
| 46 | 46 | protected function mail($subject) |
| 47 | 47 | { |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Creates Slack Monolog Handler |
| 58 | - * @param array $subject Title or Subject line for the notification |
|
| 59 | - * @return SlackHandler A handler to use with a Monolog\Logger instance |
|
| 58 | + * @return \Monolog\Handler\SlackHandler A handler to use with a Monolog\Logger instance |
|
| 60 | 59 | */ |
| 61 | 60 | protected function slack() |
| 62 | 61 | { |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | * @param array $subject Title or Subject line for the notification |
| 16 | 16 | * @return Monolog\Handler\HandlerInterface A handler to use with a Monolog\Logger instance |
| 17 | 17 | */ |
| 18 | - public function create($driver,$subject = null) |
|
| 18 | + public function create($driver, $subject = null) |
|
| 19 | 19 | { |
| 20 | - $this->config = config('lern.notify.'.$driver); |
|
| 21 | - if(is_array($this->config)) |
|
| 20 | + $this->config = config('lern.notify.' . $driver); |
|
| 21 | + if (is_array($this->config)) |
|
| 22 | 22 | return $this->{$driver}($subject); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | * @param mixed $subject [description] |
| 73 | 73 | * @return [type] [description] |
| 74 | 74 | */ |
| 75 | - private function checkSubject($subject){ |
|
| 76 | - if(empty($subject)) { |
|
| 75 | + private function checkSubject($subject) { |
|
| 76 | + if (empty($subject)) { |
|
| 77 | 77 | throw new Exception('$subject must not be empty!'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(!is_string($subject)) { |
|
| 80 | + if (!is_string($subject)) { |
|
| 81 | 81 | throw new Exception('$subject must be a string!'); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -18,8 +18,9 @@ |
||
| 18 | 18 | public function create($driver,$subject = null) |
| 19 | 19 | { |
| 20 | 20 | $this->config = config('lern.notify.'.$driver); |
| 21 | - if(is_array($this->config)) |
|
| 22 | - return $this->{$driver}($subject); |
|
| 21 | + if(is_array($this->config)) { |
|
| 22 | + return $this->{$driver}($subject); |
|
| 23 | + } |
|
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | /** |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create(config('lern.record.table'), function(Blueprint $table){ |
|
| 15 | + Schema::create(config('lern.record.table'), function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id', true)->unsigned(); |
| 17 | 17 | $table->string('class'); |
| 18 | 18 | $table->string('file'); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Illuminate\Database\Schema\Blueprint; |
|
| 4 | 3 | use Illuminate\Database\Migrations\Migration; |
| 4 | +use Illuminate\Database\Schema\Blueprint; |
|
| 5 | 5 | |
| 6 | 6 | class CreateLERNTables extends Migration { |
| 7 | 7 | |
@@ -6,10 +6,10 @@ |
||
| 6 | 6 | |
| 7 | 7 | class LERNServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - public function register(){ |
|
| 9 | + public function register() { |
|
| 10 | 10 | $this->mergeConfigFrom(__DIR__ . '/../config/lern.php', 'lern'); |
| 11 | 11 | |
| 12 | - $this->app->singleton('lern', function () { |
|
| 12 | + $this->app->singleton('lern', function() { |
|
| 13 | 13 | return new LERN; |
| 14 | 14 | }); |
| 15 | 15 | } |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * You can provide a Monolog Logger instance to use in the constructor |
| 18 | 18 | * @param Logger|null $log Logger instance to use |
| 19 | 19 | */ |
| 20 | - public function __construct(Logger $log = null){ |
|
| 21 | - if($log === null){ |
|
| 20 | + public function __construct(Logger $log = null) { |
|
| 21 | + if ($log === null) { |
|
| 22 | 22 | $log = new Logger(config('lern.notify.channel')); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function setMessage($cb) |
| 34 | 34 | { |
| 35 | - if(is_string($cb)) { |
|
| 35 | + if (is_string($cb)) { |
|
| 36 | 36 | $this->messageCb = function() use ($cb) { return $cb; }; |
| 37 | - } else if(is_callable($cb)) { |
|
| 37 | + } else if (is_callable($cb)) { |
|
| 38 | 38 | $this->messageCb = $cb; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | * @param Exception $e The Exception instance that you want to build the message around |
| 47 | 47 | * @return string The message string |
| 48 | 48 | */ |
| 49 | - public function getMessage(Exception $e){ |
|
| 50 | - if(is_callable($this->messageCb)){ |
|
| 49 | + public function getMessage(Exception $e) { |
|
| 50 | + if (is_callable($this->messageCb)) { |
|
| 51 | 51 | return $this->messageCb->__invoke($e); |
| 52 | 52 | } else { |
| 53 | - $msg = get_class($e) . " was thrown! \n".$e->getMessage(); |
|
| 54 | - if($this->config['includeExceptionStackTrace']===true){ |
|
| 55 | - $msg.="\n\n".$e->getTraceAsString(); |
|
| 53 | + $msg = get_class($e) . " was thrown! \n" . $e->getMessage(); |
|
| 54 | + if ($this->config['includeExceptionStackTrace'] === true) { |
|
| 55 | + $msg .= "\n\n" . $e->getTraceAsString(); |
|
| 56 | 56 | } |
| 57 | 57 | return $msg; |
| 58 | 58 | } |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function setSubject($cb) |
| 66 | 66 | { |
| 67 | - if(is_string($cb)) { |
|
| 67 | + if (is_string($cb)) { |
|
| 68 | 68 | $this->subjectCb = function() use ($cb) { return $cb; }; |
| 69 | - } else if(is_callable($cb)) { |
|
| 69 | + } else if (is_callable($cb)) { |
|
| 70 | 70 | $this->subjectCb = $cb; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param Exception $e The Exception instance that you want to build the subject around |
| 79 | 79 | * @return string The subject string |
| 80 | 80 | */ |
| 81 | - public function getSubject(Exception $e){ |
|
| 82 | - if(is_callable($this->subjectCb)){ |
|
| 81 | + public function getSubject(Exception $e) { |
|
| 82 | + if (is_callable($this->subjectCb)) { |
|
| 83 | 83 | return $this->subjectCb->__invoke($e); |
| 84 | 84 | } else { |
| 85 | 85 | return get_class($e); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param HandlerInterface $handler The handler instance to add on |
| 92 | 92 | * @return Notifier Returns this |
| 93 | 93 | */ |
| 94 | - public function pushHandler(HandlerInterface $handler){ |
|
| 94 | + public function pushHandler(HandlerInterface $handler) { |
|
| 95 | 95 | $this->log->pushHandler($handler); |
| 96 | 96 | return $this; |
| 97 | 97 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param Exception $e The exception to use |
| 102 | 102 | * @return Notifier Returns this |
| 103 | 103 | */ |
| 104 | - public function send(Exception $e){ |
|
| 104 | + public function send(Exception $e) { |
|
| 105 | 105 | $factory = new MonologHandlerFactory(); |
| 106 | 106 | $drivers = $this->config['drivers']; |
| 107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $subject = $this->getSubject($e); |
| 110 | 110 | |
| 111 | 111 | foreach ($drivers as $driver) { |
| 112 | - $handler = $factory->create($driver,$subject); |
|
| 112 | + $handler = $factory->create($driver, $subject); |
|
| 113 | 113 | $this->log->pushHandler($handler); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -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 { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct(Notifier $notifier = null) |
| 23 | 23 | { |
| 24 | - if(empty($notifier)) |
|
| 24 | + if (empty($notifier)) |
|
| 25 | 25 | $notifier = new Notifier(); |
| 26 | 26 | $this->notifier = $notifier; |
| 27 | 27 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'trace' => $e->getTraceAsString(), |
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | - if($e instanceof HttpExceptionInterface) |
|
| 58 | + if ($e instanceof HttpExceptionInterface) |
|
| 59 | 59 | $opts['status_code'] = $e->getStatusCode(); |
| 60 | 60 | |
| 61 | 61 | return ExceptionModel::create($opts); |
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct(Notifier $notifier = null) |
| 23 | 23 | { |
| 24 | - if(empty($notifier)) |
|
| 25 | - $notifier = new Notifier(); |
|
| 24 | + if(empty($notifier)) { |
|
| 25 | + $notifier = new Notifier(); |
|
| 26 | + } |
|
| 26 | 27 | $this->notifier = $notifier; |
| 27 | 28 | } |
| 28 | 29 | |
@@ -55,8 +56,9 @@ discard block |
||
| 55 | 56 | 'trace' => $e->getTraceAsString(), |
| 56 | 57 | ]; |
| 57 | 58 | |
| 58 | - if($e instanceof HttpExceptionInterface) |
|
| 59 | - $opts['status_code'] = $e->getStatusCode(); |
|
| 59 | + if($e instanceof HttpExceptionInterface) { |
|
| 60 | + $opts['status_code'] = $e->getStatusCode(); |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | return ExceptionModel::create($opts); |
| 62 | 64 | } |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace Tylercd100\LERN; |
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | -use Tylercd100\LERN\Facades\LERN; |
|
| 7 | 6 | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
| 7 | +use Tylercd100\LERN\Facades\LERN; |
|
| 8 | 8 | |
| 9 | 9 | class Handler extends ExceptionHandler { |
| 10 | 10 | |