Esempio n. 1
0
 public static function createFromData(\stdClass $data)
 {
     $reviewPostResonse = new static();
     $reviewPostResonse->uuid = $data->metadata->uuid;
     if (isset($data->data)) {
         $reviewPostResonse->postedReview = Review::createFromJson(json_encode($data->data[0]));
     }
     return $reviewPostResonse;
 }
Esempio n. 2
0
 public static function createFromData(\stdClass $data)
 {
     $rating = new static();
     $rating->uuid = $data->metadata->uuid;
     $rating->ratingAverage = $data->metadata->rating_average;
     $rating->ratingsCount = $data->metadata->ratings_count;
     $rating->reviewsCount = $data->metadata->reviews_count;
     $rating->date = $data->metadata->date;
     if (isset($data->paging)) {
         $rating->limit = $data->paging->limit;
         $rating->returnedCount = $data->paging->returned_count;
         $rating->totalCount = $data->paging->total_count;
     }
     $rating->reviews = [];
     if (isset($data->data) && count($data->data) > 0) {
         foreach ($data->data as $review_data) {
             $rating->reviews[] = Review::createFromJson(json_encode($review_data));
         }
     }
     return $rating;
 }