• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NIT-Administrative-Systems / dynamic-forms / 3874968769

pending completion
3874968769

push

github

GitHub
PHP 8.2 Support (#383)

1182 of 1279 relevant lines covered (92.42%)

62.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ResourceRegistry.php
1
<?php
2

3
namespace Northwestern\SysDev\DynamicForms;
4

5
use Illuminate\Support\Arr;
6
use Northwestern\SysDev\DynamicForms\Errors\UnknownResourceError;
7
use Northwestern\SysDev\DynamicForms\Resources\ResourceInterface;
8

9
class ResourceRegistry
10
{
11
    protected array $resources;
12

13
    public function __construct()
14
    {
15
    }
×
16

17
    /**
18
     * Get the registered components.
19
     *
20
     * @return ResourceInterface[] Associative array, keyed by the component's type
21
     */
22
    public function registered(): array
23
    {
24
        return $this->resources;
×
25
    }
26

27
    /**
28
     * Get the class name for a component.
29
     */
30
    public function get(string $type): string
31
    {
32
        if (! Arr::has($this->resources, $type)) {
×
33
            throw new UnknownResourceError($type);
×
34
        }
35

36
        return $this->resources[$type];
×
37
    }
38

39
    /**
40
     * Registers a resource class.
41
     *
42
     * @param string $resource
43
     */
44
    public function register(string $resource): void
45
    {
46
        $this->resources[$resource::indexName()] = $resource;
×
47
    }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc