@@ -73,31 +73,30 @@ public function __construct(array $data)
73
73
$ this ->_errors [] = "property ' $ property' must be array, but " . gettype ($ data [$ property ]) . " given. " ;
74
74
continue ;
75
75
}
76
- if (isset ($ data [$ property ]['$ref ' ])) {
77
- $ this ->_properties [$ property ] = new Reference ($ data [$ property ], null );
78
- unset($ data [$ property ]);
79
- continue ;
80
- }
81
76
switch (\count ($ type )) {
82
77
case 1 :
83
- // array
84
- $ this ->_properties [$ property ] = [];
85
- foreach ($ data [$ property ] as $ item ) {
86
- if ($ type [0 ] === Type::STRING ) {
87
- if (!is_string ($ item )) {
88
- $ this ->_errors [] = "property ' $ property' must be array of strings, but array has " . gettype ($ item ) . " element. " ;
89
- }
90
- $ this ->_properties [$ property ][] = $ item ;
91
- } elseif (Type::isScalar ($ type [0 ])) {
92
- $ this ->_properties [$ property ][] = $ item ;
93
- } elseif ($ type [0 ] === Type::ANY ) {
94
- if (is_array ($ item ) && isset ($ item ['$ref ' ])) {
95
- $ this ->_properties [$ property ][] = new Reference ($ item , null );
96
- } else {
78
+ if (isset ($ data [$ property ]['$ref ' ])) {
79
+ $ this ->_properties [$ property ] = new Reference ($ data [$ property ], null );
80
+ } else {
81
+ // array
82
+ $ this ->_properties [$ property ] = [];
83
+ foreach ($ data [$ property ] as $ item ) {
84
+ if ($ type [0 ] === Type::STRING ) {
85
+ if (!is_string ($ item )) {
86
+ $ this ->_errors [] = "property ' $ property' must be array of strings, but array has " . gettype ($ item ) . " element. " ;
87
+ }
88
+ $ this ->_properties [$ property ][] = $ item ;
89
+ } elseif (Type::isScalar ($ type [0 ])) {
97
90
$ this ->_properties [$ property ][] = $ item ;
91
+ } elseif ($ type [0 ] === Type::ANY ) {
92
+ if (is_array ($ item ) && isset ($ item ['$ref ' ])) {
93
+ $ this ->_properties [$ property ][] = new Reference ($ item , null );
94
+ } else {
95
+ $ this ->_properties [$ property ][] = $ item ;
96
+ }
97
+ } else {
98
+ $ this ->_properties [$ property ][] = $ this ->instantiate ($ type [0 ], $ item );
98
99
}
99
- } else {
100
- $ this ->_properties [$ property ][] = $ this ->instantiate ($ type [0 ], $ item );
101
100
}
102
101
}
103
102
break ;
0 commit comments