1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Metadata;
6
7class VirtualPropertyMetadata extends PropertyMetadata
8{
9    public function __construct(string $class, string $methodName)
10    {
11        if (0 === strpos($methodName, 'get')) {
12            $fieldName = lcfirst(substr($methodName, 3));
13        } else {
14            $fieldName = $methodName;
15        }
16
17        $this->class = $class;
18        $this->name = $fieldName;
19        $this->getter = $methodName;
20        $this->readOnly = true;
21    }
22
23    public function setAccessor(string $type, ?string $getter = null, ?string $setter = null): void
24    {
25    }
26
27    /**
28     * {@inheritdoc}
29     */
30    public function unserialize($str)
31    {
32        $parentStr = $this->unserializeProperties($str);
33        [$this->class, $this->name] = unserialize($parentStr);
34    }
35}
36