HelpersTrait::makeConstantName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zvermafia\Larastate\Traits;
6
7
use Illuminate\Support\Str;
8
9
trait HelpersTrait
10
{
11
    /**
12
     * Make snake_case from the given camelCase or StudlyCase.
13
     *
14
     * @param string $value
15
     * @return string
16
     */
17
    private function makeSnakeCase(string $value): string
18
    {
19
        return Str::snake($value);
20
    }
21
22
    /**
23
     * Make constant name from the given state name in StudlyCase.
24
     *
25
     * @param string $state_name
26
     * @return string
27
     */
28
    private function makeConstantName(string $state_name): string
29
    {
30
        return strtoupper(Str::snake($state_name));
31
    }
32
}
33