UpperCaseMethodNamingStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 27
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A translateToSetter() 0 3 1
A translateToGetter() 0 5 1
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
declare(strict_types=1);
8
9
namespace Tebru\Gson\Internal\Naming;
10
11
use Tebru\Gson\MethodNamingStrategy;
12
13
/**
14
 * Class UpperCaseMethodNamingStrategy
15
 *
16
 * @author Nate Brunette <[email protected]>
17
 */
18
final class UpperCaseMethodNamingStrategy implements MethodNamingStrategy
19
{
20
    /**
21
     * Accepts the PHP class property name and returns an array of the names
22
     * of acceptable getter methods
23
     *
24
     * @param string $propertyName
25
     * @return array
26
     */
27 5
    public function translateToGetter(string $propertyName): array
28
    {
29
        return [
30 5
            'get' . ucfirst($propertyName),
31 5
            'is' . ucfirst($propertyName),
32
        ];
33
    }
34
35
    /**
36
     * Accepts the PHP class property name and returns an array of the names
37
     * of acceptable setter methods
38
     *
39
     * @param string $propertyName
40
     * @return array
41
     */
42 5
    public function translateToSetter(string $propertyName): array
43
    {
44 5
        return ['set' . ucfirst($propertyName)];
45
    }
46
}
47