Ovh\Dedicated\Server\ServerClient::setMonitoring PHP Метод

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

This didmt work passing bools though as $enable - testing logic on bools is a PITA. if (!var) when var == false => true, and that was tossing missing paramaeter messages. modified to pass on/off instead
public setMonitoring ( $domain, $_enable )
    public function setMonitoring($domain, $_enable)
    {
        if (!$domain) {
            throw new BadMethodCallException('Parameter $domain is missing.');
        }
        $domain = (string) $domain;
        if ($_enable == "on") {
            $enable = true;
        } else {
            $enable = false;
        }
        //        if (!$enable)
        //            throw new BadMethodCallException('Parameter enable is missing.');
        if (!is_bool($enable)) {
            throw new BadMethodCallException('Parameter $enable must be a boolean');
        }
        $payload = array('monitoring' => $enable);
        try {
            $r = $this->put('dedicated/server/' . $domain, array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($payload))->send();
        } catch (\Exception $e) {
            throw new ServerException($e->getMessage(), $e->getCode(), $e);
        }
        return $r->getBody(true);
    }