Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
GeneratedCodeHashmap
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
3 / 3
6
100.00% covered (success)
100.00%
1 / 1
 offsetGet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getObjectsWithInterface
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
3
 toStringHashmap
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Apie\StorageMetadataBuilder\Lists;
3
4use Apie\Core\Lists\ItemHashmap;
5use Apie\Core\Lists\StringHashmap;
6use Nette\PhpGenerator\ClassType;
7
8final class GeneratedCodeHashmap extends ItemHashmap
9{
10    public function offsetGet(mixed $offset): ClassType
11    {
12        return parent::offsetGet($offset);
13    }
14
15    public function getObjectsWithInterface(string $interface): self
16    {
17        $internal = [];
18        foreach ($this as $file => $code) {
19            if (in_array($interface, $code->getImplements())) {
20                $internal[$file] = $code;
21            }
22        }
23        return new self($internal);
24    }
25
26    public function toStringHashmap(): StringHashmap
27    {
28        $list = [];
29        foreach ($this as $filename => $code) {
30            $list[$filename] = (string) $code;
31        }
32        return new StringHashmap($list);
33    }
34}