Passed
Pull Request — master (#172)
by David
02:33
created

StorageNodeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
eloc 5
c 2
b 1
f 0
dl 0
loc 20
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setManyToOneDataLoader() 0 3 1
A getManyToOneDataLoader() 0 3 1
A hasManyToOneDataLoader() 0 3 1
1
<?php
2
3
4
namespace TheCodingMachine\TDBM\QueryFactory\SmartEagerLoad;
5
6
trait StorageNodeTrait
7
{
8
    /**
9
     * @var array<string, ManyToOneDataLoader>
10
     */
11
    private $manyToOneDataLoaders = [];
12
13
    public function getManyToOneDataLoader(string $key): ManyToOneDataLoader
14
    {
15
        return $this->manyToOneDataLoaders[$key];
16
    }
17
18
    public function hasManyToOneDataLoader(string $key): bool
19
    {
20
        return isset($this->manyToOneDataLoaders[$key]);
21
    }
22
23
    public function setManyToOneDataLoader(string $key, ManyToOneDataLoader $manyToOneDataLoader): void
24
    {
25
        $this->manyToOneDataLoaders[$key] = $manyToOneDataLoader;
26
    }
27
}
28