File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -732,6 +732,8 @@ public function map(callable $callable)
732
732
$ this ->highlights = $ array ['highlights ' ] ?? [];
733
733
$ this ->promoted = isset ($ array ['is_promoted ' ]) && true === $ array ['is_promoted ' ];
734
734
$ this ->score = $ array ['score ' ] ?? null ;
735
- $ this ->coordinate = $ array ['coordinate ' ] ?? null ;
735
+ $ this ->coordinate = is_array ($ array ['coordinate ' ] ?? null )
736
+ ? Coordinate::createFromArray ($ array ['coordinate ' ])
737
+ : null ;
736
738
}
737
739
}
Original file line number Diff line number Diff line change @@ -524,6 +524,13 @@ public function testMap()
524
524
$ this ->assertFalse ($ item ->isPromoted ());
525
525
$ this ->assertEquals (10 , $ item ->getScore ());
526
526
$ this ->assertNull ($ item ->getCoordinate ());
527
+
528
+ $ item ->map (function (array $ map ) {
529
+ $ map ['coordinate ' ] = ['lat ' => 1 , 'lon ' => 2 ];
530
+
531
+ return $ map ;
532
+ });
533
+ $ this ->assertInstanceOf (Coordinate::class, $ item ->getCoordinate ());
527
534
}
528
535
529
536
/**
You can’t perform that action at this time.
0 commit comments