Lines 100.00% 7 / 7
Functions and Methods 100.00% 3 / 3
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Office 100.00% 7 / 7 100.00% 3 / 3 4 100.00% 1 / 1
 parseData 100.00% 5 / 5 100.00% 1 / 1 2
 fetchList 100.00% 1 / 1 100.00% 1 / 1 1
 fetchPath 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3/**
4 * @package 115Mandant
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsdldb\File;
9
10use BO\Zmsdldb\Entity\Office as Entity;
11use BO\Zmsdldb\Collection\Offices as Collection;
12
13/**
14  * Common methods shared by access classes
15  *
16  * @extends Base<Collection, Entity>
17  */
18class Office extends Base
19{
20    /**
21     * @return Collection
22     */
23    #[\Override]
24    protected function parseData(mixed $data)
25    {
26        $itemList = new Collection();
27        foreach ($data['data']['office'] as $item) {
28            $itemList[$item['path']] = new Entity($item);
29            $itemList[$item['plural']] = $itemList[$item['path']];
30        }
31        return $itemList;
32    }
33
34    public function fetchList(): \BO\Zmsdldb\Collection\Base
35    {
36        return $this->getItemList();
37    }
38
39    /** @psalm-api */
40    public function fetchPath(string $itemId): \BO\Zmsdldb\Entity\Base|false
41    {
42        return $this->fetchId($itemId);
43    }
44}