Passed
Pull Request — master (#1366)
by Asmir
09:41
created

VirtualPropertyMetadata::unserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Metadata;
6
7
class VirtualPropertyMetadata extends PropertyMetadata
8
{
9 43
    public function __construct(string $class, string $methodName)
10
    {
11 43
        if (0 === strpos($methodName, 'get')) {
12 43
            $fieldName = lcfirst(substr($methodName, 3));
13
        } else {
14 9
            $fieldName = $methodName;
15
        }
16
17 43
        $this->class = $class;
18 43
        $this->name = $fieldName;
19 43
        $this->getter = $methodName;
20 43
        $this->readOnly = true;
21 43
    }
22
23 41
    public function setAccessor(string $type, ?string $getter = null, ?string $setter = null): void
24
    {
25 41
    }
26
}
27