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

StorageNodeTrait::getManyToOneDataLoader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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