{@inheritDoc}

@throws \InvalidArgumentException
509143
protected function compareTimestamp(RequestInterface $request, $expiry)
    {
        if (!$request->hasHeader('X-Authorization-Timestamp')) {
            throw new MalformedRequestException('Request is missing X-Authorization-Timestamp.', null, 0, $request);
        }

        $timestamp = (int) $request->getHeaderLine('X-Authorization-Timestamp');
        $current   = $this->getCurrentTimestamp();

        // Is the request too old?
        $lowerLimit = $this->getExpiry($expiry, $timestamp);
        if ($current > $lowerLimit) {
            return -1;
        }

        // Is the request too far in the future?
        $upperLimit = $this->getExpiry($expiry, $current);
        if ($timestamp > $upperLimit) {
            return 1;
        }

        // Timestamp is within the expected range.
        return 0;
    }
944207
public function setData($data)
    {
        if(!$this->getIsValidData($data))
        {
            throw new InvalidDataException();
        }

        if(!$this->getIsAllKeysValid($data))
        {
            throw new InvalidKeyException();
        }

        if(!$this->getIsAllValuesValid($data))
        {
            throw new InvalidValueException();
        }

        $this->__data = $data;
        $this->invalidateKeycache();
    }
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)));
        }
    }
1294713
public function setAttributes($values){

        if(is_array($values)){
            foreach($values as $name => $value){
                $this->setAttribute($name, $value);
            }
        }else{
            throw new InvalidArgumentException('"values" must be an array');
        }

    }
854716
public function offsetSet($offset, $value): void
    {
        if (false === $this->checkType($this->getKeyType(), $offset)) {
            throw new InvalidArgumentException(
                'Key must be of type ' . $this->getKeyType() . '; key is '
                . $this->toolValueToString($offset)
            );
        }

        if (false === $this->checkType($this->getValueType(), $value)) {
            throw new InvalidArgumentException(
                'Value must be of type ' . $this->getValueType() . '; value is '
                . $this->toolValueToString($value)
            );
        }

        parent::offsetSet($offset, $value);
    }
974267
public function fill($data)
    {
        if (!$this->object) {
            throw new InvalidArgumentException(
                'There are no object to be mapped'
            );
        }

        if (!is_object($data)) {
            throw new InvalidArgumentException('Data should be an object');
        }

        $data = $this->extractData($data);
        $allowed = $this->extractAllowedAttributes($this->class);

        foreach ($this->class->getProperties() as $property) {
            $name = $property->getName();
            if (!in_array($name, $allowed, true)
                || !array_key_exists(
                    $name,
                    $data
                )
            ) {
                continue;
            }

            $property->setAccessible(true);
            $property->setValue($this->object, $data[$name]);
        }

        return $this->object;
    }
174213
public function getParameter(string $parameter)
    {
        if ($this->hasParameter($parameter)) {
            return $this->getParameters()[$parameter];
        }

        throw new \InvalidArgumentException(sprintf('Parameter "%s" does not exist', $parameter));
    }
1321986
public function parameter($key, $value = NULL)
	{
		if (func_num_args() === 1)
		{
			if ( ! array_key_exists($key, $this->_parameters))
			{
				throw new \InvalidArgumentException('Parameter not set: '.$key);
			}
			return $this->_parameters[$key];
		}
		$this->_parameters[$key] = $value;
		return $this;
	}
958525
public function operation($operation)
    {
        $existing = $this->operations->findByIdentifier($operation);

        if ($existing) {
            return $existing;
        }

        $scaffoldClass = OperationScaffolder::getClassFromIdentifier($operation);
        if (!$scaffoldClass) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid operation: %s added to %s',
                    $operation,
                    $this->getDataObjectClass()
                )
            );
        }
        /**
         * @var OperationScaffolder $scaffolder
         */
        $scaffolder = Injector::inst()->createWithArgs($scaffoldClass, [$this->getDataObjectClass()]);

        $this->operations->push(
            $scaffolder->setChainableParent($this)
        );

        return $scaffolder;
    }
916504
public function check(...$args)
    {
        if (count($args) !== count($this->constraints)) {
            throw new InvalidArgumentException(
                'Argument number mismatch.'
            );
        }

        foreach ($args as $key => $arg) {
            if (!$this->constraints[$key]->check($arg, $args)) {
                throw new InvalidArgumentException(vsprintf(
                    'Argument %s does not meet its constraints.'
                    . "\nFailed constraint: %s\nValue provided:%s",
                    [
                        $key,
                        $this->constraints[$key]->toString(),
                        print_r($arg, true)
                    ]
                ));
            }
        }
    }
1234559
public function validateArguments()
    {
        $argumentDefinitions = $this->prepareArguments();
        if (!count($argumentDefinitions)) {
            return;
        }

        /** @var $registeredArgument ArgumentDefinition */
        foreach ($argumentDefinitions as $argumentName => $registeredArgument) {
            if ($this->hasArgument($argumentName)) {
                if ($this->arguments[$argumentName] === $registeredArgument->getDefaultValue()) {
                    continue;
                }

                $type = $registeredArgument->getType();
                if ($type === 'array') {
                    if (!is_array($this->arguments[$argumentName]) && !$this->arguments[$argumentName] instanceof \ArrayAccess && !$this->arguments[$argumentName] instanceof \Traversable) {
                        throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "array", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '"', 1237900529);
                    }
                } elseif ($type === 'boolean') {
                    if (!is_bool($this->arguments[$argumentName])) {
                        throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "boolean", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1240227732);
                    }
                } elseif (class_exists($type, false)) {
                    if (!($this->arguments[$argumentName] instanceof $type)) {
                        if (is_object($this->arguments[$argumentName])) {
                            throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . get_class($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475114);
                        } else {
                            throw new \InvalidArgumentException('The argument "' . $argumentName . '" was registered with type "' . $type . '", but is of type "' . gettype($this->arguments[$argumentName]) . '" in view helper "' . get_class($this) . '".', 1256475113);
                        }
                    }
                }
            }
        }
    }
157246
public function compile()
    {
        $indent    = '    ';
        $getters   = array();
        $instances = $this->dumper->getAllInjectedDefinitions();

        /* @var $instance GeneratorInstance */
        foreach ($instances as $name => $instance) {
            $constructor = $instance->getConstructor();
            $instantiatorParams = $this->buildParams($instance->getParams());

            if ('__construct' !== $constructor) {
                // Constructor callback
                if (is_callable($constructor)) {
                    $callback = $constructor;

                    if (is_array($callback)) {
                        $class = (is_object($callback[0])) ? get_class($callback[0]) : $callback[0];
                        $method = $callback[1];
                    } elseif (is_string($callback) && strpos($callback, '::') !== false) {
                        list($class, $method) = explode('::', $callback, 2);
                    }

                    $callback = var_export(array($class, $method), true);

                    if (count($instantiatorParams)) {
                        $creation = sprintf('$object = call_user_func(%s, %s);', $callback, implode(', ', $instantiatorParams));
                    } else {
                        $creation = sprintf('$object = call_user_func(%s);', $callback);
                    }
                } else if (is_string($constructor) && strpos($constructor, '->') !== false) {
                    list($class, $method) = explode('->', $constructor, 2);

                    if (!class_exists($class)) {
                        throw new InvalidArgumentException('No class found: ' . $class);
                    }

                    if (count($instantiatorParams)) {
                        $creation = sprintf(
                            '$object = $di->get(%s)->%s(%s);',
                            var_export($class, true),
                            $method,
                            implode(', ', $instantiatorParams)
                        );
                    } else {
                        $creation = sprintf('$object = $di->get(%s)->%s();', var_export($class, true), $method);
                    }
                } else {
                    throw new InvalidArgumentException('Invalid instantiator supplied for class: ' . $name);
                }
            } else {
                $className = '\\' . trim($this->reduceAlias($name), '\\');

                if (count($instantiatorParams)) {
                    $creation = sprintf('$object = new %s(%s);', $className, implode(', ', $instantiatorParams));
                } else {
                    $creation = sprintf('$object = new %s();', $className);
                }
            }


            // Create method call code
            if ($instance->isShared()) {
                $creation .= "\n\nif (\$isShared) {\n" . $indent
                    . '$di->instanceManager()->addSharedInstance($object, \'' . $instance->getName() . '\');'
                    . "\n}\n";
            }

            $methods = '';

            foreach ($instance->getMethods() as $methodData) {
                $methodName   = $methodData['method'];
                $methodParams = $methodData['params'];
                // Create method parameter representation
                $params = $this->buildParams($methodParams);

                if (count($params)) {
                    $methods .= sprintf("\$object->%s(%s);\n", $methodName, implode(', ', $params));
                }
            }

            // Start creating getter
            $getterBody = "function (\\Zend\\Di\\Di \$di, \$isShared) {\n";

            // Creation and method calls
            $getterBody .= $indent . str_replace("\n", "\n" . $indent, $creation) . "\n";
            $getterBody .= $indent . str_replace("\n", "\n" . $indent, $methods);

            // End getter body
            $getterBody .= "\n" . $indent . "return \$object;\n}";

            $getters[$name] = $getterBody;
        }

        $fileBody = "return array(\n";

        foreach ($getters as $name => $getterBody) {
            $fileBody .= $indent . var_export($name, true);
            $fileBody .= ' => ' . str_replace("\n", "\n" . $indent, $getterBody) . ",\n\n";
        }

        $fileBody .= ");\n";

        // Create PHP file code generation object
        $generator = $this->getFileGenerator();
        $generator->setBody($fileBody);

        return $generator;
    }
1306371
public function load(InputInterface $input): ConfigInterface
    {
        $configFile = $input->getOption('config');
        if (!$configFile || !$this->filesystem->fileExists($configFile)) {
            throw InvalidArgumentException::invalidConfigFile();
        }
        $config = include $configFile;
        if (!$config instanceof ConfigInterface) {
            throw InvalidArgumentException::invalidConfigFile();
        }

        return $config;
    }
1150379
public function execute(array $args, array $options = [])
    {
        if (!isset($args[0])) {
            throw new \InvalidArgumentException('arg action must be input');
        }
        $action = explode('::', $args[0]);
        if (!class_exists($action[0])) {
            throw new \InvalidArgumentException('action not not found!');
        }

        if (isset($args[1])) {
            $frequency = abs(intval($args[1]));
        } else {
            $frequency = null;
        }
        ProcessManage::addTask($action, $frequency);
    }
105659
public function execute( $query ) {
		if ( $query instanceof QueryBuilder ) {
			$query = $query->getSPARQL();
		}

		if ( !is_string( $query ) ) {
			throw new InvalidArgumentException( '$query has to be a string or an instance of QueryBuilder' );
		}

		$result = $this->getResult( $query );
		
		// TODO also support ask queries (with key 'boolean')
		//      https://www.w3.org/TR/rdf-sparql-json-res/
		return $result['results'];
	}
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,
                ));
            }
        }
    }
1156676
public function addInstaller(InstallerInterface $installer)
    {
        $installerClass = get_class($installer);

        if (!isset($this->installers[$installerClass])) {
            if ($installer instanceof OrderedInstallerInterface && $installer instanceof DependentInstallerInterface) {
                throw new \InvalidArgumentException(sprintf('Class "%s" can\'t implement "%s" and "%s" at the same time.',
                    $installerClass,
                    'OrderedInstallerInterface',
                    'DependentInstallerInterface'));
            } elseif ($installer instanceof OrderedInstallerInterface) {
                $this->orderInstallersByNumber = true;
            } elseif ($installer instanceof DependentInstallerInterface) {
                $this->orderInstallersByDependencies = true;
                foreach ($installer->getDependencies() as $class) {
                    $this->addInstaller(new $class);
                }
            }

            $this->installers[$installerClass] = $installer;
        }
    }