Example #1
0
 public static function fromArray($subscriberData)
 {
     $subscriber = new self($subscriberData['email']);
     if (isset($subscriberData['firstname'])) {
         $subscriber->setFirstname($subscriberData['firstname']);
     }
     if (isset($subscriberData['surname'])) {
         $subscriber->setSurname($subscriberData['surname']);
     }
     if (isset($subscriberData['address'])) {
         $subscriber->setAddress($subscriberData['address']);
     }
     if (isset($subscriberData['city'])) {
         $subscriber->setCity($subscriberData['city']);
     }
     if (isset($subscriberData['zip_code'])) {
         $subscriber->setZipCode($subscriberData['zip_code']);
     }
     if (isset($subscriberData['company'])) {
         $subscriber->setCompany($subscriberData['company']);
     }
     if (isset($subscriberData['phone_number'])) {
         $subscriber->setPhoneNumber($subscriberData['phone_number']);
     }
     if (isset($subscriberData['status_activity'])) {
         $subscriber->setStatusActivity($subscriberData['status_activity']);
     }
     if (isset($subscriberData['status_confirmation'])) {
         $subscriber->setStatusConfirmation($subscriberData['status_confirmation']);
     }
     return $subscriber;
 }
Example #2
0
 /**
  * @param Address $address
  *
  * @return AddressService
  */
 private function createServiceElement(Address $address)
 {
     $addressService = new self();
     $addressService->setServiceLocator($this->getServiceLocator());
     $addressService->setAddress($address);
     return $addressService;
 }
Example #3
0
 /**
  * Fund an address with faucet.
  * The faucet endpoint is only available on BlockCypher’s Test Blockchain and Bitcoin Testnet3
  *
  * @deprecated since version 1.2. Use FaucetClient.
  * @param string $address Address to fund
  * @param int $amount
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return FaucetResponse
  */
 public static function fundAddress($address, $amount, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($address, 'address');
     NumericValidator::validate($amount, 'amount');
     $faucet = new self();
     $faucet->setAddress($address);
     $faucet->setAmount($amount);
     return $faucet->turnOn($apiContext, $restCall);
 }
 /**
  * @param string $id
  * @param string $type
  * @param string $legalDocument
  * @param string $name
  * @param Address $address
  * @param Phone $phone
  * @return Customer
  */
 public static function create($id, $type, $legalDocument, $name, Address $address, $phone)
 {
     $instance = new self();
     $instance->setId($id);
     $instance->setType($type);
     $instance->setLegalDocument1($legalDocument);
     $instance->setName($name);
     $instance->setAddress($address);
     $instance->addPhone($phone);
     return $instance;
 }
 /**
  * @param Address $address
  * @param BlockCypherAddressBalance $blockCypherAddressBalance
  * @param string $apiUrl
  * @param string $explorerUrl
  * @return $this
  */
 public static function from(Address $address, BlockCypherAddressBalance $blockCypherAddressBalance, $apiUrl, $explorerUrl)
 {
     $addressListItemDto = new self();
     $addressListItemDto->setAddress($address->getAddress());
     $addressListItemDto->setTag($address->getTag());
     $addressListItemDto->setCreationTime($address->getCreationTime());
     $addressListItemDto->setFinalBalance($blockCypherAddressBalance->getFinalBalance());
     $addressListItemDto->setNTx($blockCypherAddressBalance->getNTx());
     $addressListItemDto->setApiUrl($apiUrl);
     $addressListItemDto->setExplorerUrl($explorerUrl);
     return $addressListItemDto;
 }
 public static function FromSimpleXml($xml)
 {
     $point = googlePoint::create($xml->Point->coordinates);
     $placemark = new self();
     $placemark->setPoint($point);
     $placemark->setAddress($xml->address);
     $placemark->setAccuracy($xml->AddressDetails['Accuracy']);
     return $placemark;
 }
Example #7
0
 public static function create(array $data, $place = null)
 {
     if ($place == null) {
         $place = new self();
     }
     if (isset($data['name'])) {
         $place->setName($data['name']);
     }
     if (isset($data['type'])) {
         $place->setType($data['type']);
     }
     if (isset($data['active'])) {
         $place->setActive($data['active']);
     }
     if (isset($data['can_buy'])) {
         $place->setCanBuy($data['can_buy']);
     }
     if (isset($data['position']) && isset($data['position']['latitude']) && isset($data['position']['longitude'])) {
         $position = new Position($data['position']['latitude'], $data['position']['longitude']);
         $place->setPosition($position);
     }
     if (isset($data['address'])) {
         $place->setAddress(Address::create($data['address']));
     }
     if (isset($data['contact'])) {
         $contact = ContactData::create($data['contact']);
         if ($contact !== null) {
             $place->setContact($contact);
         }
     }
     if (isset($data['materials'])) {
         $place->materials = $data['materials'];
     }
     $place->date = new \DateTime();
     return $place;
 }
Example #8
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_List_Item
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $attributes = $xmlElement->attributes();
     $item = new self();
     // Set ID.
     $item->setCdbId((string) $attributes['cidn']);
     if (!empty($attributes['private'])) {
         $item->setPrivate((bool) $attributes['private']);
     }
     if (!empty($attributes['externalid'])) {
         $item->setExternalId((string) $attributes['externalid']);
     }
     $item->setTitle((string) $attributes['title']);
     if (!empty($attributes['shortdescription'])) {
         $item->setShortDescription((string) $attributes['shortdescription']);
     }
     if (!empty($attributes['thumbnail'])) {
         $item->setThumbnail((string) $attributes['thumbnail']);
     }
     if (!empty($attributes['address'])) {
         $item->setAddress((string) $attributes['address']);
     }
     if (!empty($attributes['city'])) {
         $item->setCity((string) $attributes['city']);
     }
     if (!empty($attributes['zip'])) {
         $item->setZip((string) $attributes['zip']);
     }
     if (!empty($attributes['latlng'])) {
         $item->setCoordinates((string) $attributes['latlng']);
     }
     if (!empty($attributes['location'])) {
         $item->setLocation((string) $attributes['location']);
     }
     if (!empty($attributes['locationid'])) {
         $item->setLocationId((string) $attributes['locationid']);
     }
     if (!empty($attributes['calendarsummary'])) {
         $item->setCalendarSummary((string) $attributes['calendarsummary']);
     }
     if (!empty($attributes['itemtype'])) {
         $item->setType((string) $attributes['itemtype']);
     }
     if (!empty($attributes['price'])) {
         $item->setPrice((string) $attributes['price']);
     }
     if (!empty($attributes['pricedescription'])) {
         $item->setPriceDescription((string) $attributes['pricedescription']);
     }
     if (!empty($attributes['agefrom'])) {
         $item->setAgeFrom((string) $attributes['agefrom']);
     }
     if (!empty($attributes['performers'])) {
         $item->setPerformers((string) $attributes['performers']);
     }
     return $item;
 }
Example #9
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_Item_Page
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->uid)) {
         throw new CultureFeed_Cdb_ParseException('Uid missing for page element');
     }
     if (empty($xmlElement->name)) {
         throw new CultureFeed_Cdb_ParseException('Name missing for page element');
     }
     $page = new self();
     // Set ID + name.
     $page->setId((string) $xmlElement->uid);
     $page->setName((string) $xmlElement->name);
     $page->setOfficialPage(filter_var((string) $xmlElement->officialPage, FILTER_VALIDATE_BOOLEAN));
     // Set categories
     $categories = array();
     if (!empty($xmlElement->categoryIds->categoryId)) {
         foreach ($xmlElement->categoryIds->categoryId as $category) {
             $categories[] = (string) $category;
         }
     }
     $page->setCategories($categories);
     // Set keywords
     $keywords = array();
     if (!empty($xmlElement->keywords->keyword)) {
         foreach ($xmlElement->keywords->keyword as $keyword) {
             $keywords[] = (string) $keyword;
         }
     }
     $page->setKeywords($keywords);
     // Set description.
     if (!empty($xmlElement->description)) {
         $page->setDescription((string) $xmlElement->description);
     }
     // Set the image.
     if (!empty($xmlElement->image)) {
         $page->setImage((string) $xmlElement->image);
     }
     // Set the cover.
     if (!empty($xmlElement->cover)) {
         $page->setCover((string) $xmlElement->cover);
     }
     // Set the visibility.
     if (!empty($xmlElement->visible)) {
         $page->setVisibility((string) $xmlElement->visible);
     }
     // Set address.
     $address = new CultureFeed_Cdb_Data_Address_PhysicalAddress();
     $addressElement = $xmlElement->address;
     $has_address = FALSE;
     if (!empty($addressElement->city)) {
         $address->setCity((string) $addressElement->city);
         $has_address = TRUE;
     }
     if (!empty($addressElement->street)) {
         $address->setStreet((string) $addressElement->street);
         $has_address = TRUE;
     }
     if (!empty($addressElement->zip)) {
         $address->setZip((string) $addressElement->zip);
         $has_address = TRUE;
     }
     if (!empty($addressElement->country)) {
         $address->setCountry((string) $addressElement->country);
         $has_address = TRUE;
     }
     if (!empty($addressElement->lat) && !empty($addressElement->lon)) {
         $coordinates = $addressElement->lat . '-' . $addressElement->lon;
         if ($coordinates != '0.0-0.0') {
             $address->setGeoInformation(new CultureFeed_Cdb_Data_Address_GeoInformation((string) $addressElement->lon, (string) $addressElement->lat));
             $has_address = TRUE;
         }
     }
     if ($has_address) {
         $page->setAddress($address);
     }
     // Set contact info.
     if (!empty($xmlElement->contactInfo->email)) {
         $page->setEmail((string) $xmlElement->contactInfo->email);
     }
     if (!empty($xmlElement->contactInfo->telephone)) {
         $page->setTelephone((string) $xmlElement->contactInfo->telephone);
     }
     // Set links.
     $links = array();
     if (!empty($xmlElement->links)) {
         foreach ($xmlElement->links->children() as $link) {
             $url = (string) $link;
             if (empty($url)) {
                 continue;
             }
             // Make sure http is in front of the url.
             if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
                 $url = 'http://' . $url;
             }
             $links[$link->getName()] = $url;
         }
     }
     $page->setLinks($links);
     // Set the permissions.
     $page->setPermissions(CultureFeed_Cdb_Data_PagePermissions::parseFromCdbXml($xmlElement->permissions));
     // Set tagline.
     $page->setTagline((string) $xmlElement->tagline);
     return $page;
 }