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

api-platform / core / 10638675968

30 Aug 2024 08:19PM UTC coverage: 74.332% (+10.4%) from 63.901%
10638675968

push

github

web-flow
chore: deprecations (#6563)

* chore: deprecations

* chore: deprecations

5 of 5 new or added lines in 3 files covered. (100.0%)

100 existing lines in 9 files now uncovered.

3226 of 4340 relevant lines covered (74.33%)

77.04 hits per line

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

0.0
/src/Util/Reflection.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Util;
15

16
/**
17
 * Reflection utilities.
18
 *
19
 * @internal
20
 *
21
 * @author Kévin Dunglas <dunglas@gmail.com>
22
 */
23
final class Reflection
24
{
25
    public const ACCESSOR_PREFIXES = ['get', 'is', 'has', 'can'];
26
    public const MUTATOR_PREFIXES = ['set', 'add', 'remove'];
27

28
    /**
29
     * Gets the property name associated with an accessor method.
30
     */
31
    public function getProperty(string $methodName): ?string
32
    {
UNCOV
33
        $pattern = implode('|', array_merge(self::ACCESSOR_PREFIXES, self::MUTATOR_PREFIXES));
×
34

UNCOV
35
        if (preg_match('/^('.$pattern.')(.+)$/i', $methodName, $matches)) {
×
UNCOV
36
            return $matches[2];
×
37
        }
38

UNCOV
39
        return null;
×
40
    }
41
}
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