private function endpoint($endpoint, $schema = null, $doc_id = null, $file_id = null)
    {
        $endpoints = [
            'auth' => 'auth/',
            'user' => 'auth/user/',
            'schema-list' => 'schemas/',
            'schema-detail' => 'schemas/%s/',
            'document-query' => 'schemas/%s/query/',
            'document-save' => 'schemas/%s/save/',
            'document-detail' => 'schemas/%s/%s/',
            'file-list' => 'files/',
            'file-detail' => 'files/%s/',
        ];

        if (!array_key_exists($endpoint, $endpoints))
        {
            throw new MontageUnknownEndpointException(
                sprintf('Unknown endpoint "%s" requested.', $endpoint)
            );
        }

        //do the endpoint formatting
        if (!is_null($file_id)) {
            return sprintf($endpoints[$endpoint], $file_id);
        } else if (!is_null($schema) && !is_null($doc_id)) {
            return sprintf($endpoints[$endpoint], $schema, $doc_id);
        } else if (!is_null($schema)) {
            return sprintf($endpoints[$endpoint], $schema);
        }

        return $endpoints[$endpoint];
    }
private function endpoint($endpoint, $schema = null, $doc_id = null, $file_id = null)
    {
        $endpoints = [
            'auth' => 'auth/',
            'user' => 'auth/user/',
            'schema-list' => 'schemas/',
            'schema-detail' => 'schemas/%s/',
            'document-query' => 'schemas/%s/query/',
            'document-save' => 'schemas/%s/save/',
            'document-detail' => 'schemas/%s/%s/',
            'file-list' => 'files/',
            'file-detail' => 'files/%s/',
        ];

        if (!array_key_exists($endpoint, $endpoints))
        {
            throw new MontageUnknownEndpointException(
                sprintf('Unknown endpoint "%s" requested.', $endpoint)
            );
        }

        //do the endpoint formatting
        if (!is_null($file_id)) {
            return sprintf($endpoints[$endpoint], $file_id);
        } else if (!is_null($schema) && !is_null($doc_id)) {
            return sprintf($endpoints[$endpoint], $schema, $doc_id);
        } else if (!is_null($schema)) {
            return sprintf($endpoints[$endpoint], $schema);
        }

        return $endpoints[$endpoint];
    }
private function endpoint ( $ endpoint , $ schema = null , $ doc_id = null , $ file_id = null ) { $ endpoints = [ 'auth' => 'auth/' , 'user' => 'auth/user/' , 'schema-list' => 'schemas/' , 'schema-detail' => 'schemas/%s/' , 'document-query' => 'schemas/%s/query/' , 'document-save' => 'schemas/%s/save/' , 'document-detail' => 'schemas/%s/%s/' , 'file-list' => 'files/' , 'file-detail' => 'files/%s/' , ] ; if ( ! array_key_exists ( $ endpoint , $ endpoints ) ) { throw new MontageUnknownEndpointException ( sprintf ( 'Unknown endpoint "%s" requested.' , $ endpoint ) ) ; } //do the endpoint formatting if ( ! is_null ( $ file_id ) ) { return sprintf ( $ endpoints [ $ endpoint ] , $ file_id ) ; } else if ( ! is_null ( $ schema ) && ! is_null ( $ doc_id ) ) { return sprintf ( $ endpoints [ $ endpoint ] , $ schema , $ doc_id ) ; } else if ( ! is_null ( $ schema ) ) { return sprintf ( $ endpoints [ $ endpoint ] , $ schema ) ; } return $ endpoints [ $ endpoint ] ; }
Creates a formatted Montage API endpoint string.

@param $endpoint
@param null $schema
@param null $doc_id
@param null $file_id
@return string
@throws MontageUnknownEndpointException
Creates a formatted Montage API endpoint string .