Checks the type of any added item and throws an exception
if it does not match.

@param mixed $value
776740
protected function checkType($value)
    {
        if (!$value instanceof AssetContract) {
            throw new InvalidArgumentException("You can only add values of '{$this->forceType}' to this list");
        }

        if (!$mimeType = $value->mimeType()) {
            throw new InvalidArgumentException('The added asset must have a mimeType to add it to this collection');
        }

        if (!$this->mimeType) {
            $this->mimeType = $mimeType;

            return;
        }

        if ($this->mimeType != $mimeType) {
            throw new InvalidArgumentException("This collection accepts only mimeType {$this->mimeType} not $mimeType");
        }
    }
576147
public function setSandbox($value)
    {
        if (is_bool($value)) {
            $this->config['sandbox'] = $value;
        } else {
            throw new \Exception('sandbox value ' . $value . ' is of type ' . gettype($value) . ' and should be a boolean value');
        }
    }
696725
private function isType(string $type, $value)
    {
        switch ($type) {
            case 'bool':
                return is_bool($value);

            case 'int':
                return is_int($value);

            case 'float':
                return is_float($value) || is_int($value);

            case 'string':
                return is_string($value);

            case 'array':
                return is_array($value);

            default:
                throw new InvalidParamsException('Type match error');
        }
    }
1270191
private function checkPartMatchingType($value, $type)
    {
        switch ($type) {
            case "digit":
                return ctype_digit($value);
                break;

            case "hex":
                return ctype_xdigit($value);
                break;

            case "alpha":
                return ctype_alpha($value);
                break;

            case "alphanum":
                return ctype_alnum($value);
                break;

            default:
                return false;
        }
    }
259770
protected function isValid($value)
    {
        if (is_null($value) || is_float($value) || is_int($value)) {
            return;
        }
        $this->addError('A valid float is expected.', 1514998717);
    }
1147946
public function validateValue($value)
    {
        if (!$value instanceof MoneyInterface) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Value of type "%s" is invalid for %s; must implement "%s"',
                    is_object($value) ? get_class($value) : gettype($value),
                    get_class($this),
                    MoneyInterface::class
                )
            );
        }
    }
833363
public function isValueValid($value) {
		return $value instanceof Type\CreativeWork || $value instanceof Type\ItemList || $value instanceof DataType\TextType;
	}
1162151
protected function isValid($value) {

		if(!($value instanceof PersistentResource)) {
			$this->addError('Given value is no Flow Resource', 1433344498);
		}

		$fileMimeType = $value->getMediaType();

		if(!\in_array($fileMimeType, $this->options['allowedMimeTypes'], true)) {
			$this->addError(
				'The given asset was not of type %1$s but is of type %2$s',
				1433343575,
				array(
					implode(', ', $this->options['allowedMimeTypes']),
					$fileMimeType
				)
		);
		}

	}
37636
public function setValue($value) {
		if (is_array($value)) {
		    foreach ($value as $singleValue) {
		        if (!$this->isValueValid($singleValue)) {
		            throw new \Exception('Unexpected value type');
		        }
		    }
		} elseif (!$this->isValueValid($value)) {
		    throw new \Exception('Unexpected value type');
		}
		$this->value = $value;

		return $this;
	}
404709
private function ensurePropertyType($value)
    {
        $actualType = gettype($value);
        if ('object' === $actualType) {
            $actualType = get_class($value);
        }

        if ($this->expectedType !== $actualType) {
            throw new Exceptions\InvalidPropertyTypeException($this->class, $this->property, $this->expectedType, $actualType);
        }
    }
21275
public function append($value)
    {
        $arrayType = $this->getChildName();
        if (!($value instanceof $arrayType)) {
            throw new TypeMismatchException('Passed argument is not an instance of ' . $arrayType);
        } else {
            parent::append($value);
        }
        return $this;
    }
253849
private function check($value) {

		if(true === is_string($value)) {
			return false !== filter_var(trim($value), \FILTER_VALIDATE_EMAIL);
		}

		return false;
	}
1083777
public function processValue($value)
	{
		$clean = strip_tags($value);

		if (array_key_exists($clean, $this->types)) {
			if (!isset($this->types[$clean]['value'])) {
				$this->types[$clean]['value'] = 0;
			}
			$this->types[$clean]['value'] += 1;
		}
	}
815302
public static function stringOrInteger($value)
    {
        if (!is_string($value) and !is_int($value)) {
            $message = sprintf('Value "%s" expected to be string or integer, type %s given.', static::stringify($value), gettype($value));

            throw static::createException($value, $message, static::INVALID_STRING_INTEGER, null);
        }
    }
639851
protected function _checkLock($value)
	{
		switch($value)
		{
			case MShop_Order_Manager_Base_Abstract::LOCK_DISABLE:
			case MShop_Order_Manager_Base_Abstract::LOCK_ENABLE:
				break;
			default:
				throw new MShop_Order_Exception( sprintf( 'Lock flag "%1$d" not within allowed range', $value ) );
		}
	}
923517
protected function isValid($value)
    {
        if (is_null($value)) {
            return;
        }

        /**
         * @var ValidatorInterface $itemValidator
         */
        $itemValidator = $this->options['itemValidator'];
        if (is_array($value) || ($value instanceof \Traversable)) {
            foreach ($value as $key => $item) {
                $itemResult = $itemValidator->validate($item);
                if ($itemResult->hasErrors()) {
                    $this->result->forProperty($key)->merge($itemResult);
                }
            }
        } else {
            $this->addError('Array-value is expected to be an array or implement \Traversable', 1515070099);
        }
    }
440339
public function setType($value)
    {
        $this->_validateNotNull('Type', $value);
        $this->_validateString('Type', $value);

        if ($this->data['type'] === $value) {
            return;
        }

        $this->data['type'] = $value;

        $this->_setModified('type');
    }