D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
plib
/
vendor
/
jms
/
serializer
/
src
/
Annotation
/
Filename :
VirtualProperty.php
back
Copy
<?php declare(strict_types=1); namespace JMS\Serializer\Annotation; /** * @Annotation * @Target({"METHOD", "CLASS"}) * * @author Alexander Klimenkov <alx.devel@gmail.com> */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] final class VirtualProperty implements SerializerAttribute { use AnnotationUtilsTrait; /** * @var string|null */ public $exp = null; /** * @var string|null */ public $name = null; /** * @var array */ public $options = []; public function __construct($values = [], ?string $name = null, ?string $exp = null, array $options = []) { $vars = get_defined_vars(); unset($vars['options']); $this->loadAnnotationParameters($vars); if (0 !== count($options)) { $this->options = $options; } foreach ($options as $option) { if (is_array($option) && class_exists($option[0])) { $this->options[] = new $option[0]([], ...$option[1]); continue; } $this->options[] = $option; } } }