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

HasManagers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A admin() 0 6 2
A schema() 0 6 2
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