FormatAsSnake::accessor_format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 6
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
/**
15
 * Formats accessor method using snake case.
16
 */
17
trait FormatAsSnake
18
{
19
    public static function accessor_format(
20
        string $property,
21
        string $type,
22
        string $lazy = HasAccessor::ACCESSOR_IS_NOT_LAZY
23
    ): string {
24
        return ($lazy ? $lazy . '_' : '') . $type . '_' . $property;
25
    }
26
}
27