public function getAuthorization()
    {
        if (!$this->hasHeader('Authorization')) {
            return null;
        }
        $temp = explode(' ', trim($this->getHeaderLine('Authorization')), 2);
        switch (strtolower($temp[0])) {
            case 'basic':
                $temp[1] = base64_decode($temp[1]);
                $temp[1] = explode(':', $temp[1], 2);
                return ['username' => $temp[1][0], 'password' => $temp[1][1] ?? null];
            case 'token':
            case 'oauth':
            case 'bearer':
                return ['token' => $temp[1] ?? null];
            default:
                return null;
        }
    }
public function getAuthorization()
    {
        if (!$this->hasHeader('Authorization')) {
            return null;
        }
        $temp = explode(' ', trim($this->getHeaderLine('Authorization')), 2);
        switch (strtolower($temp[0])) {
            case 'basic':
                $temp[1] = base64_decode($temp[1]);
                $temp[1] = explode(':', $temp[1], 2);
                return ['username' => $temp[1][0], 'password' => $temp[1][1] ?? null];
            case 'token':
            case 'oauth':
            case 'bearer':
                return ['token' => $temp[1] ?? null];
            default:
                return null;
        }
    }
public function getAuthorization ( ) { if ( ! $ this -> hasHeader ( 'Authorization' ) ) { return null ; } $ temp = explode ( ' ' , trim ( $ this -> getHeaderLine ( 'Authorization' ) ) , 2 ) ; switch ( strtolower ( $ temp [ 0 ] ) ) { case 'basic' : $ temp [ 1 ] = base64_decode ( $ temp [ 1 ] ) ; $ temp [ 1 ] = explode ( ':' , $ temp [ 1 ] , 2 ) ; return [ 'username' => $ temp [ 1 ] [ 0 ] , 'password' => $ temp [ 1 ] [ 1 ] ?? null ] ; case 'token' : case 'oauth' : case 'bearer' : return [ 'token' => $ temp [ 1 ] ?? null ] ; default : return null ; } }
Get any authorization details supplied with the request.
@return array|null           array of extracted values or null (possible keys are username, password and token)
Get any authorization details supplied with the request .