Passed
Push — next ( fad6bc...2b9454 )
by Bas
02:29
created

AdministrationClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
dl 0
loc 34
c 1
b 0
f 0
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A version() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArangoClient\Administration;
6
7
use ArangoClient\Connector;
8
use ArangoClient\Exceptions\ArangoException;
9
use GuzzleHttp\Exception\GuzzleException;
10
11
class AdministrationClient
12
{
13
    /**
14
     * @var Connector
15
     */
16
    protected Connector $connector;
17
18
    /**
19
     * Documents constructor.
20
     * @param  Connector  $connector
21
     */
22 21
    public function __construct(Connector $connector)
23
    {
24 21
        $this->connector = $connector;
25 21
    }
26
27
    /**
28
     *
29
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
30
     *
31
     * @param  bool  $details
32
     * @return array<mixed>
33
     *
34
     * @throws ArangoException
35
     * @throws GuzzleException
36
     */
37 2
    public function version(bool $details = false): array
38
    {
39 2
        return (array) $this->connector->request(
40 2
            'get',
41 2
            '/_api/version',
42
            [
43
                'query' => [
44 2
                    'details' => $details
45
                ]
46
            ]
47
        );
48
    }
49
}
50