@@ -61,6 +61,9 @@ class Item implements SerializableInterface, JsonSerializable
61
61
62
62
private $ mandatoryAnyOf ;
63
63
64
+ /** @var string|null */
65
+ private $ mandatoryNullableStringWithMinMaxLength ;
66
+
64
67
/** @var int|null */
65
68
private $ optionalInteger ;
66
69
@@ -118,18 +121,22 @@ class Item implements SerializableInterface, JsonSerializable
118
121
/** @var EmbeddedObject|null */
119
122
private $ optionalObject ;
120
123
124
+ /** @var string|null */
125
+ private $ optionalNullableStringWithMinMaxLength ;
126
+
121
127
/** @var array */
122
- private $ optionalPropertyChanged = ['optionalInteger ' => false , 'optionalString ' => false , 'optionalEnum ' => false , 'optionalIntEnum ' => false , 'optionalDate ' => false , 'optionalFloat ' => false , 'optionalBoolean ' => false , 'optionalNullableBoolean ' => false , 'optionalArray ' => false , 'optionalNullableArray ' => false , 'optionalMixedArray ' => false , 'optionalArrayWithMinMaxItems ' => false , 'optionalStringWithMinMaxLength ' => false , 'optionalStringWithPattern ' => false , 'optionalIntegerBetweenIncluded ' => false , 'optionalIntegerBetweenExcluded ' => false , 'optionalNumberBetweenIncluded ' => false , 'optionalNumberBetweenExcluded ' => false , 'optionalObject ' => false ];
128
+ private $ optionalPropertyChanged = ['optionalInteger ' => false , 'optionalString ' => false , 'optionalEnum ' => false , 'optionalIntEnum ' => false , 'optionalDate ' => false , 'optionalFloat ' => false , 'optionalBoolean ' => false , 'optionalNullableBoolean ' => false , 'optionalArray ' => false , 'optionalNullableArray ' => false , 'optionalMixedArray ' => false , 'optionalArrayWithMinMaxItems ' => false , 'optionalStringWithMinMaxLength ' => false , 'optionalStringWithPattern ' => false , 'optionalIntegerBetweenIncluded ' => false , 'optionalIntegerBetweenExcluded ' => false , 'optionalNumberBetweenIncluded ' => false , 'optionalNumberBetweenExcluded ' => false , 'optionalObject ' => false , ' optionalNullableStringWithMinMaxLength ' => false ];
123
129
124
130
/**
125
131
* @param DateTimeInterface|null $mandatoryNullableDate
126
132
* @param string[] $mandatoryArray
127
133
* @param string[] $mandatoryArrayWithMinItems
128
134
* @param MandatoryNullableObjectWithAllOf|null $mandatoryNullableObjectWithAllOf
135
+ * @param string|null $mandatoryNullableStringWithMinMaxLength
129
136
*
130
137
* @throws RequestValidationException
131
138
*/
132
- public function __construct (int $ mandatoryInteger , string $ mandatoryString , string $ mandatoryEnum , DateTimeInterface $ mandatoryDate , $ mandatoryNullableDate , float $ mandatoryFloat , bool $ mandatoryBoolean , array $ mandatoryArray , array $ mandatoryArrayWithMinItems , ItemMandatoryObject $ mandatoryObject , $ mandatoryNullableObjectWithAllOf , $ mandatoryMixed , $ mandatoryAnyOf )
139
+ public function __construct (int $ mandatoryInteger , string $ mandatoryString , string $ mandatoryEnum , DateTimeInterface $ mandatoryDate , $ mandatoryNullableDate , float $ mandatoryFloat , bool $ mandatoryBoolean , array $ mandatoryArray , array $ mandatoryArrayWithMinItems , ItemMandatoryObject $ mandatoryObject , $ mandatoryNullableObjectWithAllOf , $ mandatoryMixed , $ mandatoryAnyOf, $ mandatoryNullableStringWithMinMaxLength )
133
140
{
134
141
$ this ->mandatoryInteger = $ mandatoryInteger ;
135
142
$ this ->mandatoryString = $ mandatoryString ;
@@ -147,6 +154,13 @@ public function __construct(int $mandatoryInteger, string $mandatoryString, stri
147
154
$ this ->mandatoryNullableObjectWithAllOf = $ mandatoryNullableObjectWithAllOf ;
148
155
$ this ->mandatoryMixed = $ mandatoryMixed ;
149
156
$ this ->mandatoryAnyOf = $ mandatoryAnyOf ;
157
+ if ($ mandatoryNullableStringWithMinMaxLength !== null && \grapheme_strlen ($ mandatoryNullableStringWithMinMaxLength ) < 1 ) {
158
+ throw new RequestValidationException (\sprintf ('Invalid %s value. Given: `%s`. Length should be greater than 1. ' , 'mandatoryNullableStringWithMinMaxLength ' , $ mandatoryNullableStringWithMinMaxLength ));
159
+ }
160
+ if ($ mandatoryNullableStringWithMinMaxLength !== null && \grapheme_strlen ($ mandatoryNullableStringWithMinMaxLength ) > 5 ) {
161
+ throw new RequestValidationException (\sprintf ('Invalid %s value. Given: `%s`. Length should be less than 5. ' , 'mandatoryNullableStringWithMinMaxLength ' , $ mandatoryNullableStringWithMinMaxLength ));
162
+ }
163
+ $ this ->mandatoryNullableStringWithMinMaxLength = $ mandatoryNullableStringWithMinMaxLength ;
150
164
}
151
165
152
166
public function setOptionalInteger (int $ optionalInteger ): self
@@ -375,6 +389,25 @@ public function setOptionalObject(EmbeddedObject $optionalObject): self
375
389
return $ this ;
376
390
}
377
391
392
+ /**
393
+ * @param string|null $optionalNullableStringWithMinMaxLength
394
+ *
395
+ * @throws RequestValidationException
396
+ */
397
+ public function setOptionalNullableStringWithMinMaxLength ($ optionalNullableStringWithMinMaxLength ): self
398
+ {
399
+ if ($ optionalNullableStringWithMinMaxLength !== null && \grapheme_strlen ($ optionalNullableStringWithMinMaxLength ) < 1 ) {
400
+ throw new RequestValidationException (\sprintf ('Invalid %s value. Given: `%s`. Length should be greater than 1. ' , 'optionalNullableStringWithMinMaxLength ' , $ optionalNullableStringWithMinMaxLength ));
401
+ }
402
+ if ($ optionalNullableStringWithMinMaxLength !== null && \grapheme_strlen ($ optionalNullableStringWithMinMaxLength ) > 5 ) {
403
+ throw new RequestValidationException (\sprintf ('Invalid %s value. Given: `%s`. Length should be less than 5. ' , 'optionalNullableStringWithMinMaxLength ' , $ optionalNullableStringWithMinMaxLength ));
404
+ }
405
+ $ this ->optionalNullableStringWithMinMaxLength = $ optionalNullableStringWithMinMaxLength ;
406
+ $ this ->optionalPropertyChanged ['optionalNullableStringWithMinMaxLength ' ] = true ;
407
+
408
+ return $ this ;
409
+ }
410
+
378
411
public function hasOptionalInteger (): bool
379
412
{
380
413
return $ this ->optionalPropertyChanged ['optionalInteger ' ];
@@ -470,6 +503,11 @@ public function hasOptionalObject(): bool
470
503
return $ this ->optionalPropertyChanged ['optionalObject ' ];
471
504
}
472
505
506
+ public function hasOptionalNullableStringWithMinMaxLength (): bool
507
+ {
508
+ return $ this ->optionalPropertyChanged ['optionalNullableStringWithMinMaxLength ' ];
509
+ }
510
+
473
511
public function getMandatoryInteger (): int
474
512
{
475
513
return $ this ->mandatoryInteger ;
@@ -547,6 +585,14 @@ public function getMandatoryAnyOf()
547
585
return $ this ->mandatoryAnyOf ;
548
586
}
549
587
588
+ /**
589
+ * @return string|null
590
+ */
591
+ public function getMandatoryNullableStringWithMinMaxLength ()
592
+ {
593
+ return $ this ->mandatoryNullableStringWithMinMaxLength ;
594
+ }
595
+
550
596
/**
551
597
* @return int|null
552
598
*/
@@ -699,22 +745,31 @@ public function getOptionalObject()
699
745
return $ this ->optionalObject ;
700
746
}
701
747
748
+ /**
749
+ * @return string|null
750
+ */
751
+ public function getOptionalNullableStringWithMinMaxLength ()
752
+ {
753
+ return $ this ->optionalNullableStringWithMinMaxLength ;
754
+ }
755
+
702
756
public function toArray (): array
703
757
{
704
- $ fields = [];
705
- $ fields ['mandatoryInteger ' ] = $ this ->mandatoryInteger ;
706
- $ fields ['mandatoryString ' ] = $ this ->mandatoryString ;
707
- $ fields ['mandatoryEnum ' ] = $ this ->mandatoryEnum ;
708
- $ fields ['mandatoryDate ' ] = $ this ->mandatoryDate ->format (DATE_RFC3339 );
709
- $ fields ['mandatoryNullableDate ' ] = $ this ->mandatoryNullableDate !== null ? $ this ->mandatoryNullableDate ->format (DATE_RFC3339 ) : null ;
710
- $ fields ['mandatoryFloat ' ] = $ this ->mandatoryFloat ;
711
- $ fields ['mandatoryBoolean ' ] = $ this ->mandatoryBoolean ;
712
- $ fields ['mandatoryArray ' ] = $ this ->mandatoryArray ;
713
- $ fields ['mandatoryArrayWithMinItems ' ] = $ this ->mandatoryArrayWithMinItems ;
714
- $ fields ['mandatoryObject ' ] = $ this ->mandatoryObject ->toArray ();
715
- $ fields ['mandatoryNullableObjectWithAllOf ' ] = $ this ->mandatoryNullableObjectWithAllOf !== null ? $ this ->mandatoryNullableObjectWithAllOf ->toArray () : null ;
716
- $ fields ['mandatoryMixed ' ] = $ this ->mandatoryMixed ;
717
- $ fields ['mandatoryAnyOf ' ] = $ this ->mandatoryAnyOf ;
758
+ $ fields = [];
759
+ $ fields ['mandatoryInteger ' ] = $ this ->mandatoryInteger ;
760
+ $ fields ['mandatoryString ' ] = $ this ->mandatoryString ;
761
+ $ fields ['mandatoryEnum ' ] = $ this ->mandatoryEnum ;
762
+ $ fields ['mandatoryDate ' ] = $ this ->mandatoryDate ->format (DATE_RFC3339 );
763
+ $ fields ['mandatoryNullableDate ' ] = $ this ->mandatoryNullableDate !== null ? $ this ->mandatoryNullableDate ->format (DATE_RFC3339 ) : null ;
764
+ $ fields ['mandatoryFloat ' ] = $ this ->mandatoryFloat ;
765
+ $ fields ['mandatoryBoolean ' ] = $ this ->mandatoryBoolean ;
766
+ $ fields ['mandatoryArray ' ] = $ this ->mandatoryArray ;
767
+ $ fields ['mandatoryArrayWithMinItems ' ] = $ this ->mandatoryArrayWithMinItems ;
768
+ $ fields ['mandatoryObject ' ] = $ this ->mandatoryObject ->toArray ();
769
+ $ fields ['mandatoryNullableObjectWithAllOf ' ] = $ this ->mandatoryNullableObjectWithAllOf !== null ? $ this ->mandatoryNullableObjectWithAllOf ->toArray () : null ;
770
+ $ fields ['mandatoryMixed ' ] = $ this ->mandatoryMixed ;
771
+ $ fields ['mandatoryAnyOf ' ] = $ this ->mandatoryAnyOf ;
772
+ $ fields ['mandatoryNullableStringWithMinMaxLength ' ] = $ this ->mandatoryNullableStringWithMinMaxLength ;
718
773
if ($ this ->hasOptionalInteger ()) {
719
774
$ fields ['optionalInteger ' ] = $ this ->optionalInteger ;
720
775
}
@@ -772,6 +827,9 @@ public function toArray(): array
772
827
if ($ this ->hasOptionalObject ()) {
773
828
$ fields ['optionalObject ' ] = $ this ->optionalObject ->toArray ();
774
829
}
830
+ if ($ this ->hasOptionalNullableStringWithMinMaxLength ()) {
831
+ $ fields ['optionalNullableStringWithMinMaxLength ' ] = $ this ->optionalNullableStringWithMinMaxLength ;
832
+ }
775
833
776
834
return $ fields ;
777
835
}
0 commit comments