Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Api\ParseValue Class Reference

API module for using value parsers. More...

+ Inheritance diagram for Wikibase\Repo\Api\ParseValue:
+ Collaboration diagram for Wikibase\Repo\Api\ParseValue:

Public Member Functions

 __construct (ApiMain $mainModule, string $moduleName, DataTypeFactory $dataTypeFactory, ValueParserFactory $valueParserFactory, DataTypeValidatorFactory $dataTypeValidatorFactory, ExceptionLocalizer $exceptionLocalizer, ValidatorErrorLocalizer $validatorErrorLocalizer, PropertyDataTypeLookup $propertyDataTypeLookup, ApiErrorReporter $errorReporter, IBufferingStatsdDataFactory $stats=null)
 
 execute ()
 
 getAllowedParams ()
 

Static Public Member Functions

static factory (ApiMain $mainModule, string $moduleName, IBufferingStatsdDataFactory $stats, ApiHelperFactory $apiHelperFactory, DataTypeFactory $dataTypeFactory, DataTypeValidatorFactory $dataTypeValidatorFactory, ExceptionLocalizer $exceptionLocalizer, PropertyDataTypeLookup $propertyDataTypeLookup, ValidatorErrorLocalizer $validatorErrorLocalizer, ValueParserFactory $valueParserFactory)
 

Protected Member Functions

 getExceptionStatus (Exception $error)
 Returns a Status object representing the given exception using a localized message. More...
 
 getExamplesMessages ()
 

Private Member Functions

 getParser ()
 
 getValidator ()
 
 wrapValidators (array $validators)
 
 parseStringValue (ValueParser $parser, string $value, ?ValueValidator $validator)
 
 getValidatorErrorCodes (array $errors)
 
 addParseErrorToResult (array &$result, ParseException $parseError)
 
 outputResults (array $results)
 
 getOptionsObject (?string $optionsParam)
 

Private Attributes

 $dataTypeFactory
 
 $valueParserFactory
 
 $dataTypeValidatorFactory
 
 $validatorErrorLocalizer
 
 $exceptionLocalizer
 
 $propertyDataTypeLookup
 
 $errorReporter
 
 $stats
 

Detailed Description

API module for using value parsers.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Daniel Kinzler
Addshore

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\ParseValue::__construct ( ApiMain  $mainModule,
string  $moduleName,
DataTypeFactory  $dataTypeFactory,
ValueParserFactory  $valueParserFactory,
DataTypeValidatorFactory  $dataTypeValidatorFactory,
ExceptionLocalizer  $exceptionLocalizer,
ValidatorErrorLocalizer  $validatorErrorLocalizer,
PropertyDataTypeLookup  $propertyDataTypeLookup,
ApiErrorReporter  $errorReporter,
IBufferingStatsdDataFactory  $stats = null 
)
See also
ApiBase::__construct
Parameters
ApiMain$mainModule
string$moduleName
DataTypeFactory$dataTypeFactory
ValueParserFactory$valueParserFactory
DataTypeValidatorFactory$dataTypeValidatorFactory
ExceptionLocalizer$exceptionLocalizer
ValidatorErrorLocalizer$validatorErrorLocalizer
PropertyDataTypeLookup$propertyDataTypeLookup
ApiErrorReporter$errorReporter
IBufferingStatsdDataFactory | null$stats

Member Function Documentation

◆ addParseErrorToResult()

Wikibase\Repo\Api\ParseValue::addParseErrorToResult ( array &  $result,
ParseException  $parseError 
)
private

◆ execute()

Wikibase\Repo\Api\ParseValue::execute ( )

◆ factory()

static Wikibase\Repo\Api\ParseValue::factory ( ApiMain  $mainModule,
string  $moduleName,
IBufferingStatsdDataFactory  $stats,
ApiHelperFactory  $apiHelperFactory,
DataTypeFactory  $dataTypeFactory,
DataTypeValidatorFactory  $dataTypeValidatorFactory,
ExceptionLocalizer  $exceptionLocalizer,
PropertyDataTypeLookup  $propertyDataTypeLookup,
ValidatorErrorLocalizer  $validatorErrorLocalizer,
ValueParserFactory  $valueParserFactory 
)
static

◆ getAllowedParams()

Wikibase\Repo\Api\ParseValue::getAllowedParams ( )

◆ getExamplesMessages()

Wikibase\Repo\Api\ParseValue::getExamplesMessages ( )
protected

◆ getExceptionStatus()

Wikibase\Repo\Api\ParseValue::getExceptionStatus ( Exception  $error)
protected

Returns a Status object representing the given exception using a localized message.

Note
The returned Status will always be fatal, that is, $status->isOK() will return false.
See also
getExceptionMessage().
Parameters
Exception$error
Returns
Status

◆ getOptionsObject()

Wikibase\Repo\Api\ParseValue::getOptionsObject ( ?string  $optionsParam)
private

◆ getParser()

Wikibase\Repo\Api\ParseValue::getParser ( )
private
Returns
ValueParser
Exceptions
LogicException

◆ getValidator()

Wikibase\Repo\Api\ParseValue::getValidator ( )
private

◆ getValidatorErrorCodes()

Wikibase\Repo\Api\ParseValue::getValidatorErrorCodes ( array  $errors)
private
Parameters
Error[]$errors
Returns
string[]

◆ outputResults()

Wikibase\Repo\Api\ParseValue::outputResults ( array  $results)
private

◆ parseStringValue()

Wikibase\Repo\Api\ParseValue::parseStringValue ( ValueParser  $parser,
string  $value,
?ValueValidator  $validator 
)
private

◆ wrapValidators()

Wikibase\Repo\Api\ParseValue::wrapValidators ( array  $validators)
private
Parameters
ValueValidator[]$validators
Returns
ValueValidator

Member Data Documentation

◆ $dataTypeFactory

Wikibase\Repo\Api\ParseValue::$dataTypeFactory
private

◆ $dataTypeValidatorFactory

Wikibase\Repo\Api\ParseValue::$dataTypeValidatorFactory
private

◆ $errorReporter

Wikibase\Repo\Api\ParseValue::$errorReporter
private

◆ $exceptionLocalizer

Wikibase\Repo\Api\ParseValue::$exceptionLocalizer
private

◆ $propertyDataTypeLookup

Wikibase\Repo\Api\ParseValue::$propertyDataTypeLookup
private

◆ $stats

Wikibase\Repo\Api\ParseValue::$stats
private

◆ $validatorErrorLocalizer

Wikibase\Repo\Api\ParseValue::$validatorErrorLocalizer
private

◆ $valueParserFactory

Wikibase\Repo\Api\ParseValue::$valueParserFactory
private

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