Passed
Push — next ( 737617...5ddafc )
by Bas
13:34 queued 11:32
created

HasManagers::monitor()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 2
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArangoClient;
6
7
use ArangoClient\Admin\AdminManager;
8
use ArangoClient\Monitor\MonitorManager;
9
use ArangoClient\Schema\SchemaManager;
10
11
trait HasManagers
12
{
13
    protected ?AdminManager $adminManager = null;
14
15
    protected ?MonitorManager $monitorManager = null;
16
17
    protected ?SchemaManager $schemaManager = null;
18
19 9
    public function admin(): AdminManager
20
    {
21 9
        if (!(property_exists($this, 'adminManager') && $this->adminManager !== null)) {
22 9
            $this->adminManager = new AdminManager($this);
23
        }
24
25 9
        return $this->adminManager;
26
    }
27
28 1
    public function monitor(): MonitorManager
29
    {
30 1
        if (!(property_exists($this, 'monitorManager') && $this->monitorManager !== null)) {
31 1
            $this->monitorManager = new MonitorManager($this);
32
        }
33
34 1
        return $this->monitorManager;
35
    }
36
37 117
    public function schema(): SchemaManager
38
    {
39 117
        if (!(property_exists($this, 'schemaManager') && $this->schemaManager !== null)) {
40 117
            $this->schemaManager = new SchemaManager($this);
41
        }
42
43 117
        return $this->schemaManager;
44
    }
45
}
46