File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class AuthorTransformer extends TransformerAbstract
1414{
1515 public function transform ($ post )
1616 {
17- $ embedded = collect ($ post ->_embedded );
17+ $ embedded = collect ($ post ->_embedded ?? [] );
1818
1919 if ($ embedded ->has ('author ' )) {
2020
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class CategoryTransformer extends TransformerAbstract
1414{
1515 public function transform ($ post )
1616 {
17- $ embedded = collect ($ post ->_embedded );
17+ $ embedded = collect ($ post ->_embedded ?? [] );
1818
1919 if ($ embedded ->has ('wp:term ' )) {
2020
Original file line number Diff line number Diff line change @@ -59,16 +59,16 @@ public function transform($post)
5959 'content ' => $ post ->content ->rendered ,
6060 'format ' => $ post ->format ,
6161 'status ' => 'publish ' ,
62- 'featured_image ' => $ this ->getFeaturedImage ($ post-> _embedded ),
62+ 'featured_image ' => $ this ->getFeaturedImage ($ post ),
6363 'published_at ' => $ this ->carbonDate ($ post ->date ),
6464 'created_at ' => $ this ->carbonDate ($ post ->date ),
6565 'updated_at ' => $ this ->carbonDate ($ post ->modified ),
6666 ];
6767 }
6868
69- private function getFeaturedImage ($ embedded )
69+ private function getFeaturedImage ($ post )
7070 {
71- $ embedded = collect ($ embedded );
71+ $ embedded = collect ($ post -> _embedded ?? [] );
7272
7373 if ($ embedded ->has ('wp:featuredmedia ' )) {
7474 $ media = head ($ embedded ['wp:featuredmedia ' ]);
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class TagTransformer extends TransformerAbstract
1414{
1515 public function transform ($ post )
1616 {
17- $ embedded = collect ($ post ->_embedded );
17+ $ embedded = collect ($ post ->_embedded ?? [] );
1818
1919 if ($ embedded ->has ('wp:term ' )) {
2020
You can’t perform that action at this time.
0 commit comments