Completed
Push — master ( ebef86...fab750 )
by Taosikai
15:07
created

Inflector::singularize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the slince/shopify-api-php
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Slince\Shopify;
13
14
use Doctrine\Inflector\InflectorFactory;
15
16
final class Inflector
17
{
18
    /**
19
     * @var \Doctrine\Inflector\Inflector
20
     */
21
    protected static $inflector;
22
23
    protected static function getInflector()
24
    {
25
        if (null !== static::$inflector) {
26
            return static::$inflector;
27
        }
28
        return static::$inflector = InflectorFactory::create()->build();
29
    }
30
31
    public static function pluralize(string $word)
32
    {
33
        return static::getInflector()->pluralize($word);
34
    }
35
36
    public static function tableize(string $word)
37
    {
38
        return static::getInflector()->tableize($word);
39
    }
40
41
    public static function singularize(string $word)
42
    {
43
        return static::getInflector()->singularize($word);
44
    }
45
}