Skip to content

Commit 3d1d4ce

Browse files
z-songStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent e3cbee5 commit 3d1d4ce

File tree

8 files changed

+58
-57
lines changed

8 files changed

+58
-57
lines changed

database/migrations/2017_07_17_040159_create_exceptions_table.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
use Illuminate\Support\Facades\Schema;
66

77
/**
8-
* Class CreateLaravelReporterTables
8+
* Class CreateLaravelReporterTables.
99
*
1010
* CREATE TABLE `laravel_exceptions` (
11-
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
12-
`type` varchar(190) COLLATE utf8_unicode_ci NOT NULL,
13-
`code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
14-
`message` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
15-
`file` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
16-
`line` int(10) unsigned NOT NULL,
17-
`trace` text COLLATE utf8_unicode_ci NOT NULL,
18-
`method` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
19-
`path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
20-
`query` text COLLATE utf8_unicode_ci NOT NULL,
21-
`body` text COLLATE utf8_unicode_ci NOT NULL,
22-
`cookies` text COLLATE utf8_unicode_ci NOT NULL,
23-
`headers` text COLLATE utf8_unicode_ci NOT NULL,
24-
`ip` varchar(255) COLLATE utf8_unicode_ci,
25-
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
26-
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
27-
PRIMARY KEY (`id`),
28-
KEY `laravel_issues_name_index` (`name`)
29-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
11+
* `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
12+
* `type` varchar(190) COLLATE utf8_unicode_ci NOT NULL,
13+
* `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
14+
* `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
15+
* `file` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
16+
* `line` int(10) unsigned NOT NULL,
17+
* `trace` text COLLATE utf8_unicode_ci NOT NULL,
18+
* `method` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
19+
* `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
20+
* `query` text COLLATE utf8_unicode_ci NOT NULL,
21+
* `body` text COLLATE utf8_unicode_ci NOT NULL,
22+
* `cookies` text COLLATE utf8_unicode_ci NOT NULL,
23+
* `headers` text COLLATE utf8_unicode_ci NOT NULL,
24+
* `ip` varchar(255) COLLATE utf8_unicode_ci,
25+
* `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
26+
* `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
27+
* PRIMARY KEY (`id`),
28+
* KEY `laravel_issues_name_index` (`name`)
29+
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3030
*/
3131
class CreateExceptionsTable extends Migration
3232
{

src/BootExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ public static function importAssets()
4343
Admin::js('/vendor/laravel-admin-reporter/prism/prism.js');
4444
Admin::css('/vendor/laravel-admin-reporter/prism/prism.css');
4545
}
46-
}
46+
}

src/ExceptionController.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Encore\Admin\Controllers\ModelForm;
66
use Encore\Admin\Facades\Admin;
7-
use Encore\Admin\Form;
87
use Encore\Admin\Grid;
98
use Encore\Admin\Layout\Content;
109
use Encore\Admin\Reporter\Tracer\Parser;
@@ -31,26 +30,26 @@ public function index()
3130
public function grid()
3231
{
3332
return Admin::grid(ExceptionModel::class, function (Grid $grid) {
34-
3533
$grid->model()->orderBy('id', 'desc');
3634

3735
$grid->id('ID')->sortable();
3836

3937
$grid->type()->display(function ($type) {
4038
$path = explode('\\', $type);
39+
4140
return array_pop($path);
4241
});
4342

4443
$grid->code();
4544
$grid->message()->style('width:400px')->display(function ($message) {
46-
47-
if (empty($message)) return '';
45+
if (empty($message)) {
46+
return '';
47+
}
4848

4949
return "<code>$message</code>";
5050
});
5151

5252
$grid->request()->display(function () {
53-
5453
$color = ExceptionModel::$methodColor[$this->method];
5554

5655
return sprintf(
@@ -62,19 +61,15 @@ public function grid()
6261
});
6362

6463
$grid->input()->display(function ($input) {
65-
6664
$input = json_decode($input, true);
6765

6866
if (empty($input)) {
6967
return '';
7068
}
7169

72-
return '<pre>' . json_encode($input, JSON_PRETTY_PRINT) . '</pre>';
73-
70+
return '<pre>'.json_encode($input, JSON_PRETTY_PRINT).'</pre>';
7471
});
7572

76-
77-
7873
$grid->created_at();
7974

8075
$grid->filter(function ($filter) {
@@ -88,7 +83,7 @@ public function grid()
8883
$grid->actions(function (Grid\Displayers\Actions $actions) {
8984
$actions->disableEdit();
9085

91-
$path = $actions->getResource() . '/' . $actions->getKey();
86+
$path = $actions->getResource().'/'.$actions->getKey();
9287
$actions->prepend("<a href=\"$path\"><i class=\"fa fa-search-minus\"></i></a>");
9388
});
9489
});

src/ExceptionModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ public function __construct($attributes = [])
2828

2929
$this->setTable(config('admin.extensions.reporter.table', 'laravel_exceptions'));
3030
}
31-
}
31+
}

src/Reporter.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Reporter extends Extension
1616

1717
/**
1818
* Reporter constructor.
19+
*
1920
* @param Request $request
2021
*/
2122
public function __construct(Request $request)
@@ -25,6 +26,7 @@ public function __construct(Request $request)
2526

2627
/**
2728
* @param \Exception $exception
29+
*
2830
* @return mixed
2931
*/
3032
public static function report(\Exception $exception)
@@ -36,6 +38,7 @@ public static function report(\Exception $exception)
3638

3739
/**
3840
* @param \Exception $exception
41+
*
3942
* @return bool
4043
*/
4144
public function reportException(\Exception $exception)
@@ -75,38 +78,40 @@ public function reportException(\Exception $exception)
7578
* Convert all items to string.
7679
*
7780
* @param $data
81+
*
7882
* @return array
7983
*/
8084
public function stringify($data)
8185
{
8286
return array_map(function ($item) {
83-
return is_array($item) ? json_encode($item, JSON_OBJECT_AS_ARRAY) : (string)$item;
87+
return is_array($item) ? json_encode($item, JSON_OBJECT_AS_ARRAY) : (string) $item;
8488
}, $data);
8589
}
8690

8791
/**
8892
* Store exception info to db.
8993
*
9094
* @param array $data
95+
*
9196
* @return bool
9297
*/
9398
public function store(array $data)
9499
{
95100
$exception = new ExceptionModel();
96101

97-
$exception->type = $data['exception'];
98-
$exception->code = $data['code'];
102+
$exception->type = $data['exception'];
103+
$exception->code = $data['code'];
99104
$exception->message = $data['message'];
100-
$exception->file = $data['file'];
101-
$exception->line = $data['line'];
102-
$exception->trace = $data['trace'];
103-
$exception->method = $data['method'];
104-
$exception->path = $data['path'];
105-
$exception->input = $data['input'];
106-
$exception->body = $data['body'];
105+
$exception->file = $data['file'];
106+
$exception->line = $data['line'];
107+
$exception->trace = $data['trace'];
108+
$exception->method = $data['method'];
109+
$exception->path = $data['path'];
110+
$exception->input = $data['input'];
111+
$exception->body = $data['body'];
107112
$exception->cookies = $data['cookies'];
108113
$exception->headers = $data['headers'];
109-
$exception->ip = $data['ip'];
114+
$exception->ip = $data['ip'];
110115

111116
try {
112117
$exception->save();
@@ -116,4 +121,4 @@ public function store(array $data)
116121

117122
return $exception->save();
118123
}
119-
}
124+
}

src/Tracer/CodeBlock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ public function getPrefix()
4242

4343
public function output()
4444
{
45-
return htmlentities($this->prefix . $this->line . $this->suffix);
45+
return htmlentities($this->prefix.$this->line.$this->suffix);
4646
}
47-
}
47+
}

src/Tracer/Frame.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function extract()
2424
$this->parseFileAndLine($matches[1]);
2525
$this->parseCall($matches[2]);
2626
$this->fetchCodeBlock();
27+
2728
return $this->attributes;
2829
}
2930

@@ -40,7 +41,7 @@ public function parseFileAndLine($str)
4041
public function parseCall($str)
4142
{
4243
if (empty($str)) {
43-
return null;
44+
return;
4445
}
4546
if (preg_match('/^[^(]+(->|::)/', $str, $m)) {
4647
preg_match('/([^:-]+)(?:->|::)([^(]+)\((.*)\)/', $str, $matches);
@@ -80,6 +81,7 @@ public function fetchCodeBlock()
8081
if (!$filename || !$lineNo) {
8182
return;
8283
}
84+
8385
try {
8486
$file = new \SplFileObject($filename);
8587
$target = max(0, ($lineNo - (5 + 1)));
@@ -106,14 +108,14 @@ public function fetchCodeBlock()
106108
} catch (\RuntimeException $exc) {
107109
return;
108110
}
109-
return;
110111
}
111112

112113
public function getCodeBlock()
113114
{
114115
if (empty($this->code)) {
115116
return new CodeBlock();
116117
}
118+
117119
return $this->code ?: new CodeBlock();
118120
}
119121

@@ -124,14 +126,15 @@ public function method()
124126

125127
public function args()
126128
{
127-
if (empty ($this->attributes['args'])) {
129+
if (empty($this->attributes['args'])) {
128130
return [];
129131
}
130132
$args = [];
131133
$names = $this->getParameterNames();
132134
foreach ($this->attributes['args'] as $key => $val) {
133135
$args[array_get($names, $key, "param$key")] = $val;
134136
}
137+
135138
return $args;
136139
}
137140

@@ -152,6 +155,7 @@ public function getParameterNames()
152155
$names[] = $reflection->getName();
153156
}
154157
}
158+
155159
return $names;
156160
}
157161

@@ -161,6 +165,7 @@ protected function extractArgs($args)
161165
return [];
162166
}
163167
$args = explode(',', $args);
168+
164169
return array_map('trim', $args);
165170
}
166171

@@ -178,4 +183,4 @@ public function __get($key)
178183
{
179184
return array_get($this->attributes, $key, '');
180185
}
181-
}
186+
}

src/Tracer/Parser.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,27 @@ public function parse()
1919
$this->frames = array_map(function ($frame) {
2020
return new Frame($frame);
2121
}, $frames);
22+
2223
return $this->frames;
2324
}
2425

2526
public function current()
2627
{
27-
2828
}
2929

3030
public function next()
3131
{
32-
3332
}
3433

3534
public function key()
3635
{
37-
3836
}
3937

4038
public function valid()
4139
{
42-
4340
}
4441

4542
public function rewind()
4643
{
47-
4844
}
49-
}
45+
}

0 commit comments

Comments
 (0)