Example #1
0
 /**
  * @param string $name
  * @param array  $headers
  *
  * @return static
  */
 public static function create($name, array $headers = [])
 {
     $container = new self($name);
     $container->setHeaders($headers);
     // set visibility
     if (strstr($container->getMetadata()->get('Read'), '.r:*') !== false) {
         $container->setPublic();
     } else {
         $container->setPrivate();
     }
     // set object count
     if (null !== ($count = $container->headers->get('X-Container-Object-Count'))) {
         $container->setObjectCount($count);
     }
     // set bytes
     if (null !== ($bytes = $container->headers->get('X-Container-Bytes-Used'))) {
         $container->setBytesUsed($bytes);
     }
     return $container;
 }
Example #2
0
 public static function construct($_arrayMarket)
 {
     $market = new self();
     if (!isset($_arrayMarket['id'])) {
         return;
     }
     $market->setId($_arrayMarket['id']);
     $market->setName($_arrayMarket['name']);
     $market->setType($_arrayMarket['type']);
     $market->datetime = json_encode($_arrayMarket['datetime'], JSON_UNESCAPED_UNICODE);
     $market->setDescription($_arrayMarket['description']);
     $market->setDownloaded($_arrayMarket['downloaded']);
     $market->setUser_id($_arrayMarket['user_id']);
     $market->setVersion($_arrayMarket['version']);
     $market->setCategorie($_arrayMarket['categorie']);
     $market->status = json_encode($_arrayMarket['status'], JSON_UNESCAPED_UNICODE);
     $market->setAuthor($_arrayMarket['author']);
     $market->setChangelog($_arrayMarket['changelog']);
     $market->setLogicalId($_arrayMarket['logicalId']);
     $market->setUtilization($_arrayMarket['utilization']);
     $market->setCertification($_arrayMarket['certification']);
     $market->setPurchase($_arrayMarket['purchase']);
     $market->setCost($_arrayMarket['cost']);
     $market->rating = $_arrayMarket['rating'];
     $market->setBuyer($_arrayMarket['buyer']);
     $market->setUpdateBy($_arrayMarket['updateBy']);
     $market->setPrivate($_arrayMarket['private']);
     $market->img = json_encode($_arrayMarket['img'], JSON_UNESCAPED_UNICODE);
     $market->link = json_encode($_arrayMarket['link'], JSON_UNESCAPED_UNICODE);
     $market->language = json_encode($_arrayMarket['language'], JSON_UNESCAPED_UNICODE);
     if (isset($_arrayMarket['hardwareCompatibility'])) {
         $market->hardwareCompatibility = json_encode($_arrayMarket['hardwareCompatibility'], JSON_UNESCAPED_UNICODE);
     }
     $market->change = '';
     $market->setRealcost($_arrayMarket['realCost']);
     if (!isset($_arrayMarket['isAuthor'])) {
         $_arrayMarket['isAuthor'] = true;
     }
     $market->setIsAuthor($_arrayMarket['isAuthor']);
     return $market;
 }
Example #3
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;
 }