src/Http/Request.php
public function auth($auth = true)
    {
        $headers = $this->headers();
        if ($auth === false) {
            unset($headers['Authorization']);
        }
        if (!$auth) {
            return;
        }
        if (is_array($auth) && !empty($auth['nonce'])) {
            $data = ['method' => $this->method(), 'uri' => $this->path()];
            $data += $auth;
        } else {
            $data = [];
        }
        $auth = $this->_classes['auth'];
        $data = $auth::encode($this->username(), $this->password(), $data);
        $headers['Authorization'] = $auth::header($data);
        return $this;
    }
public function auth($auth = true)
    {
        $headers = $this->headers();
        if ($auth === false) {
            unset($headers['Authorization']);
        }
        if (!$auth) {
            return;
        }
        if (is_array($auth) && !empty($auth['nonce'])) {
            $data = ['method' => $this->method(), 'uri' => $this->path()];
            $data += $auth;
        } else {
            $data = [];
        }
        $auth = $this->_classes['auth'];
        $data = $auth::encode($this->username(), $this->password(), $data);
        $headers['Authorization'] = $auth::header($data);
        return $this;
    }
public function auth ( $ auth = true ) { $ headers = $ this -> headers ( ) ; if ( $ auth === false ) { unset ( $ headers [ 'Authorization' ] ) ; } if ( ! $ auth ) { return ; } if ( is_array ( $ auth ) && ! empty ( $ auth [ 'nonce' ] ) ) { $ data = [ 'method' => $ this -> method ( ) , 'uri' => $ this -> path ( ) ] ; $ data += $ auth ; } else { $ data = [ ] ; } $ auth = $ this -> _classes [ 'auth' ] ; $ data = $ auth :: encode ( $ this -> username ( ) , $ this -> password ( ) , $ data ) ; $ headers [ 'Authorization' ] = $ auth :: header ( $ data ) ; return $ this ; }
Sets the request authorization.

@param  mixed  $auth Any array with a 'nonce' attribute implies Digest authentication.
Defaults to Basic authentication otherwise.
If `false` the Authorization header will be removed.
@return mixed
Sets the request authorization .