Statement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * Sandro Keil (https://sandro-keil.de)
4
 *
5
 * @link      http://github.com/sandrokeil/arangodb-php-client for the canonical source repository
6
 * @copyright Copyright (c) 2018-2020 Sandro Keil
7
 * @license   http://github.com/sandrokeil/arangodb-php-client/blob/master/LICENSE.md New BSD License
8
 */
9
10
declare(strict_types=1);
11
12
namespace ArangoDb\Handler;
13
14
use ArangoDb\Http\TypeSupport;
15
use ArangoDb\Statement\Statement as StatementStatement;
16
use ArangoDb\Statement\StreamHandlerFactoryInterface;
17
use ArangoDb\Type\Cursor;
18
19
final class Statement implements StatementHandler
20
{
21
    /**
22
     * @var TypeSupport
23
     **/
24
    private $client;
25
26
    /**
27
     * @var StreamHandlerFactoryInterface
28
     */
29
    private $streamHandlerFactory;
30
31
    public function __construct(TypeSupport $client, StreamHandlerFactoryInterface $streamHandlerFactory)
32
    {
33
        $this->client = $client;
34
        $this->streamHandlerFactory = $streamHandlerFactory;
35
    }
36
37
    public function create(
38
        string $query,
39
        array $bindVars = [],
40
        int $batchSize = null,
41
        bool $count = false,
42
        bool $cache = null,
43
        array $options = []
44
    ): StatementStatement {
45
        return new StatementStatement(
46
            $this->client,
47
            Cursor::create(
48
                $query,
49
                $bindVars,
50
                $batchSize,
51
                $count,
52
                $cache,
53
                $options
54
            ),
55
            $this->streamHandlerFactory
56
        );
57
    }
58
}
59