Code Duplication    Length = 11-15 lines in 2 locations

src/Psr7/Uri.php 2 locations

@@ 220-234 (lines=15) @@
217
    /**
218
     * {@inheritdoc}
219
     */
220
    public function withPath(string $path) : UriInterface
221
    {
222
        if (strpos($path, '?') !== false) {
223
            throw new \InvalidArgumentException(__CLASS__.': Invalid path provided; must not contain a query string');
224
        }
225
        
226
        if (strpos($path, '#') !== false) {
227
            throw new \InvalidArgumentException(__CLASS__.': Invalid path provided; must not contain a URI fragment');
228
        }
229
        
230
        $new = clone $this;
231
        $new->url['path'] = $path;
232
        
233
        return $new;
234
    }
235
236
    /**
237
     * {@inheritdoc}
@@ 239-249 (lines=11) @@
236
    /**
237
     * {@inheritdoc}
238
     */
239
    public function withQuery(string $query) : UriInterface
240
    {
241
        if (strpos($query, '#') !== false) {
242
            throw new \InvalidArgumentException(__CLASS__.': Query string must not include a URI fragment');
243
        }
244
        
245
        $new = clone $this;
246
        $new->url['query'] = (strpos($query, '?') !== false) ? substr($query, 1) : $query;
247
        
248
        return $new;
249
    }
250
251
    /**
252
     * {@inheritdoc}