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

api-platform / core / 7142557150

08 Dec 2023 02:28PM UTC coverage: 36.003% (-1.4%) from 37.36%
7142557150

push

github

web-flow
fix(jsonld): remove link to ApiDocumentation when doc is disabled (#6029)

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

2297 existing lines in 182 files now uncovered.

9992 of 27753 relevant lines covered (36.0%)

147.09 hits per line

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

50.0
/src/Metadata/Util/Inflector.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\Metadata\Util;
15

16
use Doctrine\Inflector\Inflector as LegacyInflector;
17
use Doctrine\Inflector\InflectorFactory;
18
use Symfony\Component\String\Inflector\EnglishInflector;
19
use Symfony\Component\String\UnicodeString;
20

21
/**
22
 * @internal
23
 */
24
final class Inflector
25
{
26
    private static bool $keepLegacyInflector = true;
27
    private static ?LegacyInflector $instance = null;
28

29
    private static function getInstance(): LegacyInflector
30
    {
31
        return static::$instance
×
32
            ?? static::$instance = InflectorFactory::create()->build();
×
33
    }
34

35
    public static function keepLegacyInflector(bool $keepLegacyInflector): void
36
    {
UNCOV
37
        static::$keepLegacyInflector = $keepLegacyInflector;
×
38
    }
39

40
    /**
41
     * @see InflectorObject::tableize()
42
     */
43
    public static function tableize(string $word): string
44
    {
45
        if (!static::$keepLegacyInflector) {
72✔
46
            return (new UnicodeString($word))->snake()->toString();
72✔
47
        }
48

49
        return static::getInstance()->tableize($word);
×
50
    }
51

52
    /**
53
     * @see InflectorObject::pluralize()
54
     */
55
    public static function pluralize(string $word): string
56
    {
57
        if (!static::$keepLegacyInflector) {
480✔
58
            $pluralize = (new EnglishInflector())->pluralize($word);
480✔
59

60
            return end($pluralize);
480✔
61
        }
62

63
        return self::getInstance()->pluralize($word);
×
64
    }
65
}
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

© 2026 Coveralls, Inc