/**
  * @param Flag $flag
  */
 protected function hydratePictureAndThumb(Flag $flag)
 {
     if ($flag->getPicture()) {
         $flag->setPicture($this->cloudfrontUrl . $flag->getPicture());
     } else {
         $flag->setPicture($this->cloudfrontUrl . 'restaurant_thumb/_default_restaurant.png');
     }
 }
 /**
  * @param array   $data
  * @param boolean $withPosition
  *
  * @return array
  */
 protected function dataToFlags($data, $withPosition)
 {
     $flags = array();
     $positions = array();
     foreach ($data as $reviewData) {
         $cuisineName = $reviewData['cuisineName'];
         $flag = new Flag();
         $flag->setLat($reviewData['lat']);
         $flag->setLng($reviewData['lng']);
         $flag->setName($reviewData['name']);
         $flag->setColor($reviewData['color']);
         $flag->setPicture($reviewData['picture']);
         $flag->setCuisineName($reviewData['cuisineName']);
         $flag->setFormattedAddress($reviewData['address']);
         $flag->setRestaurantId($reviewData['restaurantId']);
         $flag->setCuisineId($reviewData['cuisineId']);
         if ($withPosition) {
             $positions[$cuisineName] = isset($positions[$cuisineName]) ? ++$positions[$cuisineName] : 1;
             $flag->setPosition($positions[$cuisineName]);
         }
         $flags[] = $flag;
     }
     return $flags;
 }