SerializerHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getSerializedNameAttribute() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FRZB\Component\RequestMapper\Helper;
6
7
use Fp\Collections\ArrayList;
8
use JetBrains\PhpStorm\Immutable;
9
use Symfony\Component\Serializer\Annotation\SerializedName;
10
11
/** @internal */
12
#[Immutable]
13
final class SerializerHelper
14
{
15
    private function __construct()
16
    {
17
    }
18
19 22
    public static function getSerializedNameAttribute(\ReflectionProperty|\ReflectionParameter $rProperty): SerializedName
20
    {
21 22
        return ArrayList::collect(AttributeHelper::getAttributes($rProperty, SerializedName::class))
22 22
            ->firstElement()
23 22
            ->getOrElse(new SerializedName($rProperty->getName()))
24
        ;
25
    }
26
}
27