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/** 14 * @XmlRoot("author") 15 * @ReadOnly 16 */ 17class AuthorReadOnlyPerClass 18{ 19 /** 20 * @ReadOnly 21 * @SerializedName("id") 22 */ 23 private $id; 24 25 /** 26 * @Type("string") 27 * @SerializedName("full_name") 28 * @Accessor("getName") 29 * @ReadOnly(false) 30 */ 31 private $name; 32 33 public function __construct($id, $name) 34 { 35 $this->id = $id; 36 $this->name = $name; 37 } 38 39 public function getId() 40 { 41 return $this->id; 42 } 43 44 public function getName() 45 { 46 return $this->name; 47 } 48} 49