Skip to content

Commit 8b140de

Browse files
authored
Merge pull request #4 from jqhph/analysis-pevlbo
Apply fixes from StyleCI
2 parents ff24374 + f8eefd9 commit 8b140de

File tree

5 files changed

+34
-26
lines changed

5 files changed

+34
-26
lines changed

resources/templates/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
'pagerDirection' => 'first', // last first
3737
],
3838
'edit-config' => [
39-
'label' => '<i class="fa fa-github"></i> 编辑此页',
39+
'label' => '<i class="fa fa-github"></i> 编辑此页',
4040
'values' => [
4141
'installation' => 'https://github.com/xxx/xxx/edit/master/installation.md',
4242
],

src/Admin/Controllers/AdminController.php

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,26 @@
22

33
namespace Dcat\Page\Admin\Controllers;
44

5+
use Dcat\Admin\Grid;
6+
use Dcat\Admin\Layout\Content;
7+
use Dcat\Admin\Widgets\Box;
58
use Dcat\Admin\Widgets\Card;
6-
use DcatPage;
7-
use Illuminate\Routing\Controller;
9+
use Dcat\Admin\Widgets\Table;
10+
use Dcat\Admin\Widgets\Terminal;
811
use Dcat\Page\Admin\Grid\CompileButton;
912
use Dcat\Page\Admin\Grid\CreateAppButton;
1013
use Dcat\Page\Admin\Grid\IndexButton;
1114
use Dcat\Page\Admin\Repositories\App;
12-
use Dcat\Admin\Grid;
13-
use Dcat\Admin\Layout\Content;
14-
use Dcat\Admin\Widgets\Box;
15-
use Dcat\Admin\Widgets\Terminal;
16-
use Dcat\Admin\Widgets\Table;
15+
use DcatPage;
16+
use Illuminate\Routing\Controller;
1717

1818
class AdminController extends Controller
1919
{
2020
/**
21-
* 应用管理页面
21+
* 应用管理页面.
2222
*
2323
* @param Content $content
24+
*
2425
* @return Content
2526
*/
2627
public function index(Content $content)
@@ -32,7 +33,7 @@ public function index(Content $content)
3233
}
3334

3435
/**
35-
* 构建应用列表
36+
* 构建应用列表.
3637
*
3738
* @return Grid
3839
*/
@@ -49,25 +50,31 @@ protected function grid()
4950
$grid->app('应用')->label('primary');
5051
$grid->column('description', '描述')->width('360px');
5152
$grid->homepage('主页')->display(function ($value) {
52-
if (!$value) return;
53+
if (!$value) {
54+
return;
55+
}
5356

5457
return "<a href='$value' target='_blank'></a>";
5558
});
5659
$grid->authors('开发者')->display(function ($v) {
57-
if (!$v) return;
60+
if (!$v) {
61+
return;
62+
}
5863

5964
foreach ($v as &$item) {
6065
$item = "<span class='bold text-80'>{$item['name']}</span> <<code>{$item['email']}</code>>";
6166
}
6267

63-
return join('<br/>', $v);
68+
return implode('<br/>', $v);
6469
});
6570

6671
$self = $this;
6772
$grid->config('配置')->display('详细')->expand(function () use ($self) {
68-
if (!$this->config) return;
73+
if (!$this->config) {
74+
return;
75+
}
6976

70-
return $self->formatConfigData((array)$this->config);
77+
return $self->formatConfigData((array) $this->config);
7178
});
7279

7380
$grid->action('操作')->display(function () {
@@ -90,7 +97,7 @@ protected function grid()
9097
}
9198

9299
/**
93-
* 创建应用接口
100+
* 创建应用接口.
94101
*
95102
* @return mixed
96103
*/
@@ -105,14 +112,14 @@ public function createApp()
105112
}
106113

107114
/**
108-
* 编译应用接口
115+
* 编译应用接口.
109116
*
110117
* @return mixed
111118
*/
112119
public function compileApp()
113120
{
114121
$name = request('name');
115-
$dir = request('dir');
122+
$dir = request('dir');
116123

117124
$title = '';
118125
if ($dir) {
@@ -126,7 +133,7 @@ public function compileApp()
126133
}
127134

128135
/**
129-
* 生成索引接口
136+
* 生成索引接口.
130137
*
131138
* @return mixed
132139
*/
@@ -142,11 +149,12 @@ public function indexApp()
142149

143150
/**
144151
* @param array $data
152+
*
145153
* @return Table
146154
*/
147155
protected function formatConfigData(array $data)
148156
{
149-
$data = json_encode($data, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
157+
$data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
150158

151159
return Card::make("<pre>$data</pre>")->class('mb-0', true);
152160
}

src/Admin/DcatPageExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class DcatPageExtension extends Extension
1414
protected $composer = __DIR__.'/../../composer.json';
1515

1616
/**
17-
* 初始化
17+
* 初始化.
1818
*/
1919
public function boot()
2020
{
2121
$this->registerMenu();
2222

2323
$this->routes(function () {
24-
Route::get('dcat-page', Controllers\AdminController::class.'@index');
24+
Route::get('dcat-page', Controllers\AdminController::class.'@index');
2525
Route::post('dcat-page/create-app', Controllers\AdminController::class.'@createApp');
2626
Route::post('dcat-page/compile-app', Controllers\AdminController::class.'@compileApp');
2727
Route::post('dcat-page/index-app', Controllers\AdminController::class.'@indexApp');

src/Admin/Repositories/App.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Dcat\Page\Admin\Repositories;
44

5-
use Dcat\Page\DcatPage;
65
use Dcat\Admin\Grid;
76
use Dcat\Admin\Repositories\Repository;
7+
use Dcat\Page\DcatPage;
88

99
class App extends Repository
1010
{
@@ -17,9 +17,9 @@ public function get(Grid\Model $model)
1717

1818
$config = \DcatPage\config();
1919

20-
$authors = $config['authors'];
20+
$authors = $config['authors'];
2121
$description = $config['description'] ?? null;
22-
$homepage = $config['homepage'] ?? null;
22+
$homepage = $config['homepage'] ?? null;
2323

2424
unset(
2525
$config['authors'],

src/DcatPageServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function boot()
3333
{
3434
// 如果安装了 dcat admin,则注册dcat admin扩展
3535
if (class_exists(Admin::class)) {
36-
if (! DcatPageExtension::enabled()) {
36+
if (!DcatPageExtension::enabled()) {
3737
return;
3838
}
3939

0 commit comments

Comments
 (0)