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

MichaelJ2324 / PHP-REST-Client / 15140958998

20 May 2025 02:58PM UTC coverage: 98.369%. Remained the same
15140958998

push

github

MichaelJ2324
Fix `Undefined array key 0` Error

0 of 2 new or added lines in 1 file covered. (0.0%)

1146 of 1165 relevant lines covered (98.37%)

1.56 hits per line

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

0.0
/src/Endpoint/Provider/AbstractMultiVersionEndpointProvider.php
1
<?php
2

3
namespace MRussell\REST\Endpoint\Provider;
4

5
abstract class AbstractMultiVersionEndpointProvider extends AbstractEndpointProvider
6
{
7
    protected function addEndpointRegistry(string $name, array $properties): void
×
8
    {
9
        if (isset($properties[self::ENDPOINT_NAME])) {
×
10
            $properties[self::ENDPOINT_NAME] = $name;
×
11
        }
12

13
        $next = count($this->registry);
×
NEW
14
        parent::addEndpointRegistry((string)$next, $properties);
×
15
    }
16

17
    protected function getEndpointDefinition(string $name, string $version = null): array
×
18
    {
19
        $eps = array_filter($this->registry, function ($definition) use ($name, $version): bool {
×
20
            if (($valid = $definition[self::ENDPOINT_NAME] === $name) && !empty($definition[self::ENDPOINT_VERSIONS])) {
×
21
                $ranges = $definition[self::ENDPOINT_VERSIONS];
×
22
                if (is_string($ranges)) {
×
23
                    $ranges = [$ranges];
×
24
                }
25

26
                $valid = $this->isInVersionRange($version, $ranges);
×
27
            }
28

29
            return $valid;
×
30
        });
×
31
        rsort($eps);
×
32
        
NEW
33
        return $eps[0] ?? [];
×
34
    }
35
}
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