1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Tests\Fixtures; 6 7use JMS\Serializer\Annotation\Accessor; 8use JMS\Serializer\Annotation\ReadOnly; 9use JMS\Serializer\Annotation\SerializedName; 10use JMS\Serializer\Annotation\Type; 11use JMS\Serializer\Annotation\XmlRoot; 12 13/** @XmlRoot("author") */ 14class AuthorReadOnly 15{ 16 /** 17 * @ReadOnly 18 * @SerializedName("id") 19 */ 20 private $id; 21 22 /** 23 * @Type("string") 24 * @SerializedName("full_name") 25 * @Accessor("getName") 26 */ 27 private $name; 28 29 public function __construct($id, $name) 30 { 31 $this->id = $id; 32 $this->name = $name; 33 } 34 35 public function getId() 36 { 37 return $this->id; 38 } 39 40 public function getName() 41 { 42 return $this->name; 43 } 44} 45