public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('organization'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } // Set objects if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } }
/** * Implements BaseObject::loadFromRawData($data, $reset = false) * * @param array $data * @param bool $reset */ public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } if (isset($data['virtualCurrency'])) { $this->virtualCurrency = new DataStructures\SupportedCurrency($data['virtualCurrency']); } if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['product'])) { foreach ($data['product'] as $product_item) { $product = new Product($this->config); $product->loadFromRawData($product_item); $this->products[] = $product; } } $excluded_properties = array('organization', 'product', 'virtualCurrency'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } if (isset($data['organization']) && is_array($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['product'])) { $product = new Product($this->config); $product->loadFromRawData($data['product']); $this->product = $product; } $this->status = isset($data['status']) ? $data['status'] : null; }
public function __construct($data, Developer $developer) { $excluded_properties = array('mintCriteria', 'developer', 'organization'); if (is_array($data)) { $this->loadFromRawData($data, $excluded_properties); } elseif (!isset($data)) { $data = array(); } if (isset($data['mintCriteria'])) { $this->mintCriteria = new MintCriteria($data['mintCriteria']); } $this->developer = $developer; if (isset($data['organization'])) { $organization = new Organization($this->developer->getConfig()); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } }
public function isGroupPlan() { $is_group_plan = true; foreach ($this->ratePlanDetails as $ratePlanDetails) { if ($ratePlanDetails->getOrganization()->getParent() == null) { $is_group_plan = false; break; } elseif ($ratePlanDetails->getOrganization()->getParent()->getId() != $this->organization->getId()) { $is_group_plan = false; break; } } return $is_group_plan; }
public function __toString() { $obj = array(); $obj['address'] = $this->addresses; $obj['organization'] = array('id' => $this->organization->getId()); $properties = array_keys(get_object_vars($this)); $excluded_properties = array_keys(get_class_vars(get_parent_class($this))); foreach ($properties as $property) { if ($property == 'address' || $property == 'organization' || in_array($property, $excluded_properties)) { continue; } if (isset($this->{$property})) { $obj[$property] = $this->{$property}; } } return json_encode($obj); }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('pricePoints', 'suborgProducts', 'organization', 'developerCategory', 'broker'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } if (array_key_exists('pricePoints', $data) && is_array($data['pricePoints'])) { foreach ($data['pricePoints'] as $price_point_item) { $price_point = new PricePoint($this->id, $this->config); $price_point->loadFromRawData($price_point_item); $this->pricePoints[] = $price_point; } } if (array_key_exists('suborgProducts', $data) && is_array($data['suborgProducts'])) { foreach ($data['suborgProducts'] as $suborg_product_item) { $suborg_product = new SuborgProduct($this->id, $this->config); $suborg_product->loadFromRawData($suborg_product_item); $this->suborgProducts[] = $suborg_product; } } if (array_key_exists('organization', $data)) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (array_key_exists('developerCategory', $data) && is_array($data['developerCategory'])) { foreach ($data['developerCategory'] as $cat_item) { $category = new DeveloperCategory($this->config); $category->loadFromRawData($cat_item); $this->developerCategories[] = $category; } } // TODO verify that brokers are Developers if (array_key_exists('broker', $data) && is_array($data['broker'])) { foreach ($data['broker'] as $broker_item) { $broker = new Developer($this->config); $broker->loadFromRawData($broker_item); $this->brokers[] = $broker; } } }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('org', 'mPackageId', 'organization', 'monetizationPackage', 'currency', 'parentRatePlan', 'developer', 'developerCategory', 'developers', 'applicationCategory', 'exchangeOrganization', 'ratePlanDetails'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } // Set objects if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['monetizationPackage'])) { $monetizationPackage = new MonetizationPackage($this->config); $monetizationPackage->loadFromRawData($data['monetizationPackage']); $this->monetizationPackage = $monetizationPackage; } if (isset($data['currency'])) { $this->currency = new DataStructures\SupportedCurrency($data['currency']); } if (isset($data['parentRatePlan'])) { $rate_plan = new RatePlan($this->mPackageId, $this->config); $rate_plan->loadFromRawData($data['parentRatePlan']); $this->setParentRatePlan($rate_plan); } if (isset($data['developer'])) { $dev = new Developer($this->config); $dev->loadFromRawData($data['developer']); $this->developerId = $dev->getEmail(); } //@TODO Implement load of developerCategory //@TODO Implement load of developers //@TODO Implement load of applicationCategory if (isset($data['exchangeOrganization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['exchangeOrganization']); $this->exchangeOrganization = $organization; } if (isset($data['ratePlanDetails'])) { foreach ($data['ratePlanDetails'] as $ratePlanDetail) { $this->ratePlanDetails[] = new DataStructures\RatePlanDetail($ratePlanDetail, $this->config); } } }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } if (isset($data['address'])) { foreach ($data['address'] as $address_data) { $address = new DataStructures\Address($address_data); $this->addresses[] = $address; } } if (isset($data['parent'])) { $parent = new Organization($this->config); $parent->loadFromRawData($data['parent']); $this->parent = $parent; } $this->taxRegNo = isset($data['taxRegNo']) ? $data['taxRegNo'] : null; $this->regNo = isset($data['regNo']) ? $data['regNo'] : null; $excluded_properties = array('address', 'regNo', 'taxRegNo', 'parent', 'children'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('address', 'organization', 'transactionBrokerages', 'ratePlan', 'parentId', 'developerCategory'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } $this->id = $data['id']; if (isset($data['address']) && is_array($data['address']) && count($data['address']) > 0) { foreach ($data['address'] as $addr_item) { $this->addresses[] = new DataStructures\Address($addr_item); } } if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['transactionBrokerages'])) { foreach ($data['transactionBrokerages'] as $trans_brok) { $this->transactionBrokerages[] = new TransactionBrokerage($trans_brok); } } if (isset($data['ratePlan'])) { foreach ($data['ratePlan'] as $rate_plan_data) { $dev_rate_plan = new DeveloperRatePlan($this->email, $this->config); $dev_rate_plan->loadFromRawData($rate_plan_data); $this->ratePlan[] = $dev_rate_plan; } } if (isset($data['parentId'])) { $parent = new Developer($this->config); $parent->loadFromRawData($data['parentId']); $this->parentId = $parent; } if (isset($data['developerCategory'])) { $dev_cat = new DeveloperCategory($this->config); $dev_cat->loadFromRawData($data['developerCategory']); $this->developerCategory = $dev_cat; } }
public function loadFromRawData($data, $reset = false) { if ($reset) { $this->initValues(); } $excluded_properties = array('organization', 'product', 'subOrg', 'developer', 'billableDeveloper', 'billableExchangeOrg'); foreach (array_keys($data) as $property) { if (in_array($property, $excluded_properties)) { continue; } // form the setter method name to invoke setXxxx $setter_method = 'set' . ucfirst($property); if (method_exists($this, $setter_method)) { $this->{$setter_method}($data[$property]); } else { self::$logger->notice('No setter method was found for property "' . $property . '"'); } } if (isset($data['organization'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['organization']); $this->organization = $organization; } if (isset($data['product'])) { foreach ($data['product'] as $product_item) { $product = new Product($this->config); $product->loadFromRawData($product_item); $this->product[] = $product; } } if (isset($data['subOrg'])) { foreach ($data['subOrg'] as $sub_org_item) { $organization = new Organization($this->config); $organization->loadFromRawData($sub_org_item); $this->subOrg[] = $organization; } } if (isset($data['developer'])) { foreach ($data['developer'] as $dev_item) { $dev = new Developer($this->config); $dev->loadFromRawData($dev_item); $this->developer[] = $dev; } } if (isset($data['billableDeveloper'])) { $dev = new Developer($this->config); $dev->loadFromRawData($data['billableDeveloper']); $this->billableDeveloper = $dev; } if (isset($data['billableExchangeOrg'])) { $organization = new Organization($this->config); $organization->loadFromRawData($data['billableExchangeOrg']); $this->billableExchangeOrg = $organization; } }