Prose\UsingZookeeper::delete PHP Метод

delete() публичный Метод

public delete ( string $key )
$key string
    public function delete($key)
    {
        // what are we doing?
        $log = usingLog()->startAction("delete '{$key}' from Zookeeper");
        // does the key itself exist in zookeeper?
        if (!$this->zk->exists($key)) {
            // no ... we're done here
            $log->endAction("key does not exist ... no action required");
            return;
        }
        // does the key have any children?
        $children = $this->zk->getChildren($key);
        if (!empty($children)) {
            // we have to delete all of the children first
            $this->deleteChildrenOf($key);
        }
        // now we can safely delete the key itself
        if (!$this->zk->delete($key)) {
            throw new E5xx_ActionFailed(__METHOD__);
        }
        // all done
        $log->endAction();
    }