FormatAsCamel::accessor_format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 3
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
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
namespace ICanBoogie\Accessor;
13
14
use function ucfirst;
15
16
/**
17
 * Formats accessor method using CamelCase.
18
 */
19
trait FormatAsCamel
20
{
21
    public static function accessor_format(
22
        string $property,
23
        string $type,
24
        string $lazy = HasAccessor::ACCESSOR_IS_NOT_LAZY
25
    ): string {
26
        $format = $type . ucfirst($property);
27
28
        return $lazy ? $lazy . ucfirst($format) : $format;
29
    }
30
}
31