本文整理匯總了PHP中Factory::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::getObject方法的具體用法?PHP Factory::getObject怎麽用?PHP Factory::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Factory
的用法示例。
在下文中一共展示了Factory::getObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDirectionalVertices
public function getDirectionalVertices($direction)
{
$direction = rtrim(strtolower($direction), 'e');
$directions = array('in', 'out', 'both');
if (!in_array($direction, $directions)) {
throw new \InvalidArgumentException("Invalid direction {$direction}");
}
if (empty($this->id)) {
throw new \InvalidArgumentException("Invalid vertex id");
}
$url = $this->getPath() . '/' . $this->getId() . "/{$direction}";
$response = $this->graph->makeRequest('GET', $url);
return Factory::getObject($this->getClient(), $response);
}
示例2: getEdge
public function getEdge($edge_id)
{
if (empty($edge_id)) {
throw new \InvalidArgumentException("Invalid edge id");
}
$response = $this->makeRequest('GET', "/edges/{$edge_id}");
return Factory::getObject($this, $response);
}
示例3: setFriend
public function setFriend($name)
{
$this->friend = Factory::getObject($name);
}
示例4: update
/**
* Update an item in the graph
*
* @param string $method - PUT OR POST
* @throws Rexster_Exception
* @return requested object type
*/
public function update($method = 'POST')
{
if (empty($this->id)) {
throw new \InvalidArgumentException('Invalid object id to update');
}
if ($this->id != $this->_id) {
throw new \InvalidArgumentException("Node ID's do not match? this->_id = {$this->_id} -- this->id = {$this->id}");
}
$data = $this->toArray();
if (empty($data)) {
throw new \InvalidArgumentException("Invalid properies to update - Properties array should be an associative array of property => value");
}
$reserved = array('id', '_id');
foreach ($reserved as $key) {
if (isset($data[$key])) {
unset($data[$key]);
}
}
$url = '/' . $this->getPath() . '/' . $this->getId();
$response = $this->getClient()->makeRequest($method, $url, $data);
return Factory::getObject($this->getClient(), $response);
}