/** * @since 2.1 * * @param DataTypeRegistry $datatypeRegistry * @param PropertyLabelFinder $propertyLabelFinder * @param array $propertyAliases */ public function __construct(DataTypeRegistry $datatypeRegistry, PropertyLabelFinder $propertyLabelFinder, array $propertyAliases) { $this->datatypeLabels = $datatypeRegistry->getKnownTypeLabels(); $datatypeAliases = $datatypeRegistry->getKnownTypeAliases(); $this->propertyLabelFinder = $propertyLabelFinder; foreach ($this->datatypeLabels as $id => $label) { $this->registerPropertyLabel($id, $label); } foreach ($datatypeAliases as $alias => $id) { $this->registerPropertyAlias($id, $alias); } foreach ($propertyAliases as $alias => $id) { $this->registerPropertyAlias($id, $alias); } }
/** * @since 2.1 * * @param DataTypeRegistry $datatypeRegistry * @param PropertyLabelFinder $propertyLabelFinder * @param PropertyAliasFinder $propertyAliasFinder * @param array $dataTypePropertyExemptionList */ public function __construct(DataTypeRegistry $datatypeRegistry, PropertyLabelFinder $propertyLabelFinder, PropertyAliasFinder $propertyAliasFinder, array $dataTypePropertyExemptionList = array()) { $this->datatypeLabels = $datatypeRegistry->getKnownTypeLabels(); $this->propertyLabelFinder = $propertyLabelFinder; $this->propertyAliasFinder = $propertyAliasFinder; // To get an index access $this->dataTypePropertyExemptionList = array_flip($dataTypePropertyExemptionList); foreach ($this->datatypeLabels as $id => $label) { if (isset($this->dataTypePropertyExemptionList[$label])) { continue; } $this->registerPropertyLabel($id, $label); } foreach ($datatypeRegistry->getKnownTypeAliases() as $alias => $id) { if (isset($this->dataTypePropertyExemptionList[$alias])) { continue; } $this->registerPropertyAlias($id, $alias); } }