{@inheritdoc}

@throws InvalidArgumentException
351020
protected function configure(): void
    {
        parent::configure();

        $this->addOption(
            $this->getDisableLockCommandOptionName(),
            '',
            InputOption::VALUE_NONE,
            'Disable command locking'
        );
    }
1071433
public function get_argument( $key ) {
		if ( $this->has_argument( $key ) ) {
			return $this->arguments[ $key ];
		}

		throw new \InvalidArgumentException( sprintf( 'Argument "%s" not found.', $key ) );
	}
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
            );
        }
    }
1019510
public function setConst(string $const): void
	{
		if (!$this->locale) {
			throw new InvalidArgumentException('Locale must be set before calling setConst');
		}
		if (Strings::match($const, '/[^A-Za-z0-9_]/')) {
			throw new InvalidArgumentException('Constant contains invalid characters');
		}

		/* @var $repository ContentRepository */
		$repository = $this->getRepository();
		$content = $repository->getByConst($const, $this->locale->name);
		if ($content !== null && $content !== $this) {
			throw new UniqueConstraintViolationException("Content with '$const' exists");
		}
		$this->const = $const;
	}
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)));
        }
    }
1275423
public static function initialize(Configuration $configuration)
    {
        $configuration = static::normalizeConfiguration($configuration);
        
        if (!$configuration->validateIdentity()) {
            throw new InvalidArgumentException('Bad configuration identity');
        }
        
        if (!$configuration->validateConnection()) {
            throw new InvalidArgumentException('Bad connection settings. Check your configuration file ":file"', [
                'file' => $configuration->getIdentity(),
            ]);
        }
        
        static::loadAdditionalConfiguration($configuration);
        
        static::getServiceContainer()->set('configuration', $configuration);
        static::getServiceContainer()->set('classLoader', self::initializeClassLoader());
        
        static::getServiceContainer()->getDispatcher()
            ->addListener(null, [static::getServiceContainer()->getLogger(), 'event']);
    }
674986
public function setAccessorOrder($order, array $customOrder = []): void
    {
        if (! \in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
            throw new InvalidArgumentException(\sprintf('The accessor order "%s" is invalid.', $order));
        }

        foreach ($customOrder as $name) {
            if (! \is_string($name)) {
                throw new InvalidArgumentException(\sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', \var_export($name, true)));
            }
        }

        $this->accessorOrder = $order;
        $this->customOrder = \array_flip($customOrder);
        $this->sortProperties();
    }
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;
    }
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,
                ));
            }
        }
    }
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;
    }
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.'
                ));
            }
        }
    }
331466
public function init()
    {
        $extensions = [];

        if (empty($this->extensionClasses) && empty($this->userConfig)) {
            return;
        }

        foreach ($this->extensionClasses as $extensionClass) {
            if (!class_exists($extensionClass)) {
                throw new \InvalidArgumentException(sprintf(
                    'Extension class "%s" does not exist',
                    $extensionClass
                ));
            }

            $extension = new $extensionClass();

            if (!$extension instanceof ExtensionInterface) {
                throw new \InvalidArgumentException(sprintf(
                    // add any manually specified extensions
                    'Extension "%s" must implement the PhpBench\\Extension interface',
                    get_class($extension)
                ));
            }

            $extensions[] = $extension;

            $this->config = array_merge(
                $this->config,
                $extension->getDefaultConfig()
            );
        }

        $diff = array_diff(array_keys($this->userConfig), array_keys($this->config));

        if ($diff) {
            throw new \InvalidArgumentException(sprintf(
                'Unknown configuration keys: "%s". Permitted keys: "%s"',
                implode('", "', $diff), implode('", "', array_keys($this->config))
            ));
        }

        $this->config = array_merge(
            $this->config,
            $this->userConfig
        );

        foreach ($extensions as $extension) {
            $extension->load($this);
        }
    }
1002579
public function create( $username, $password, $email = null ) {
		if ( !is_string( $username ) ) {
			throw new InvalidArgumentException( '$username should be a string' );
		}
		if ( !is_string( $password ) ) {
			throw new InvalidArgumentException( '$password should be a string' );
		}
		if ( !is_string( $email ) && !is_null( $email ) ) {
			throw new InvalidArgumentException( '$email should be a string or null' );
		}

		$params = [
			'createreturnurl' => $this->api->getApiUrl(),
			'createtoken' => $this->api->getToken( 'createaccount' ),
			'username' => $username,
			'password' => $password,
			'retype' => $password,
		];

		if ( !is_null( $email ) ) {
			$params['email'] = $email;
		}

		try {
			$result = $this->api->postRequest( new SimpleRequest( 'createaccount', $params ) );
			return $result['createaccount']['status'] === 'PASS';
		} catch ( UsageException $exception ) {
			// If the above request failed, try again in the old way.
			if ( $exception->getApiCode() === 'noname' ) {
				return $this->createPreOneTwentySeven( $params );
			}
			throw $exception;
		}
	}
1099970
public function execute($options = [])
    {
        if (! is_array($options) && ! $options instanceof Option) throw new \InvalidArgumentException('invalid option');

        $option = $this->getOption();
        if (is_array($options)) {
            $option->importFromArray($options);
        } else {
            $option->import($options);
        }
        $option->validate();

        $this->method->invoke($this->list, $option);
    }
584706
public function setArgument(string $argumentName, $value)
    {
        if ($argumentName === '') {
            throw new InvalidArgumentNameException('Invalid argument name.', 1300893885);
        }
        $this->arguments[$argumentName] = $value;
    }
1097127
public function fn($id, $callable = null, $needsContainer = false)
    {
        if ($callable === null) {
            $callable = $id;
        }
        if (!is_callable($callable)) {
            throw new \InvalidArgumentException("Not callable");
        }
        $this->set($id, array($callable, $needsContainer));
    }
788396
protected function checkValueStructure(BaseValue $value): void
    {
        if (!is_int($value->destinationContentId) && !is_string($value->destinationContentId)) {
            throw new InvalidArgumentType(
                '$value->destinationContentId',
                'string|int',
                $value->destinationContentId
            );
        }

        if ($value->alternativeText !== null && !is_string($value->alternativeText)) {
            throw new InvalidArgumentType(
                '$value->alternativeText',
                'string|null',
                $value->alternativeText
            );
        }
    }