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

fractalzombie / frzb-request-mapper / 7325848574

26 Dec 2023 02:06AM UTC coverage: 86.877% (-0.4%) from 87.277%
7325848574

push

github

fractalzombie
[RequestMapper] Update Dependencies, update functional library with breaking changes

35 of 39 new or added lines in 26 files covered. (89.74%)

8 existing lines in 2 files now uncovered.

331 of 381 relevant lines covered (86.88%)

18.3 hits per line

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

55.56
/TypeExtractor/TypeExtractorLocator.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
7
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
9
 *
10
 * Copyright (c) 2023 Mykhailo Shtanko fractalzombie@gmail.com
11
 *
12
 * For the full copyright and license information, please view the LICENSE.MD
13
 * file that was distributed with this source code.
14
 */
15

16
namespace FRZB\Component\RequestMapper\TypeExtractor;
17

18
use Fp\Collections\ArrayList;
19
use FRZB\Component\DependencyInjection\Attribute\AsService;
20
use FRZB\Component\RequestMapper\Exception\TypeExtractorLocatorException;
21
use FRZB\Component\RequestMapper\TypeExtractor\Extractor\TypeExtractorInterface as TypeExtractor;
22
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
23

24
#[AsService]
25
class TypeExtractorLocator implements TypeExtractorLocatorInterface
26
{
27
    /** @var ArrayList<TypeExtractor> */
28
    private readonly ArrayList $extractors;
29

30
    public function __construct(
31
        #[TaggedIterator(TypeExtractor::class)]
32
        iterable $extractors,
33
    ) {
34
        $this->extractors = ArrayList::collect($extractors);
40✔
35
    }
36

37
    public function get(\ReflectionParameter|\ReflectionProperty $target): TypeExtractor
38
    {
39
        return $this->extractors
×
40
            ->first(static fn (TypeExtractor $extractor) => $extractor->canExtract($target))
×
NEW
41
            ->getOrElse(fn () => throw TypeExtractorLocatorException::notFound($target))
×
42
        ;
×
43
    }
44

45
    public function has(\ReflectionParameter|\ReflectionProperty $target): bool
46
    {
47
        return $this->extractors
40✔
48
            ->first(static fn (TypeExtractor $extractor) => $extractor->canExtract($target))
40✔
49
            ->isSome()
40✔
50
        ;
40✔
51
    }
52
}
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