Passed
Pull Request — master (#172)
by David
06:43
created

StorageNodeTrait::hasManyToOneDataLoader()   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
7
trait StorageNodeTrait
8
{
9
    /**
10
     * @var array<string, ManyToOneDataLoader>
11
     */
12
    private $manyToOneDataLoaders = [];
13
14
    public function getManyToOneDataLoader(string $key): ManyToOneDataLoader
15
    {
16
        return $this->manyToOneDataLoaders[$key];
17
    }
18
19
    public function hasManyToOneDataLoader(string $key): bool
20
    {
21
        return isset($this->manyToOneDataLoaders[$key]);
22
    }
23
24
    public function setManyToOneDataLoader(string $key, ManyToOneDataLoader $manyToOneDataLoader): void
25
    {
26
        $this->manyToOneDataLoaders[$key] = $manyToOneDataLoader;
27
    }
28
}
29