{@inheritDoc}

@codeCoverageIgnore
324930
public function request($url, $requestData) {
        if(!class_exists('GuzzleHttp\Client')) {
            throw new RuntimeException('The guzzle client is not installed. Please install guzzlehttp/guzzle');
        }

        $client = new Client();

        //We do not care exceptions, this will handled by the user
        $response = $client->request('POST', $url, ['form_params' => $requestData]);

        return $response->getBody()->getContents();
    }
737435
public function writeValueToMappingResult($value, MappingResult $mappingResult, N2nContext $n2nContext) {
		$mapValue = null;
		if ($value === null) {
			$mapValue = $this->createEmptyValue();
		} else if ($value instanceof \ArrayObject) {
			$mapValue = new \ArrayObject($value->getArrayCopy());
		} else {
			$mapValue = $value;
		}
		$mappingResult->__set($this->getName(), $mapValue);
	}
145628
public static function create($code, $message, RequestInterface $request, ResponseInterface $response)
    {
        switch ($code) {
            case Error::AUTH_CONFIRM_IS_NOT_ALLOWED:
                return new AuthConfirmIsNotAllowedException(
                    $message, $request, $response
                );
            case Error::AUTHENTICATION:
                return new AuthenticationException(
                    $message, $request, $response
                );
            case Error::BAD_FIELD_FORMAT:
                return new BadFieldFormatException(
                    $message, $request, $response
                );
            case Error::MANDATORY_PARAMETER:
                return new MandatoryParameterException(
                    $message, $request, $response
                );
            case Error::NOT_SUPPORTED_SFIELD:
                return new NotSupportedSFieldException(
                    $message, $request, $response
                );
            case Error::OPERATION_FAILED:
                return new OperationFailedException(
                    $message, $request, $response
                );
        }

        return new ErrorException($message, $request, $response);
    }
187154
public function assertResponseCodeIs($code) {
        $this->requireResponse();

        try {
            Assertion::same(
                $actual = $this->response->getStatusCode(),
                $expected = $this->validateResponseCode($code),
                sprintf('Expected response code %d, got %d.', $expected, $actual)
            );
        } catch (AssertionFailure $e) {
            throw new AssertionFailedException($e->getMessage());
        }
    }
891022
public function getConfigurationEntityFromCode($code)
    {
        $dbConfiguration = IndexEngineIndexQuery::create()->findOneByCode($code);

        if (null === $dbConfiguration) {
            throw new InvalidArgumentException(sprintf("The index configuration code '%s' doesn't exist", $code));
        }

        return $this->getConfigurationEntityFromPropelEntity($dbConfiguration);
    }
476609
public static function create(int $code = 500, array $context = [], Throwable $previous = null): self
    {
        if (!isset(self::$phrases[$code])) {
            throw new RuntimeException("Http error not valid ({$code})");
        }

        $exception = new static(self::$phrases[$code], $code, $previous);
        $exception->setContext($context);

        return $exception;
    }
56639
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();

		// Idea by @enumag
		// https://github.com/Arachne/EventManager/blob/master/src/DI/EventManagerExtension.php

		$eventManager = $builder->getDefinition($this->prefix('eventManager'));
		foreach ($builder->findByTag(self::TAG_NETTRINE_SUBSCRIBER) as $serviceName => $tag) {
			$serviceName = (string) $serviceName; // nette/di 2.4 allows numeric names, which are converted to integers
			$class = $builder->getDefinition($serviceName)->getType();

			if ($class === null || !is_subclass_of($class, EventSubscriber::class)) {
				throw new AssertionException(
					sprintf(
						'Subscriber "%s" doesn\'t implement "%s".',
						$serviceName,
						EventSubscriber::class
					)
				);
			}
			$eventManager->addSetup(
				'?->addEventListener(?, ?)',
				[
					'@self',
					call_user_func([(new ReflectionClass($class))->newInstanceWithoutConstructor(), 'getSubscribedEvents']),
					$serviceName, // Intentionally without @ for laziness.
				]
			);
		}
	}
1136063
protected function throwException($code, $msg)
    {
        $args = func_get_args();

        $code = array_shift($args);

        throw new \RuntimeException(call_user_func_array('sprintf', $args), $code);
    }
1169240
public function send()
    {
        if (headers_sent($file, $line)) {
            throw new RuntimeException("Headers already sent in {$file} on line {$line}."); // @codeCoverageIgnore
        }

        foreach ($this->headers() as $key => $value) {
            header("{$key}: {$value}", true);
        }
    }
1141681
public function when(/* see docblock */)
    {
        $arguments = func_get_args();
        if ($arguments[0] instanceof Antecedent) {
            $antecedent = $arguments[0];
        } elseif ($arguments[0] instanceof PHPUnit_Framework_Constraint) {
            $antecedent = Antecedent\IndependentConstraintsAntecedent::fromAll($arguments);
        } elseif ($arguments[0] instanceof Constraint) {
            $antecedent = Antecedent\IndependentConstraintsAntecedent::fromAll($arguments);
        } elseif ($arguments && count($arguments) == 1) {
            $antecedent = Antecedent\SingleCallbackAntecedent::from($arguments[0]);
        } else {
            throw new \InvalidArgumentException("Invalid call to when(): " . var_export($arguments, true));
        }
        $this->antecedents[] = $antecedent;
        return $this;
    }
906583
public function withCode(string $code): ViewSource
    {
        $context = clone $this;
        $context->code = $code;

        return $context;
    }
1316187
public function getException($code)
    {
        if (!isset($this->exceptions[$code])) {
            throw new Exceptions\ExceptionNotDefinedException($this, $code);
        }

        return $this->exceptions[$code];
    }
1161447
public static function configure(IOInterface $io, PhpUnitStrictCoverage $strictCoverage)
    {
        if (true === $strictCoverage->isUndefined()) {
            $strictCoverageAnswer = $io->ask(
                HookQuestions::PHPUNIT_STRICT_COVERAGE,
                HookQuestions::DEFAULT_TOOL_ANSWER
            );

            $strictCoverage = $strictCoverage->setEnabled(
                new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($strictCoverageAnswer))
            );

            /** @var PhpUnitStrictCoverage $strictCoverage */
            if (true === $strictCoverage->isEnabled()) {
                $minimum = $io->ask(HookQuestions::PHPUNIT_STRICT_COVERAGE_MINIMUM, 0.00);
                $strictCoverage = $strictCoverage->setStrictCoverage(new MinimumStrictCoverage((float) $minimum));
            }
        }

        return $strictCoverage;
    }
814833
public function createCode(TokenInterface $code): TokenInterface
    {
        try {
            $now    = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $schema = $this->getDatabaseSchema();
            $values = [
                $schema->getTokensClientIdentityColumn() => $code->getClientIdentifier(),
                $schema->getTokensUserIdentityColumn()   => $code->getUserIdentifier(),
                $schema->getTokensCodeColumn()           => $code->getCode(),
                $schema->getTokensIsScopeModified()      => $code->isScopeModified(),
                $schema->getTokensCodeCreatedAtColumn()  => $now,
            ];

            $tokenIdentifier = null;
            if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) {
                $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
                    $this->createResource($values);
                    $tokenIdentifier = $this->getLastInsertId();
                    $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
                });
            } else {
                $this->createResource($values);
                $tokenIdentifier = $this->getLastInsertId();
            }

            $code->setIdentifier($tokenIdentifier)->setCodeCreatedAt($now);

            return $code;
        } catch (RepositoryException $exception) {
            $message = 'Token code creation failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
894785
public function getTemplate($code)
    {
        if (!isset($this->templates[$code])) {
            throw new \RuntimeException(sprintf('No template references with the code : %s', $code));
        }

        return $this->templates[$code];
    }
672149
public function fail($data = null, $code = 200) {
		$this->_status = static::STATUS_FAIL;
		$this->_code = $code;
		$this->_data = !$data && $data !== false ? null : $data;
	}
603553
public static function validate($c)
    {
        if ($c && (is_array($c) || $c instanceof Traversable)) {
            foreach ($c as $o) {
                if ($o instanceof ValidateDescriptorInterface || (is_object($o) && method_exists($o, 'validate'))) {
                    $o->validate();
                }
            }
        }
    }