BrowscapPHP\Data\PropertyHolder::checkValueInArray PHP Method

checkValueInArray() public method

public checkValueInArray ( string $property, string $value ) : string
$property string
$value string
return string
    public function checkValueInArray($property, $value)
    {
        switch ($property) {
            case 'Browser_Type':
                $allowedValues = ['Useragent Anonymizer', 'Browser', 'Offline Browser', 'Multimedia Player', 'Library', 'Feed Reader', 'Email Client', 'Bot/Crawler', 'Application', 'Tool', 'unknown'];
                break;
            case 'Device_Type':
                $allowedValues = ['Console', 'TV Device', 'Tablet', 'Mobile Phone', 'Smartphone', 'Feature Phone', 'Mobile Device', 'FonePad', 'Desktop', 'Ebook Reader', 'Car Entertainment System', 'Digital Camera', 'unknown'];
                break;
            case 'Device_Pointing_Method':
                // This property is taken from http://www.scientiamobile.com/wurflCapability
                $allowedValues = ['joystick', 'stylus', 'touchscreen', 'clickwheel', 'trackpad', 'trackball', 'mouse', 'unknown'];
                break;
            case 'Browser_Bits':
            case 'Platform_Bits':
                $allowedValues = ['0', '8', '16', '32', '64'];
                break;
            default:
                throw new \InvalidArgumentException('Property "' . $property . '" is not defined to be validated');
                break;
        }
        if (in_array($value, $allowedValues)) {
            return $value;
        }
        throw new \InvalidArgumentException('invalid value given for Property "' . $property . '": given value "' . (string) $value . '", allowed: ' . json_encode($allowedValues));
    }