GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Push — master ( da7eaf...ab8466 )
by Pierre-Luc
06:16
created

Builder::insert()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 34
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 8.5806
c 0
b 0
f 0
cc 4
eloc 16
nc 4
nop 1
1
<?php
2
3
namespace fuitad\LaravelCassandra\Query;
4
5
use fuitad\LaravelCassandra\Connection;
6
use Illuminate\Database\Query\Builder as BaseBuilder;
7
use Illuminate\Support\Arr;
8
9
class Builder extends BaseBuilder
10
{
11
    /**
12
     * @inheritdoc
13
     */
14
    public function __construct(Connection $connection, Processor $processor)
15
    {
16
        $this->grammar = new Grammar;
17
        $this->connection = $connection;
18
        $this->processor = $processor;
19
    }
20
21
    /**
22
     * Insert a new record into the database.
23
     *
24
     * @param  array  $values
25
     * @return bool
26
     */
27
    public function insert(array $values)
28
    {
29
        // Since every insert gets treated like a batch insert, we will make sure the
30
        // bindings are structured in a way that is convenient when building these
31
        // inserts statements by verifying these elements are actually an array.
32
        if (empty($values)) {
33
            return true;
34
        }
35
36
        if (!is_array(reset($values))) {
37
            $values = [$values];
38
39
            return $this->connection->insert(
40
                $this->grammar->compileInsert($this, $values),
41
                $this->cleanBindings(Arr::flatten($values, 1))
42
            );
43
        }
44
45
        // Here, we'll generate the insert queries for every record and send those
46
        // for a batch query
47
        else {
48
            $queries = [];
49
            $bindings = [];
50
51
            foreach ($values as $key => $value) {
52
                ksort($value);
53
54
                $queries[] = $this->grammar->compileInsert($this, $value);
55
                $bindings[] = $this->cleanBindings(Arr::flatten($value, 1));
56
            }
57
58
            return $this->connection->insertBulk($queries, $bindings);
0 ignored issues
show
Bug introduced by
The method insertBulk() does not exist on Illuminate\Database\Connection. Did you maybe mean insert()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
59
        }
60
    }
61
62
}
63