@@ -96,9 +96,9 @@ public function hasMeta($key): bool {
96
96
if ( is_string ( $ key ) && preg_match ( '/[,|]/is ' , $ key ) ) {
97
97
$ key = preg_split ( '/ ?[,|] ?/ ' , $ key );
98
98
}
99
- $ setMeta = 'hasMeta ' . ucfirst ( gettype ( $ key ) );
99
+ $ hasMeta = 'hasMeta ' . ucfirst ( gettype ( $ key ) );
100
100
101
- return $ this ->$ setMeta ( $ key );
101
+ return $ this ->$ hasMeta ( $ key );
102
102
}
103
103
104
104
protected function hasMetaString ($ key ): bool {
@@ -218,6 +218,7 @@ public function getDefaultMetaValue($key) {
218
218
}
219
219
220
220
protected function getMetaString ($ key , $ default = null ) {
221
+ $ key = strtolower ( $ key );
221
222
$ meta = $ this ->getMetaData ()->get ( $ key );
222
223
223
224
if ( is_null ( $ meta ) || $ meta ->isMarkedForDeletion () ) {
@@ -230,16 +231,18 @@ protected function getMetaString($key, $default = null) {
230
231
231
232
protected function getMetaArray ($ keys , $ default = null ): BaseCollection {
232
233
$ collection = new BaseCollection ();
233
- $ flipped = array_flip ( $ keys );
234
- foreach ($ this ->getMetaData () as $ meta ) {
235
- if ( ! $ meta ->isMarkedForDeletion () && isset ( $ flipped [$ meta ->key ] ) ) {
236
- unset( $ flipped [$ meta ->key ] );
237
- $ collection ->put ( $ meta ->key , $ meta ->value );
234
+
235
+ foreach ($ keys as $ key ) {
236
+ $ key = strtolower ( $ key );
237
+ if ( $ this ->hasMeta ( $ key ) ) {
238
+ $ meta = $ this ->getMetaData ()[$ key ];
239
+ if ( ! $ meta ->isMarkedForDeletion () ) {
240
+ $ collection ->put ( $ key , $ meta ->value );
241
+ continue ;
242
+ }
238
243
}
239
- }
240
- // If there are any keys left in $flipped, it means they are not set. so fill them with default values.
241
- // Default values set in defaultMetaValues property take precedence over default values passed to this method
242
- foreach ($ flipped as $ key => $ value ) {
244
+ // Key does not exist, so it's value will be the default value
245
+ // Default values set in defaultMetaValues property take precedence over default value passed to this method
243
246
$ defaultValue = $ this ->getDefaultMetaValue ( $ key );
244
247
if ( is_null ( $ defaultValue ) ) {
245
248
if ( is_array ( $ default ) ) {
0 commit comments