public function __construct($json) { parent::__construct($json); if ($this->hasDataProperty('coupon')) { $this->setDataProperty('coupon', new Coupon(json_encode($this->getDataProperty('coupon')))); } $this->period = new Period(json_encode(array('start' => $this->getDataProperty('start'), 'end' => $this->getDataProperty('end')))); }
/** * * @return array */ public function __toArray() { $returnArray = parent::__toArray(); if (isset($returnArray['data'])) { foreach ($returnArray['data'] as $index => $item) { $returnArray['data'][$index] = Factory::create(json_encode($item))->__toArray(); } } return $returnArray; }
public function __construct($json) { parent::__construct($json); if ($this->hasDataProperty('plan')) { $this->setDataProperty('plan', new Plan(json_encode($this->getDataProperty('plan')))); } if ($this->hasDataProperty('trial_start')) { $this->trialPeriod = new Period(json_encode(array('start' => $this->getDataProperty('trial_start'), 'end' => $this->getDataProperty('trial_end')))); } $this->currentPeriod = new Period(json_encode(array('start' => $this->getDataProperty('current_period_start'), 'end' => $this->getDataProperty('current_period_end')))); }
public function __construct($json) { parent::__construct($json); if ($this->hasDataProperty('lines')) { $this->setDataProperty('lines', new ObjectList(json_encode($this->getDataProperty('lines')))); } if ($this->hasDataProperty('discount')) { $this->setDataProperty('discount', new Discount(json_encode($this->getDataProperty('discount')))); } $this->period = new Period($json); }
public function __construct($json) { parent::__construct($json); $this->setDataProperty('object', ObjectFactory::create(json_encode($this->getDataProperty('object')))); if ($this->hasPreviousAttributes()) { $previousAttributesCollection = new ArrayCollection(); foreach ($this->getPreviousAttributes() as $key => $value) { if ($value instanceof \stdClass && isset($value->object) && ObjectFactory::isKnownEntityType($value->object)) { $value = ObjectFactory::create(json_encode($value)); } $previousAttributesCollection->set($key, $value); } $this->setDataProperty('previous_attributes', $previousAttributesCollection); } }
/** * * @return array */ public function __toArray() { $returnArray = parent::__toArray(); $returnArray['subscriptions'] = $this->getSubscriptions()->__toArray(); $returnArray['cards'] = $this->getCards()->__toArray(); return $returnArray; }
public function __construct($json) { parent::__construct($json); $this->setDataProperty('data', new Data(json_encode($this->getDataProperty('data')))); }