src/Request/Http/HttpRequest.php
public function setAuth($type, $value)
    {
        switch ($type) {
            case self::AUTH_BASIC:
                // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http
                // authentication (https://www.ietf.org/rfc/rfc2617.txt).
                $this->addHeader(
                    self::HEADER_AUTHORIZATION,
                    'Basic ' . base64_encode(implode(':', $value))
                );
                break;

            case self::AUTH_BEARER:
                $this->addHeader(self::HEADER_AUTHORIZATION, 'Bearer ' . $value);
                break;

            default:
                throw new NostoException('Unsupported auth type.');
        }
    }
public function setAuth($type, $value)
    {
        switch ($type) {
            case self::AUTH_BASIC:
                // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http
                // authentication (https://www.ietf.org/rfc/rfc2617.txt).
                $this->addHeader(
                    self::HEADER_AUTHORIZATION,
                    'Basic ' . base64_encode(implode(':', $value))
                );
                break;

            case self::AUTH_BEARER:
                $this->addHeader(self::HEADER_AUTHORIZATION, 'Bearer ' . $value);
                break;

            default:
                throw new NostoException('Unsupported auth type.');
        }
    }
public function setAuth ( $ type , $ value ) { switch ( $ type ) { case self :: AUTH_BASIC : // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http // authentication (https://www.ietf.org/rfc/rfc2617.txt). $ this -> addHeader ( self :: HEADER_AUTHORIZATION , 'Basic ' . base64_encode ( implode ( ':' , $ value ) ) ) ; break ; case self :: AUTH_BEARER : $ this -> addHeader ( self :: HEADER_AUTHORIZATION , 'Bearer ' . $ value ) ; break ; default : throw new NostoException ( 'Unsupported auth type.' ) ; } }
Setter for the request authentication header.

@param string $type the auth type (use AUTH_ constants).
@param mixed $value the auth header value, format depending on the auth type.
@throws NostoException if an incorrect auth type is given.
Setter for the request authentication header .