@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * Records an Exception to the database |
28 | 28 | * @param Exception $e The exception you want to record |
29 | - * @return Tylercd100\LERN\Models\ExceptionModel |
|
29 | + * @return ExceptionModel |
|
30 | 30 | */ |
31 | 31 | public function record(Exception $e) |
32 | 32 | { |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace Tylercd100\LERN\Components; |
4 | 4 | |
5 | 5 | use Exception; |
6 | -use Tylercd100\LERN\Models\ExceptionModel; |
|
7 | -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; |
|
8 | 6 | use Illuminate\Support\Facades\Auth; |
9 | -use Illuminate\Support\Facades\Request; |
|
10 | 7 | use Illuminate\Support\Facades\Input; |
8 | +use Illuminate\Support\Facades\Request; |
|
9 | +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; |
|
10 | +use Tylercd100\LERN\Models\ExceptionModel; |
|
11 | 11 | |
12 | 12 | class Recorder { |
13 | 13 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * The constructor |
21 | 21 | */ |
22 | - public function __construct(){ |
|
22 | + public function __construct() { |
|
23 | 23 | $this->config = config('lern.record'); |
24 | 24 | } |
25 | 25 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param string $type the config value you want to check |
54 | 54 | * @return boolean |
55 | 55 | */ |
56 | - private function canCollect($type){ |
|
57 | - if(!empty($this->config) && !empty($this->config['collect']) && !empty($this->config['collect'][$type])){ |
|
56 | + private function canCollect($type) { |
|
57 | + if (!empty($this->config) && !empty($this->config['collect']) && !empty($this->config['collect'][$type])) { |
|
58 | 58 | return $this->config['collect'][$type] === true; |
59 | 59 | } |
60 | 60 | return false; |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * Gets the ID of the User that is logged in |
65 | 65 | * @return integer|null The ID of the User or Null if not logged in |
66 | 66 | */ |
67 | - protected function getUserId(){ |
|
67 | + protected function getUserId() { |
|
68 | 68 | $user = Auth::user(); |
69 | - if($this->canCollect('user_id') && is_object($user)) { |
|
69 | + if ($this->canCollect('user_id') && is_object($user)) { |
|
70 | 70 | return $user->id; |
71 | 71 | } else { |
72 | 72 | return null; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * Gets the Method of the Request |
78 | 78 | * @return string|null Possible values are null or GET, POST, DELETE, PUT, etc... |
79 | 79 | */ |
80 | - protected function getMethod(){ |
|
80 | + protected function getMethod() { |
|
81 | 81 | $method = Request::method(); |
82 | - if($this->canCollect('method') && !empty($method)) { |
|
82 | + if ($this->canCollect('method') && !empty($method)) { |
|
83 | 83 | return $method; |
84 | 84 | } else { |
85 | 85 | return null; |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * Gets the input data of the Request |
91 | 91 | * @return array|null The Input data or null |
92 | 92 | */ |
93 | - protected function getData(){ |
|
93 | + protected function getData() { |
|
94 | 94 | $data = Input::all(); |
95 | - if($this->canCollect('data') && is_array($data)) { |
|
95 | + if ($this->canCollect('data') && is_array($data)) { |
|
96 | 96 | return $data; |
97 | 97 | } else { |
98 | 98 | return null; |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * Gets the URL of the Request |
104 | 104 | * @return string|null Returns a URL string or null |
105 | 105 | */ |
106 | - protected function getUrl(){ |
|
106 | + protected function getUrl() { |
|
107 | 107 | $url = Request::url(); |
108 | - if($this->canCollect('url') && is_array($url)) { |
|
108 | + if ($this->canCollect('url') && is_array($url)) { |
|
109 | 109 | return $url; |
110 | 110 | } else { |
111 | 111 | return null; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param Exception $e The Exception to check |
118 | 118 | * @return string|integer The status code value |
119 | 119 | */ |
120 | - protected function getStatusCode(Exception $e){ |
|
120 | + protected function getStatusCode(Exception $e) { |
|
121 | 121 | if ($e instanceof HttpExceptionInterface) { |
122 | 122 | return $e->getStatusCode(); |
123 | 123 | } else { |
@@ -81,7 +81,7 @@ |
||
81 | 81 | /** |
82 | 82 | * Pushes on another Monolog Handler |
83 | 83 | * @param HandlerInterface $handler The handler instance to add on |
84 | - * @return Notifier Returns this |
|
84 | + * @return LERN Returns this |
|
85 | 85 | */ |
86 | 86 | public function pushHandler(HandlerInterface $handler) { |
87 | 87 | $this->notifier->pushHandler($handler); |
@@ -3,9 +3,9 @@ |
||
3 | 3 | namespace Tylercd100\LERN; |
4 | 4 | |
5 | 5 | use Exception; |
6 | +use Monolog\Handler\HandlerInterface; |
|
6 | 7 | use Tylercd100\LERN\Components\Notifier; |
7 | 8 | use Tylercd100\LERN\Components\Recorder; |
8 | -use Monolog\Handler\HandlerInterface; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * The master class |
@@ -5,8 +5,8 @@ |
||
5 | 5 | 'record'=>[ |
6 | 6 | 'table'=>'vendor_tylercd100_lern_exceptions', |
7 | 7 | 'collect'=>[ |
8 | - 'method'=>false,//When true it will collect GET, POST, DELETE, PUT, etc... |
|
9 | - 'data'=>false,//When true it will collect Input data |
|
8 | + 'method'=>false, //When true it will collect GET, POST, DELETE, PUT, etc... |
|
9 | + 'data'=>false, //When true it will collect Input data |
|
10 | 10 | 'user_id'=>false, |
11 | 11 | 'url'=>false, |
12 | 12 | ], |