1010
1111namespace OpenCodeModeling \JsonSchemaToPhp \Type ;
1212
13- final class ReferenceType implements TypeDefinition, RequiredAware, NullableAware, TitleAware
13+ final class ReferenceType implements TypeDefinition, RequiredAware, NullableAware, TitleAware, CustomSupport
1414{
1515 protected ?TypeSet $ resolvedType = null ;
1616 protected ?string $ name = null ;
@@ -19,6 +19,11 @@ final class ReferenceType implements TypeDefinition, RequiredAware, NullableAwar
1919 protected bool $ nullable = false ;
2020 protected ?string $ title = null ;
2121
22+ /**
23+ * @var array<string, mixed>
24+ */
25+ protected array $ custom = [];
26+
2227 private function __construct ()
2328 {
2429 }
@@ -39,6 +44,8 @@ public static function fromDefinition(array $definition, ?string $name = null):
3944 foreach ($ definition as $ definitionKey => $ definitionValue ) {
4045 if (\property_exists ($ self , $ definitionKey )) {
4146 $ self ->$ definitionKey = $ definitionValue ;
47+ } elseif ($ definitionKey !== '$ref ' ) {
48+ $ self ->custom [$ definitionKey ] = $ definitionValue ;
4249 }
4350 }
4451
@@ -125,4 +132,14 @@ public function setTitle(string $title): void
125132 {
126133 $ this ->title = $ title ;
127134 }
135+
136+ /**
137+ * Returns custom definitions
138+ *
139+ * @return array<string, mixed>
140+ */
141+ public function custom (): array
142+ {
143+ return $ this ->custom ;
144+ }
128145}
0 commit comments