/**
* Setup a Fallback Type and Property
*
* @param string $type The Fallback Type
* @param string $property The Fallback Property
*
* @return Microdata Instance of $this
*
* @since 3.2
*/
public function fallback($type, $property)
{
if (!$this->enabled) {
return $this;
}
// Sanitize the $Type
$this->fallbackType = static::sanitizeType($type);
// If the given $Type isn't available, fallback to 'Thing' Type
if (!static::isTypeAvailable($this->fallbackType)) {
$this->fallbackType = 'Thing';
}
// Control if the $Property exist in the given $Type and setup it, otherwise leave it 'NULL'
if (static::isPropertyInType($this->fallbackType, $property)) {
$this->fallbackProperty = $property;
} else {
$this->fallbackProperty = null;
}
return $this;
}