protected function getParameters($type, $file = null)
    {
        $headers = [];

        if(!empty($file) && preg_match('/^http/', $file))
        {
            $headers[] = "fileUrl:$file";
        }

        switch($type)
        {
            case 'html':
                $resource = 'tika';
                $headers[] = 'Accept: text/html';
                break;

            case 'lang':
                $resource = 'language/stream';
                break;

            case 'mime':
                $name = basename($file);
                $resource = 'detect/stream';
                $headers[] = "Content-Disposition: attachment, filename=$name";
                break;

            case 'meta':
                $resource = 'meta';
                $headers[] = 'Accept: application/json';
                break;

            case 'text':
                $resource = 'tika';
                $headers[] = 'Accept: text/plain';
                break;

            case 'text-main':
                $resource = 'tika/main';
                $headers[] = 'Accept: text/plain';
                break;

            case 'detectors':
            case 'parsers':
            case 'mime-types':
            case 'version':
                $resource = $type;
                break;

            default:
                throw new Exception("Unknown type $type");
        }

        return [$resource, $headers];
    }
protected function getParameters($type, $file = null)
    {
        $headers = [];

        if(!empty($file) && preg_match('/^http/', $file))
        {
            $headers[] = "fileUrl:$file";
        }

        switch($type)
        {
            case 'html':
                $resource = 'tika';
                $headers[] = 'Accept: text/html';
                break;

            case 'lang':
                $resource = 'language/stream';
                break;

            case 'mime':
                $name = basename($file);
                $resource = 'detect/stream';
                $headers[] = "Content-Disposition: attachment, filename=$name";
                break;

            case 'meta':
                $resource = 'meta';
                $headers[] = 'Accept: application/json';
                break;

            case 'text':
                $resource = 'tika';
                $headers[] = 'Accept: text/plain';
                break;

            case 'text-main':
                $resource = 'tika/main';
                $headers[] = 'Accept: text/plain';
                break;

            case 'detectors':
            case 'parsers':
            case 'mime-types':
            case 'version':
                $resource = $type;
                break;

            default:
                throw new Exception("Unknown type $type");
        }

        return [$resource, $headers];
    }
protected function getParameters ( $ type , $ file = null ) { $ headers = [ ] ; if ( ! empty ( $ file ) && preg_match ( '/^http/' , $ file ) ) { $ headers [ ] = "fileUrl:$file" ; } switch ( $ type ) { case 'html' : $ resource = 'tika' ; $ headers [ ] = 'Accept: text/html' ; break ; case 'lang' : $ resource = 'language/stream' ; break ; case 'mime' : $ name = basename ( $ file ) ; $ resource = 'detect/stream' ; $ headers [ ] = "Content-Disposition: attachment, filename=$name" ; break ; case 'meta' : $ resource = 'meta' ; $ headers [ ] = 'Accept: application/json' ; break ; case 'text' : $ resource = 'tika' ; $ headers [ ] = 'Accept: text/plain' ; break ; case 'text-main' : $ resource = 'tika/main' ; $ headers [ ] = 'Accept: text/plain' ; break ; case 'detectors' : case 'parsers' : case 'mime-types' : case 'version' : $ resource = $ type ; break ; default : throw new Exception ( "Unknown type $type" ) ; } return [ $ resource , $ headers ] ; }
Get the parameters to make the request

@link    https://wiki.apache.org/tika/TikaJAXRS#Specifying_a_URL_Instead_of_Putting_Bytes
@param   string  $type
@param   string  $file
@return  array
@throws  \Exception
Get the parameters to make the request