Checks the 'typ' field against the allowed types in the U2F spec (sec.
7.1)
@param string $type the 'typ' value
@return $this
@throws InvalidDataException if a non-conforming value is provided
433227
private function setType(string $type): self
    {
        switch ($type) {
            case 'navigator.id.getAssertion': // fall through
            case 'navigator.id.finishEnrollment':
                break;
            default:
                throw new IDE(IDE::MALFORMED_DATA, 'typ');
        }
        $this->typ = $type;
        return $this;
    }
289421
public function addDisallowedType($type)
    {
        if (!in_array(strtolower($type), $this->disallowedTypes)) {
            $this->disallowedTypes[] = strtolower($type);
        }
        return $this;
    }
1009926
public function setType($type)
    {
        if (strlen($type) == 0) {
            throw new \InvalidArgumentException(sprintf('MIME type should not be empty'));
        }

        if (!preg_match('@^[^/]+/[^/]+$@', $type)) {
            throw new \InvalidArgumentException(sprintf('Invalid MIME type: %s', $type));
        }

        $this->type = $type;

        return $this;
    }
190695
public function setProductType(string $type)
    {
        $types = [self::TYPE_DIGITAL, self::TYPE_PHYSICAL, self::TYPE_HYBRID];

        if (!in_array($type, $types)) {
            throw new \InvalidArgumentException('Invalid productType \'' . $type . '\'');
        }
        $this->productType = $type;
    }
192023
public function addType($type)
    {
        if (!in_array($type, $this->validTypes())) {
            throw new InvalidArgumentException(
                sprintf('Invalid cache type: "%s"', $type)
            );
        }

        $this->types[$type] = true;
        return $this;
    }
1329038
private function isValidCodeType(string $codeType): void
    {
        $allowedCodeType = $this->getAllowedCodeType();
        if (!\in_array($codeType, $allowedCodeType, true)) {
            throw new InvalidTypeException(sprintf(
                'codeType must be either "%s".',
                implode(', ', $allowedCodeType)
            ));
        }
    }
85394
public function setType($type)
    {
        if (!is_string($type) || empty($type)) {
            throw MetadataException::invalidEntityType();
        }
        $this->type = $type;
        return $this;
    }
292399
public function setType(?string $type): Workflow
    {
        if ($type !== null) {
            Assert::oneOf($type, self::VALID_TYPES);
        }
        $this->type = $type;

        return $this;
    }
996442
public function setEncodingType($type)
    {
        if ($type === false || $type === self::RFC1738 || $type === self::RFC3986) {
            $this->encoding = $type;
        } else {
            throw new \InvalidArgumentException('Invalid URL encoding type');
        }

        return $this;
    }
906538
public function setType($type)
    {
        if (is_string($type)) {
            if ('all' == strtolower($type)) {
                $this->type = array_keys($this->cards);
            } else {
                $this->type = explode(',', $type);
            }
        } elseif (is_array($type)) {
            $this->type = $type;
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type array or string, "%s" given',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }

        return $this;
    }
1087438
public function setValue($type)
    {
        if (is_numeric($type) && in_array($type, self::TYPE)) {
            $this->type = (int) $type;
        } elseif (is_string($type) && array_key_exists(strtoupper($type), self::TYPE)) {
            $this->type = self::TYPE[strtoupper($type)];
        } elseif (is_string($type) && array_key_exists(strtoupper($type), self::SHORT_NAME)) {
            $this->type = self::SHORT_NAME[strtoupper($type)];
        } else {
            throw new InvalidArgumentException(sprintf('The value "%s" is not a valid AceType.', $type));
        }

        return $this;
    }
494764
private function checkForMixedType(string $type): self
    {
        if (strtolower($type) === 'mixed') {
            throw (new CodeWarning(static::CODE_MIXED_TYPE, self::MESSAGE_MIXED_TYPE, $this->stackPos))
                ->setToken($this->token);
        }

        return $this;
    }
277421
private function validateType($type)
    {
        if (!in_array($type, self::$validTypes)) {
            throw new InvalidMappingException(
                'Invalid uploadable field type reference. Must be one of: '.implode(', ', self::$validTypes)
            );
        }
    }
827880
public function setType(string $type) : void
    {
        if (empty($type)) {
            throw new InvalidArgumentException('Empty field type is not allowed: ' . $this->getName());
        }

        $this->_type = $this->_extractType($type);
    }
942623
public function validatePropertyType($type)
    {
        if (!in_array($type, $this->getPropertyTypes())) {
            throw $this->getException(
                'The property type isn\'t valid ("%s" given, expecting one of following: %s)',
                [$type, implode(', ', $this->getPropertyTypes())]
            );
        }

        return $type;
    }
674677
public static function isValidFieldType(string $type) : bool
    {
        try {
            $config = ConfigFactory::getByType($type, 'dummy_field');
        } catch (InvalidArgumentException $e) {
            return false;
        }

        return true;
    }
18504
public function setEncType($type) {

		$type = strtolower($type);

		if($type != 'application/x-www-form-urlencoded' && $type != 'multipart/form-data' && !empty($type)) {
			throw new HtmlFormException("Invalid form enctype: '$type'.", HtmlFormException::INVALID_ENCTYPE);
		}

		$this->encType = $type;

		return $this;

	}