BrowscapPHP\Data\PropertyHolder::getPropertyType PHP Method

getPropertyType() public method

Get the type of a property.
public getPropertyType ( string $propertyName ) : string
$propertyName string
return string
    public function getPropertyType($propertyName)
    {
        $stringProperties = ['Comment', 'Browser', 'Browser_Maker', 'Browser_Modus', 'Platform', 'Platform_Name', 'Platform_Description', 'Device_Name', 'Platform_Maker', 'Device_Code_Name', 'Device_Maker', 'Device_Brand_Name', 'RenderingEngine_Name', 'RenderingEngine_Description', 'RenderingEngine_Maker', 'Parent', 'PropertyName', 'CDF'];
        if (in_array($propertyName, $stringProperties)) {
            return self::TYPE_STRING;
        }
        $arrayProperties = ['Browser_Type', 'Device_Type', 'Device_Pointing_Method', 'Browser_Bits', 'Platform_Bits'];
        if (in_array($propertyName, $arrayProperties)) {
            return self::TYPE_IN_ARRAY;
        }
        $genericProperties = ['Platform_Version', 'RenderingEngine_Version', 'Released', 'Format', 'Type'];
        if (in_array($propertyName, $genericProperties)) {
            return self::TYPE_GENERIC;
        }
        $numericProperties = ['Version', 'CssVersion', 'AolVersion', 'MajorVer', 'MinorVer'];
        if (in_array($propertyName, $numericProperties)) {
            return self::TYPE_NUMBER;
        }
        $booleanProperties = ['Alpha', 'Beta', 'Win16', 'Win32', 'Win64', 'Frames', 'IFrames', 'Tables', 'Cookies', 'BackgroundSounds', 'JavaScript', 'VBScript', 'JavaApplets', 'ActiveXControls', 'isMobileDevice', 'isTablet', 'isSyndicationReader', 'Crawler', 'MasterParent', 'LiteMode', 'isFake', 'isAnonymized', 'isModified'];
        if (in_array($propertyName, $booleanProperties)) {
            return self::TYPE_BOOLEAN;
        }
        throw new \InvalidArgumentException("Property {$propertyName} did not have a defined property type");
    }