UpperCaseMethodNamingStrategy::translateToGetter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
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