{@inheritdoc}

@throws Exception\UnexpectedValueException
964185
public function match(ServerRequestInterface $request, $pathOffset)
    {
        $uri    = $request->getUri();
        $params = $this->defaults;

        // Verify scheme first, if set.
        if (true === $this->secure && 'https' !== $uri->getScheme()) {
            return MatchResult::fromSchemeFailure($uri->withScheme('https'));
        } elseif (false === $this->secure && 'http' !== $uri->getScheme()) {
            return MatchResult::fromSchemeFailure($uri->withScheme('http'));
        }

        // Then match hostname, if parser is set.
        if (null !== $this->hostnameParser) {
            $hostnameResult = $this->hostnameParser->parse($uri->getHost(), 0);

            if (null === $hostnameResult || strlen($uri->getHost()) !== $hostnameResult->getMatchLength()) {
                return null;
            }

            $params = $hostnameResult->getParams() + $params;
        }

        // Then match port, if set.
        if (null !== $this->port) {
            $port = $uri->getPort() ?: ('http' === $uri->getScheme() ? 80 : 443);

            if ($port !== $this->port) {
                return null;
            }
        }

        // Next match the path.
        $completePathMatched = false;

        if (null !== $this->pathParser) {
            if (null === ($pathResult = $this->pathParser->parse($uri->getPath(), $pathOffset))) {
                return null;
            }

            $pathOffset += $pathResult->getMatchLength();
            $completePathMatched = ($pathOffset === strlen($uri->getPath()));
            $params = $pathResult->getParams() + $params;
        }

        if ($completePathMatched) {
            if (null === $this->methods || in_array($request->getMethod(), $this->methods)) {
                return MatchResult::fromSuccess($params);
            }

            if (empty($this->methods)) {
                // Special case: when no methods are defined at all, this route may simply not terminate.
                return null;
            }

            return MatchResult::fromMethodFailure($this->methods);
        }

        // The path was not completely matched yet, so we check the children.
        if (null === $this->children) {
            return null;
        }

        return RouteCollectionMatcher::matchRouteCollection($this->children, $request, $pathOffset, $params);
    }
308676
public function setIntegerValue($integerValue)
    {
        if (\is_array($integerValue) || \is_object($integerValue)) {
            $m = "Invalid value type for attribute {$this->getFamilyCode()}.{$this->getAttributeCode()}, ";
            $m .= 'expecting integer, got '.gettype($integerValue);
            throw new \UnexpectedValueException($m);
        }
        $this->integerValue = null === $integerValue ? null : (int) $integerValue;

        return $this;
    }
1147326
public function setTextValue($textValue)
    {
        if (\is_array($textValue) || \is_object($textValue)) {
            $m = "Invalid value type for attribute {$this->getFamilyCode()}.{$this->getAttributeCode()}, ";
            $m .= 'expecting string, got '.gettype($textValue);
            throw new \UnexpectedValueException($m);
        }
        $this->textValue = null === $textValue ? null : (string) $textValue;

        return $this;
    }
1178399
public function saveAction()
	{
		$this->isPostRequest();

		$this->checkLock();

		$localization = $this->getPageLocalization();
		
		if (! $localization instanceof GroupLocalization) {
			throw new \UnexpectedValueException(sprintf(
					'Expecting instanceof GroupLocalization, [%s] received.',
					get_class($localization)
			));
		}

		$this->saveLocalizationCommonAction();

		$this->getEntityManager()
					->flush($localization->getMaster());

		return new SupraJsonResponse();
	}
43016
function export() {
		$export = array_merge($this->data, $this->cell);
		foreach ($export as &$val) {
			if ($val instanceof Cell) {
				if ($val->isExpr()) {
					throw new \UnexpectedValueException("Cannot export an SQL expression");
				}
				$val = $val->get();
			}
		}
		return $export;
	}
796706
public function parseReadData($data)
	{
		$results = array();

		foreach ($data as $row) {
			if (is_array($row)) {
				$key = $row[$this->keyColumn];
				$value = $row[$this->valueColumn];
			} elseif (is_object($row)) {
				$key = $row->{$this->keyColumn};
				$value = $row->{$this->valueColumn};
			} else {
				$msg = 'Expected array or object, got '.gettype($row);
				throw new \UnexpectedValueException($msg);
			}

			ArrayUtil::set($results, $key, $value);
		}

		return $results;
	}
1188084
protected function checkConfig(array $config)
    {
        if (!isset($config['dataSource']) || !is_array($config['dataSource'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about data source in metadata configuration should be an array or Traversable.'
            ));
        }
        if (!isset($config['types']) || !is_array($config['types'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about types in metadata configuration should be an array or Traversable.'
            ));
        }
        if (!isset($config['fields']) || !is_array($config['fields'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about fields in metadata configuration should be an array or Traversable.'
            ));
        }
    }
744840
public function exec()
    {
        $this->response = '';
        $errno = $errstr = null;

        if (isset($this->context)) {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->context);
        } else {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout);
        }

        if (!empty($errstr)) {
            throw new UnexpectedValueException($errstr);
        }

        fwrite($this->stream, $this->getRequestBody());

        while (!feof($this->stream)) {
            $this->response .= fgets($this->stream, 1024);
        }

        fclose($this->stream);
        $this->stream = null;

        return $this;
    }
613886
public function push($path, $value)
    {
        $node = $this->get($path);

        if (!$node) {
            $node = [];
        } elseif (\is_object($node)) {
            $node = get_object_vars($node);
        }

        if (!\is_array($node)) {
            throw new \UnexpectedValueException(
                sprintf(
                    'The value at path: %s should be object or array but is %s.',
                    $path,
                    \gettype($node)
                )
            );
        }

        $args = \func_get_args();

        if (count($args) <= 2) {
            $num = array_push($node, $value);
        } else {
            $args[0] = &$node;

            $num = call_user_func_array('array_push', $args);
        }

        $this->set($path, $node);

        return $num;
    }
529381
public function asNull(): Primitive\NullType
    {
        if (!$this->_element instanceof Primitive\NullType) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_NULL));
        }
        return $this->_element;
    }
2515
public function attach($object, $data = null)
    {
        if (!$this->isSupported($object)) {
            throw new UnexpectedValueException(
                sprintf(
                    'The object, %s, is not supported.',
                    get_class($object)
                )
            );
        }

        parent::attach($object, $data);
    }
506152
final public static function create($value)
    {
        $key = get_called_class() . $value;

        if (isset(self::$instances[$key])) {
            return self::$instances[$key];
        }

        $values = static::values();
        if (!in_array($value, $values)) {
            throw new \UnexpectedValueException("Value '$value' is not part of the enum " . get_called_class());
        }

        self::$instances[$key] = new static($value);
        return self::$instances[$key];
    }
697293
public function unserialize($serialized)
    {
        $data = unserialize($serialized);
        if (!is_array($data)) {
            throw new \UnexpectedValueException('Unserialized data is not an array');
        }

        // TODO: check existence
        $this->message      = CustomAmqpMessage::fromProperties($data['message']);
        $this->tag          = (string) $data['tag'];
        $this->exchange     = (string) $data['exchange'];
        $this->queue        = (string) $data['queue'];
        $this->routingKey   = (string) $data['routingKey'];
        $this->redelivered  = (bool) $data['routingKey'];
    }
693335
public function replace($oldValue, $newValue)
    {
        if (!is_string($oldValue)) {
            throw new UnexpectedTypeException($oldValue, 'string', 'oldValue');
        }
        if (empty($oldValue)) {
            return;
        }
        if (!is_string($newValue) && null !== $newValue) {
            throw new UnexpectedTypeException($newValue, 'string or null', 'newValue');
        }

        $key = array_search($oldValue, $this->values, true);
        if (false !== $key) {
            if (empty($newValue)) {
                unset($this->values[$key]);
            } else {
                $this->values[$key] = $newValue;
            }
        }
    }
1105006
private function initTypeExtensions(): void
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof ObjectTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, 'Fxp\Component\DefaultValue\ObjectTypeExtensionInterface');
            }

            $type = $extension->getExtendedType();

            $this->typeExtensions[$type][] = $extension;
        }
    }
14471
public function asUTF8String(): Primitive\UTF8String
    {
        if (!$this->_element instanceof Primitive\UTF8String) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_UTF8_STRING));
        }
        return $this->_element;
    }
1053065
public function execute()
    {
        if (!is_string($this->master_hostname)
            || empty($this->master_hostname)
        ) {
            throw new UnexpectedValueException(
                'Cannot execute CHANGE MASTER without a valid master hostname.'
            );
        }
        if (!is_string($this->replication_username)
            || empty($this->replication_username)
        ) {
            throw new UnexpectedValueException(
                'Cannot execute CHANGE MASTER without a valid replication username.'
            );
        }
        if (!is_string($this->replication_password)
            || empty($this->replication_password)
        ) {
            throw new UnexpectedValueException(
                'Cannot execute CHANGE MASTER without a valid replication password.'
            );
        }
        if (!is_string($this->recorded_log_file_name)) {
            throw new UnexpectedValueException(
                'Cannot execute CHANGE MASTER without a valid log file name (empty is acceptable).'
            );
        }
        if (!is_int($this->recorded_log_pos)) {
            throw new UnexpectedValueException(
                'Cannot execute CHANGE MASTER without a valid log file position.'
            );
        }
        if ($this->recorded_log_file_name == self::EMPTY_LOG_FILENAME
            && $this->recorded_log_pos != self::EMPTY_LOG_POSITION
        ) {
            throw new UnexpectedValueException(
                sprintf(
                    'The value of the log position must be equal to %d when the log file name is given as "%s".',
                    self::EMPTY_LOG_POSITION,
                    self::EMPTY_LOG_FILENAME
                )
            );
        }
        if ($this->recorded_log_file_name != self::EMPTY_LOG_FILENAME
            && $this->recorded_log_pos <= self::EMPTY_LOG_POSITION
        ) {
            throw new UnexpectedValueException(
                sprintf(
                    'The value of the log position must be greater than %d when the log file name is given something other than "%s".',
                    self::EMPTY_LOG_POSITION,
                    self::EMPTY_LOG_FILENAME
                )
            );
        }

        $statement = implode(
            ', ',
            array(
                'CHANGE MASTER TO MASTER_HOST=:master_hostname',
                'MASTER_USER=:replication_username',
                'MASTER_PASSWORD=:replication_password',
                'MASTER_LOG_FILE=:recorded_log_file_name',
                'MASTER_LOG_POS=:recorded_log_pos',
            )
        ) . ';';
        $params = array(
            ':master_hostname' => $this->master_hostname,
            ':replication_username' => $this->replication_username,
            ':replication_password' => $this->replication_password,
            ':recorded_log_file_name' => $this->recorded_log_file_name,
            ':recorded_log_pos' => array(
                $this->recorded_log_pos, $this->client->typeInt()
            ),
        );

        return $this->client->execute($statement, $params);
    }