本文整理汇总了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);
}