Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\LinkedData\EntityDataFormatProvider Class Reference

Service for getting information about supported data formats. More...

Public Member Functions

 __construct ()
 
 setAllowedFormats (array $allowedFormats=null)
 
 getAllowedFormats ()
 
 getSupportedMimeTypes ()
 Returns the list of supported MIME types that can be used to specify the output format.
 
 getSupportedExtensions ()
 Returns the list of supported file extensions that can be used to specify a format.
 
 getSupportedFormats ()
 Returns the list of supported formats using their canonical names.
 
 getFormatName ( $format)
 Returns a canonical format name.
 
 getExtension ( $format)
 Returns a file extension suitable for $format, or null if no such extension is known.
 
 getMimeType ( $format)
 Returns a MIME type suitable for $format, or null if no such extension is known.
 
 isRdfFormat ( $format)
 Does $format specify a name for RDF format?
 

Private Member Functions

 initFormats ()
 Initializes the internal mapping of MIME types and file extensions to format names.
 
 newApiMain ( $format)
 Returns an ApiMain module that acts as a context for the formatting and serialization.
 

Static Private Member Functions

static getApiFormatName ( $format)
 Normalizes the format specifier; Converts mime types to API format names.
 
static getApiMimeTypes ( $format)
 Converts API format names to MIME types.
 

Private Attributes

 $allowedFormats = null
 
 $mimeTypes = null
 
 $fileExtensions = null
 
 $rdfWriterFactory
 

Detailed Description

Service for getting information about supported data formats.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::__construct ( )

Member Function Documentation

◆ getAllowedFormats()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getAllowedFormats ( )
Returns
string[]|null

◆ getApiFormatName()

static Wikibase\Repo\LinkedData\EntityDataFormatProvider::getApiFormatName ( $format)
staticprivate

Normalizes the format specifier; Converts mime types to API format names.

Parameters
string$formatThe format as supplied in the request
Returns
string|null The normalized format name, or null if the format is unknown

◆ getApiMimeTypes()

static Wikibase\Repo\LinkedData\EntityDataFormatProvider::getApiMimeTypes ( $format)
staticprivate

Converts API format names to MIME types.

Parameters
string$formatThe API format name
Returns
string[]|null The MIME types for the given format

◆ getExtension()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getExtension ( $format)

Returns a file extension suitable for $format, or null if no such extension is known.

Parameters
string$formatA canonical format name, as returned by getFormatName() or getSupportedFormats().
Returns
string|null

◆ getFormatName()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getFormatName ( $format)

Returns a canonical format name.

Used to normalize the format identifier.

Parameters
string$formatthe format as a file extension or MIME type.
Returns
string|null the canonical format name, or null of the format is not supported

◆ getMimeType()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getMimeType ( $format)

Returns a MIME type suitable for $format, or null if no such extension is known.

Parameters
string$formatA canonical format name, as returned by getFormatName() or getSupportedFormats().
Returns
string|null

◆ getSupportedExtensions()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getSupportedExtensions ( )

Returns the list of supported file extensions that can be used to specify a format.

Returns
string[]

◆ getSupportedFormats()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getSupportedFormats ( )

Returns the list of supported formats using their canonical names.

Returns
string[]

◆ getSupportedMimeTypes()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::getSupportedMimeTypes ( )

Returns the list of supported MIME types that can be used to specify the output format.

Returns
string[]

◆ initFormats()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::initFormats ( )
private

Initializes the internal mapping of MIME types and file extensions to format names.

◆ isRdfFormat()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::isRdfFormat ( $format)

Does $format specify a name for RDF format?

Parameters
string$format
Returns
bool

◆ newApiMain()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::newApiMain ( $format)
private

Returns an ApiMain module that acts as a context for the formatting and serialization.

Parameters
string$formatThe desired output format, as a format name that ApiBase understands.
Returns
ApiMain

◆ setAllowedFormats()

Wikibase\Repo\LinkedData\EntityDataFormatProvider::setAllowedFormats ( array $allowedFormats = null)
Parameters
string[] | null$allowedFormats

Member Data Documentation

◆ $allowedFormats

Wikibase\Repo\LinkedData\EntityDataFormatProvider::$allowedFormats = null
private

◆ $fileExtensions

Wikibase\Repo\LinkedData\EntityDataFormatProvider::$fileExtensions = null
private

◆ $mimeTypes

Wikibase\Repo\LinkedData\EntityDataFormatProvider::$mimeTypes = null
private

◆ $rdfWriterFactory

Wikibase\Repo\LinkedData\EntityDataFormatProvider::$rdfWriterFactory
private

The documentation for this class was generated from the following file: