Passed
Pull Request — 0.6.x (#205)
by
unknown
02:28 queued 36s
created

PerBinarySymbolCacheRetriever::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the reliforp/reli-prof package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Reli\Lib\Elf\Process;
15
16
use Reli\Lib\Elf\SymbolResolver\Elf64SymbolCache;
17
18
final class PerBinarySymbolCacheRetriever
19
{
20
    /** @var array<string, Elf64SymbolCache> */
21
    private array $cache = [];
22
23
    public function get(BinaryFingerprint $binary_fingerprint): Elf64SymbolCache
24
    {
25
        if (!isset($this->cache[(string)$binary_fingerprint])) {
26
            $this->cache[(string)$binary_fingerprint] = new Elf64SymbolCache();
27
        }
28
        return $this->cache[(string)$binary_fingerprint];
29
    }
30
}
31