Kafka\ZooKeeper::cancelWatch PHP Method

cancelWatch() public method

Delete watch callback on a node, delete all callback when $callback is null
public cancelWatch ( string $path, callable $callback = null ) : boolean | null
$path string
$callback callable
return boolean | null
    public function cancelWatch($path, $callback = null)
    {
        if (isset($this->callback[$path])) {
            if (empty($callback)) {
                unset($this->callback[$path]);
                $this->zookeeper->get($path);
                //reset the callback
                return true;
            } else {
                $key = array_search($callback, $this->callback[$path]);
                if ($key !== false) {
                    unset($this->callback[$path][$key]);
                    return true;
                } else {
                    return null;
                }
            }
        } else {
            return null;
        }
    }