public function withHostPrefix(string $prefix, array $replacePrefixes = []): self
    {
        $newConstraints = $this->constraints;
        $newConstraints[self::CONSTRAINT_HOST_PREFIX] = [
            'prefix' => $prefix,
            'replacePrefixes' => $replacePrefixes,
        ];
        return new static($newConstraints);
    }
public function withHostPrefix(string $prefix, array $replacePrefixes = []): self
    {
        $newConstraints = $this->constraints;
        $newConstraints[self::CONSTRAINT_HOST_PREFIX] = [
            'prefix' => $prefix,
            'replacePrefixes' => $replacePrefixes,
        ];
        return new static($newConstraints);
    }
public function withHostPrefix ( string $ prefix , array $ replacePrefixes = [ ] ) : self { $ newConstraints = $ this -> constraints ; $ newConstraints [ self :: CONSTRAINT_HOST_PREFIX ] = [ 'prefix' => $ prefix , 'replacePrefixes' => $ replacePrefixes , ] ; return new static ( $ newConstraints ) ; }
Create a new instance with the host prefix constraint added

@param string $prefix The URI host prefix to force, for example "en."
@param string[] $replacePrefixes a list of prefixes that should be replaced with the given prefix. if the list is empty or does not match the current host $prefix will be prepended as is
@return UriConstraints
Create a new instance with the host prefix constraint added