Completed
Push — 2.x ( 028541...76d6cb )
by Cy
12s
created

PredisSentinelConnection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transaction() 0 8 2
1
<?php
2
3
namespace Monospice\LaravelRedisSentinel\Connections;
4
5
use Illuminate\Redis\Connections\PredisConnection;
6
7
class PredisSentinelConnection extends PredisConnection
8
{
9
    /**
10
     * Execute commands in a transaction.  Avoids use of Predis transaction
11
     * which does not support aggregate connections.  Mirrors implementation
12
     * of PhpRedisConnection::transaction() in core Framework.
13
     *
14
     * @param  callable  $callback
0 ignored issues
show
Documentation introduced by
Should the type for parameter $callback not be null|callable? Also, consider making the array more specific, something like array<String>, or String[].

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type array and suggests a stricter type like array<String>.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
15
     * @return \Redis|array
16
     */
17
    public function transaction(callable $callback = null)
18
    {
19
        $transaction = $this->client()->multi();
20
21
        return is_null($callback)
22
            ? $transaction
23
            : tap($this->client(), $callback)->exec();
24
    }
25
}