Skip to content

Commit 0d2449f

Browse files
authored
Merge pull request #1 from laravel-admin-extensions/analysis-Xar4a0
Apply fixes from StyleCI
2 parents bac830c + 8b7d0ab commit 0d2449f

File tree

10 files changed

+60
-54
lines changed

10 files changed

+60
-54
lines changed

src/BootExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ public static function import()
4545

4646
parent::createPermission('Redis Manager', 'ext.redis-manager', 'redis*');
4747
}
48-
}
48+
}

src/DataType/DataType.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,30 @@ public function getConnection()
3333

3434
/**
3535
* @param string $key
36+
*
3637
* @return mixed
3738
*/
38-
public abstract function fetch(string $key);
39+
abstract public function fetch(string $key);
3940

4041
/**
4142
* @param array $params
43+
*
4244
* @return mixed
4345
*/
44-
public abstract function update(array $params);
46+
abstract public function update(array $params);
4547

4648
/**
4749
* @param array $params
50+
*
4851
* @return mixed
4952
*/
50-
public abstract function store(array $params);
53+
abstract public function store(array $params);
5154

5255
/**
5356
* Returns the remaining time to live of a key that has a timeout.
5457
*
5558
* @param string $key
59+
*
5660
* @return int
5761
*/
5862
public function ttl($key)
@@ -64,7 +68,7 @@ public function ttl($key)
6468
* Set a timeout on key.
6569
*
6670
* @param string $key
67-
* @param integer $expire
71+
* @param int $expire
6872
*
6973
* @return void
7074
*/
@@ -82,4 +86,4 @@ public function setTtl($key, $expire)
8286
$this->getConnection()->persist($key);
8387
}
8488
}
85-
}
89+
}

src/DataType/Hashes.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function update(array $params)
2020
$key = array_get($params, 'key');
2121

2222
if (array_has($params, 'field')) {
23-
2423
$field = array_get($params, 'field');
2524
$value = array_get($params, 'value');
2625

@@ -40,10 +39,10 @@ public function update(array $params)
4039
*/
4140
public function store(array $params)
4241
{
43-
$key = array_get($params, 'key');
44-
$ttl = array_get($params, 'ttl');
45-
$field = array_get($params, 'field');
46-
$value = array_get($params, 'value');
42+
$key = array_get($params, 'key');
43+
$ttl = array_get($params, 'ttl');
44+
$field = array_get($params, 'field');
45+
$value = array_get($params, 'value');
4746

4847
$this->getConnection()->hset($key, $field, $value);
4948

@@ -61,13 +60,14 @@ public function store(array $params)
6160
* Remove a field from a hash.
6261
*
6362
* @param array $params
63+
*
6464
* @return int
6565
*/
6666
public function remove(array $params)
6767
{
68-
$key = array_get($params, 'key');
68+
$key = array_get($params, 'key');
6969
$field = array_get($params, 'field');
7070

7171
return $this->getConnection()->hdel($key, [$field]);
7272
}
73-
}
73+
}

src/DataType/Lists.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function update(array $params)
2020
$key = array_get($params, 'key');
2121

2222
if (array_has($params, 'push')) {
23-
2423
$item = array_get($params, 'item');
2524
$command = $params['push'] == 'left' ? 'lpush' : 'rpush';
2625

@@ -40,9 +39,9 @@ public function update(array $params)
4039
*/
4140
public function store(array $params)
4241
{
43-
$key = array_get($params, 'key');
44-
$item = array_get($params, 'item');
45-
$ttl = array_get($params, 'ttl');
42+
$key = array_get($params, 'key');
43+
$item = array_get($params, 'item');
44+
$ttl = array_get($params, 'ttl');
4645

4746
$this->getConnection()->rpush($key, [$item]);
4847

@@ -60,11 +59,12 @@ public function store(array $params)
6059
* Remove a member from list by index.
6160
*
6261
* @param array $params
62+
*
6363
* @return mixed
6464
*/
6565
public function remove(array $params)
6666
{
67-
$key = array_get($params, 'key');
67+
$key = array_get($params, 'key');
6868
$index = array_get($params, 'index');
6969

7070
$lua = <<<'LUA'
@@ -74,4 +74,4 @@ public function remove(array $params)
7474

7575
return $this->getConnection()->eval($lua, 1, $key, $index);
7676
}
77-
}
77+
}

src/DataType/Sets.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function update(array $params)
4040
*/
4141
public function store(array $params)
4242
{
43-
$key = array_get($params, 'key');
44-
$ttl = array_get($params, 'ttl');
45-
$members = array_get($params, 'members');
43+
$key = array_get($params, 'key');
44+
$ttl = array_get($params, 'ttl');
45+
$members = array_get($params, 'members');
4646

4747
$this->getConnection()->sadd($key, $members);
4848

@@ -60,13 +60,14 @@ public function store(array $params)
6060
* Remove a member from a set.
6161
*
6262
* @param array $params
63+
*
6364
* @return int
6465
*/
6566
public function remove(array $params)
6667
{
67-
$key = array_get($params, 'key');
68+
$key = array_get($params, 'key');
6869
$member = array_get($params, 'member');
6970

7071
return $this->getConnection()->srem($key, $member);
7172
}
72-
}
73+
}

src/DataType/SortedSets.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SortedSets extends DataType
99
*/
1010
public function fetch(string $key)
1111
{
12-
return $this->getConnection()->zrange($key,0, -1, ['WITHSCORES' => true]);
12+
return $this->getConnection()->zrange($key, 0, -1, ['WITHSCORES' => true]);
1313
}
1414

1515
public function update(array $params)
@@ -23,8 +23,7 @@ public function update(array $params)
2323
}
2424

2525
if (array_has($params, '_editable')) {
26-
27-
$score = array_get($params, 'value');
26+
$score = array_get($params, 'value');
2827
$member = array_get($params, 'pk');
2928

3029
$this->getConnection()->zadd($key, [$member => $score]);
@@ -36,10 +35,10 @@ public function update(array $params)
3635
*/
3736
public function store(array $params)
3837
{
39-
$key = array_get($params, 'key');
40-
$ttl = array_get($params, 'ttl');
41-
$score = array_get($params, 'score');
42-
$member = array_get($params, 'member');
38+
$key = array_get($params, 'key');
39+
$ttl = array_get($params, 'ttl');
40+
$score = array_get($params, 'score');
41+
$member = array_get($params, 'member');
4342

4443
$this->getConnection()->zadd($key, [$member => $score]);
4544

@@ -57,13 +56,14 @@ public function store(array $params)
5756
* Remove a member from a sorted set.
5857
*
5958
* @param array $params
59+
*
6060
* @return int
6161
*/
6262
public function remove(array $params)
6363
{
64-
$key = array_get($params, 'key');
64+
$key = array_get($params, 'key');
6565
$member = array_get($params, 'member');
6666

6767
return $this->getConnection()->zrem($key, $member);
6868
}
69-
}
69+
}

src/DataType/Strings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public function update(array $params)
2525
*/
2626
public function store(array $params)
2727
{
28-
$key = array_get($params, 'key');
29-
$value = array_get($params, 'value');
30-
$ttl = array_get($params, 'ttl');
28+
$key = array_get($params, 'key');
29+
$value = array_get($params, 'value');
30+
$ttl = array_get($params, 'ttl');
3131

3232
$this->getConnection()->set($key, $value);
3333

@@ -36,7 +36,7 @@ public function store(array $params)
3636
}
3737

3838
return redirect(route('redis-index', [
39-
'conn' => request('conn')
39+
'conn' => request('conn'),
4040
]));
4141
}
42-
}
42+
}

src/RedisController.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
class RedisController extends BaseController
1212
{
1313
/**
14-
* Index page
14+
* Index page.
1515
*
1616
* @return Content
1717
*/
1818
public function index()
1919
{
2020
return Admin::content(function (Content $content) {
21-
2221
$content->header('Redis manager');
2322
$content->description('Connections');
2423
$content->breadcrumb(['text' => 'Redis manager']);
@@ -51,7 +50,6 @@ public function index()
5150
public function edit(Request $request)
5251
{
5352
return Admin::content(function (Content $content) use ($request) {
54-
5553
$connection = $request->get('conn', 'default');
5654

5755
$manager = $this->manager();
@@ -80,15 +78,15 @@ public function edit(Request $request)
8078
}
8179

8280
/**
83-
* Create page
81+
* Create page.
8482
*
8583
* @param Request $request
84+
*
8685
* @return Content
8786
*/
8887
public function create(Request $request)
8988
{
9089
return Admin::content(function (Content $content) use ($request) {
91-
9290
$connection = $request->get('conn', 'default');
9391

9492
$manager = $this->manager();
@@ -136,6 +134,7 @@ public function destroy(Request $request)
136134

137135
/**
138136
* @param Request $request
137+
*
139138
* @return array
140139
*/
141140
public function fetch(Request $request)
@@ -145,6 +144,7 @@ public function fetch(Request $request)
145144

146145
/**
147146
* @param Request $request
147+
*
148148
* @return mixed
149149
*/
150150
public function remove(Request $request)
@@ -156,6 +156,7 @@ public function remove(Request $request)
156156

157157
/**
158158
* @param Request $request
159+
*
159160
* @return mixed
160161
*/
161162
public function update(Request $request)
@@ -173,7 +174,6 @@ public function update(Request $request)
173174
public function console(Request $request)
174175
{
175176
return Admin::content(function (Content $content) use ($request) {
176-
177177
$connection = $request->get('conn', 'default');
178178

179179
$manager = $this->manager();
@@ -197,7 +197,7 @@ public function console(Request $request)
197197
}
198198

199199
/**
200-
* Execute a redis command
200+
* Execute a redis command.
201201
*
202202
* @param Request $request
203203
*
@@ -224,6 +224,7 @@ public function execute(Request $request)
224224
* Render exception.
225225
*
226226
* @param \Exception $exception
227+
*
227228
* @return string
228229
*/
229230
protected function renderException(\Exception $exception)
@@ -265,4 +266,4 @@ protected function manager()
265266

266267
return RedisManager::instance($conn);
267268
}
268-
}
269+
}

0 commit comments

Comments
 (0)