Failed Conditions
Push — next ( 1e4ade...f47ec0 )
by Bas
04:16 queued 11s
created

HasManagers::schema()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArangoClient;
6
7
use ArangoClient\Admin\AdminManager;
8
use ArangoClient\Schema\SchemaManager;
9
10
trait HasManagers
11
{
12
13
    /**
14
     * @var AdminManager|null
15
     */
16
    protected ?AdminManager $adminManager = null;
17
18
    /**
19
     * @var SchemaManager|null
20
     */
21
    protected ?SchemaManager $schemaManager = null;
22
23
    /**
24
     * @return AdminManager
25
     */
26 9
    public function admin(): AdminManager
27
    {
28 9
        if (! isset($this->adminManager)) {
29 9
            $this->adminManager = new AdminManager($this);
30
        }
31 9
        return $this->adminManager;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->adminManager could return the type null which is incompatible with the type-hinted return ArangoClient\Admin\AdminManager. Consider adding an additional type-check to rule them out.
Loading history...
32
    }
33
34 82
    public function schema(): SchemaManager
35
    {
36 82
        if (! isset($this->schemaManager)) {
37 82
            $this->schemaManager = new SchemaManager($this);
38
        }
39 82
        return $this->schemaManager;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->schemaManager could return the type null which is incompatible with the type-hinted return ArangoClient\Schema\SchemaManager. Consider adding an additional type-check to rule them out.
Loading history...
40
    }
41
}
42