{@inheritdoc}

@throws InvalidArgumentException
161276
public function getFormatsFromAttributes(array $attributes): array
    {
        if (!$attributes || !isset($attributes['resource_class'])) {
            return $this->configuredFormats;
        }

        $resourceMetadata = $this->resourceMetadataFactory->create($attributes['resource_class']);

        if (!$formats = $resourceMetadata->getOperationAttribute($attributes, 'formats', [], true)) {
            return $this->configuredFormats;
        }

        if (!\is_array($formats)) {
            throw new InvalidArgumentException(sprintf("The 'formats' attributes must be an array, %s given for resource class '%s'.", \gettype($formats), $attributes['resource_class']));
        }

        return $this->getOperationFormats($formats);
    }
584706
public function setArgument(string $argumentName, $value)
    {
        if ($argumentName === '') {
            throw new InvalidArgumentNameException('Invalid argument name.', 1300893885);
        }
        $this->arguments[$argumentName] = $value;
    }
60331
public function handle(CommandInterface $command)
    {
        if (!$this->supports(get_class($command))) {
            throw new InvalidArgumentException(
                sprintf(
                    'The command must be an instance of "%s". "%s" given.',
                    $this->getSupportedCommandClassName(),
                    get_class($command)
                )
            );
        }

        return $this->execute($command);
    }
184575
public function setArgument($name, $value) {
        if (!$this->definition->hasArgument($name)) {
            throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
        }

        $this->arguments[$name] = $value;
    }
383221
public function add($child, $type, array $execOptions = array(), array $initOptions = array())
    {
        if (!is_string($child) && !is_int($child)) {
            throw new \InvalidArgumentException(sprintf('child name should be string or, integer'));
        }

        if (null !== $type && !is_string($type) && !$type instanceof JobTypeinterface) {
            throw new \InvalidArgumentException('type should be string or JobTypeinterface');
        }

        $this->children[$child] = null; // to keep order
        $this->unresolvedChildren[$child] = array(
            'type' => $type,
            'init_options' => $initOptions,
            'exec_options' => $execOptions
        );

        return $this;
    }
536131
public function offsetSet($offset, $value): void
    {
        if ($this->isValidEntity($value)) {
            if (is_null($offset) || mb_strlen($offset) == 0) {
                $this->list[] = $value;
            } else {
                $this->list[$offset] = $value;
            }
        } else {
            throw new \InvalidArgumentException(sprintf('This collection does\'t accept this entity "%s"', gettype($value)));
        }
    }
1301485
public function handleOpen(string $fileName): void
	{
		if (strpos($fileName, '..' . DIRECTORY_SEPARATOR) !== false) {
			throw new InvalidArgumentException;
		}
		$file = $this->getFileInfo($fileName);
		if ($file->isDir) {
			$path = $this->getPath();
			$path[] = $fileName;
			$this->setPath($path);
		} else {
			$this->viewFile($file);
		}

		$this->redrawControl('fileManagerContainer');
	}
221302
protected function initialize(InputInterface $input, OutputInterface $output)
    {

        parent::initialize($input, $output);

        $translationMode = $input->getOption('mode');
        $validModes      = array(
            'reviewed',
            'translated',
            'default'
        );
        if (!in_array($translationMode, $validModes)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Invalid translation mode %s specified. Must be one of %s',
                    $translationMode,
                    implode(', ', $validModes)
                )
            );
        }
    }
783873
public function offsetGet($offset)
    {
        if (!$this->offsetExists($offset)) {
            throw new \InvalidArgumentException(sprintf(
                'Column "%s" does not exist, valid columns: "%s"',
                $offset, implode('", "', array_keys($this->getArrayCopy()))
            ));
        }

        return parent::offsetGet($offset);
    }
1115720
public function execute()
    {
        $length = mb_strlen($this->getValue());

        if (filter_var($this->numberToTruncate, FILTER_VALIDATE_INT) === false) {
            throw new \InvalidArgumentException("Value to truncate by is not a number");
        } elseif (filter_var($this->numberToTruncate, FILTER_VALIDATE_INT, array(
            "options" => array(
                "min_range" => 0,
                "max_range" => $length
            )
        )) === false) {
            throw new \InvalidArgumentException("Value to truncate by is out of bounds");
        } else {
            return (new SubString($this->getValue(), 0, $length - $this->numberToTruncate))->execute();
        }
    }
131123
public function setField(string $field) : void
    {
        $field = trim($field);
        if (empty($field)) {
            throw new InvalidArgumentException("Field is empty");
        }

        $this->field = $field;
    }
681884
protected function checkValueStructure(BaseValue $value)
    {
        if (isset($value->inputUri) && !is_string($value->inputUri)) {
            throw new InvalidArgumentType('$value->inputUri', 'string', $value->inputUri);
        }

        if (isset($value->id) && !is_string($value->id)) {
            throw new InvalidArgumentType('$value->id', 'string', $value->id);
        }

        // Required parameter $fileName
        if (!isset($value->fileName) || !is_string($value->fileName)) {
            throw new InvalidArgumentType('$value->fileName', 'string', $value->fileName);
        }

        // Optional parameter $alternativeText
        if (isset($value->alternativeText) && !is_string($value->alternativeText)) {
            throw new InvalidArgumentType(
                '$value->alternativeText',
                'string',
                $value->alternativeText
            );
        }

        if (isset($value->fileSize) && (!is_int($value->fileSize) || $value->fileSize < 0)) {
            throw new InvalidArgumentType(
                '$value->fileSize',
                'int',
                $value->alternativeText
            );
        }
    }
1295270
public function resolve($key) {
        if (!array_key_exists($key, $this->bindings)) {
            throw new InvalidArgumentException("{$key} is not bound.");
        }

        $binding = $this->bindings[$key];
        $value = $binding['value'];

        // singleton
        if ($value instanceof Closure) {
            return $value($this);
        }

        // anonymous object
        if (is_null($value) && class_exists('\\' . $key)) {
            return $this->make($key);
        }

        // labeled object
        if (is_string($value) && class_exists('\\' . $value)) {
            return $this->make($value);
        }

        return $value;
    }
265403
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->processorFactoryService) && !$container->hasAlias($this->processorFactoryService)) {
            return;
        }

        $dispatcher = $container->findDefinition($this->processorFactoryService);

        foreach ($container->findTaggedServiceIds($this->listenerTag) as $id => $tags) {
            $def = $container->getDefinition($id);
            $this->assertProcessorDefinition($def, $id);
            foreach ($tags as $attributes) {
                if (empty($attributes['command'])) {
                    throw new InvalidArgumentException(sprintf('The service "%s" is tagged as processor without specifying "command" attribute', $id));
                }
                $dispatcher->addMethodCall('registerProcessorIdForCommand', array(
                    $attributes['command'],
                    $id,
                ));
            }
        }
    }
262454
protected function validateConnectionConfig($connectionConfig)
    {
        if (!is_array($connectionConfig)) {
            throw new InvalidArgumentException($this->translate(
                'Db driver configuration should be an array or Traversable.'
            ));
        }

        if (!isset($connectionConfig['type'])) {
            throw new InvalidArgumentException($this->translate(
                'Cannot find connection type in configuration.'
            ));
        } else {
            if (!in_array($connectionConfig['type'], $this->supportedConnectionTypes)) {
                throw new InvalidArgumentException('Wrong connection type: ' . $connectionConfig['type']);
            }
        }

        if (isset($connectionConfig['options'])) {
            if (!(is_array($connectionConfig['options']))) {
                throw new InvalidArgumentException($this->translate(
                    'Db driver options should be an array or Traversable.'
                ));
            }
        }
    }
757674
protected function validate($value)
	{
		if ($value < $this->minValue || $value > $this->maxValue)
		{
			throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
		}
	}
904386
public function set($key, $value)
    {
        if (!is_string($key)) {
            throw new \InvalidArgumentException('Expected string as key');
        }

        if (!is_string($value)) {
            throw new \InvalidArgumentException('Expected string as value');
        }

        $queryString = 'REPLACE INTO ' . $this->name . ' VALUES (:key, :value);';
        $stmt = $this->db->prepare($queryString);
        $stmt->bindParam(':key', $key, \PDO::PARAM_STR);
        $stmt->bindParam(':value', $value, \PDO::PARAM_STR);
        $stmt->execute();
        $this->data[(string)$key] = $value;

        return $this->data[$key];
    }