Back to Microdata class

Method isPropertyInType

public static bool
isPropertyInType
(mixed $type, mixed $property)
Recursive function, control if the given Type has the given Property
Parameters
  • string $type The Type where to check
  • string $property The Property to check
Returns
  • bool
Since
  • 3.2
Class: Microdata
Project: Joomla

Method isPropertyInType - Source code

/**
 * Recursive function, control if the given Type has the given Property
 *
 * @param   string  $type      The Type where to check
 * @param   string  $property  The Property to check
 *
 * @return  boolean
 *
 * @since   3.2
 */
public static function isPropertyInType($type, $property)
{
    if (!static::isTypeAvailable($type)) {
        return false;
    }
    // Control if the $Property exists, and return 'true'
    if (\array_key_exists($property, static::$types[$type]['properties'])) {
        return true;
    }
    // Recursive: Check if the $Property is inherit
    $extendedType = static::$types[$type]['extends'];
    if (!empty($extendedType)) {
        return static::isPropertyInType($extendedType, $property);
    }
    return false;
}