Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\SnakFactory Class Reference

Factory for creating new snaks. More...

Public Member Functions

 __construct (PropertyDataTypeLookup $dataTypeLookup, DataTypeFactory $dataTypeFactory, DataValueFactory $dataValueFactory)
 
 newSnak (PropertyId $propertyId, $snakType, $rawValue=null)
 Builds and returns a new snak from the provided property, snak type and optional snak value. More...
 

Private Member Functions

 createSnak (PropertyId $propertyId, $snakType, DataValue $value=null)
 Builds and returns a new snak from the provided property, snak type and optional snak value and value type. More...
 

Private Attributes

 $dataTypeLookup
 
 $dataTypeFactory
 
 $dataValueFactory
 

Detailed Description

Factory for creating new snaks.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\SnakFactory::__construct ( PropertyDataTypeLookup  $dataTypeLookup,
DataTypeFactory  $dataTypeFactory,
DataValueFactory  $dataValueFactory 
)

Member Function Documentation

◆ createSnak()

Wikibase\Repo\SnakFactory::createSnak ( PropertyId  $propertyId,
  $snakType,
DataValue  $value = null 
)
private

Builds and returns a new snak from the provided property, snak type and optional snak value and value type.

Parameters
PropertyId$propertyId
string$snakType
DataValue | null$value
Returns
Snak
Exceptions
InvalidArgumentException

◆ newSnak()

Wikibase\Repo\SnakFactory::newSnak ( PropertyId  $propertyId,
  $snakType,
  $rawValue = null 
)

Builds and returns a new snak from the provided property, snak type and optional snak value.

Parameters
PropertyId$propertyId
string$snakType
mixed$rawValue
Returns
Snak
Exceptions
PropertyDataTypeLookupExceptionfrom getDataTypeIdForProperty
OutOfBoundsExceptionfrom getType
InvalidArgumentExceptionfrom newDataValue, newDataValue and newSnak

Member Data Documentation

◆ $dataTypeFactory

Wikibase\Repo\SnakFactory::$dataTypeFactory
private

◆ $dataTypeLookup

Wikibase\Repo\SnakFactory::$dataTypeLookup
private

◆ $dataValueFactory

Wikibase\Repo\SnakFactory::$dataValueFactory
private

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