private function _parseBody() { $parsedBody = json_decode($this->_phpRequest['body'], true); if (is_array($parsedBody) && array_key_exists('callback', $parsedBody)) { $callback = $parsedBody['callback']; $this->_callbackFields['event'] = $callback['event']; $this->_callbackFields['type'] = Zipmark_Callback::decamelize($callback['object_type']); $objectArray = array($this->objectType() => $callback['object']); $this->_callbackFields['object'] = Zipmark_Resource::fromJson(json_encode($objectArray), $this->_client); } else { throw new Zipmark_Error("Body does not contain valid content."); } }
private static function _createObject($parsedObject) { $objName = key($parsedObject); $href = Zipmark_Base::_findSelfHref($parsedObject); $newObj = new Zipmark_Resource($objName, $href); if (!empty($href)) { $newObj->setHref($href); } else { if ($newObj instanceof Zipmark_Collection) { $newObj->_count = Zipmark_Base::_numRecords($parsedObject); } } self::buildObject($objName, $parsedObject[$objName], $newObj); return $newObj; }
/** * Find a specific object * * @param string $objectId The Object Identifier * * @return Zipmark_Resource The Object */ public function get($objectId) { $objName = $this->getObjectName(); $obj = new Zipmark_Resource($objName, $this->getHref(), $this->getClient()); return $obj->get($objectId); }