Passed
Push — claude/understand-crawl-pLOr9 ( efe806 )
by Akihito
02:23
created

Results   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A has() 0 3 1
A get() 0 3 1
A toArray() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Batch;
6
7
use function array_key_exists;
8
9
/**
10
 * Batch processing results mapped by URI
11
 */
12
final class Results
13
{
14
    /**
15
     * @param array<string, mixed> $results URI => result mapping
16
     */
17
    public function __construct(
18
        private readonly array $results,
19
    ) {
20
    }
21
22
    /**
23
     * Get result for a specific URI
24
     */
25
    public function get(string $uri): mixed
26
    {
27
        return $this->results[$uri] ?? null;
28
    }
29
30
    /**
31
     * Check if result exists for a URI
32
     */
33
    public function has(string $uri): bool
34
    {
35
        return array_key_exists($uri, $this->results);
36
    }
37
38
    /**
39
     * Get all results as array
40
     *
41
     * @return array<string, mixed>
42
     */
43
    public function toArray(): array
44
    {
45
        return $this->results;
46
    }
47
}
48