Skip to content

Commit

Permalink
#152 Fix wrong documentation for wrong class
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jan 10, 2025
1 parent f0e42ea commit eeadce6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
16 changes: 16 additions & 0 deletions docs/components/7.0/hierarchical-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,19 @@ HierarchicalPath::fromAbsolute('path','to', 'the', 'sky')->withoutSegment(0, 1)-

<p class="message-info">Just like the <code>HierarchicalPath::get</code> this method supports negative offset.</p>
<p class="message-notice">if the specified offset does not exist, no modification is performed and the current object is returned.</p>

### Removing empty segments

Sometimes your path may contain multiple adjacent delimiters. Since removing them may result in a semantically different URI, this normalization can not be applied by default. To remove adjacent delimiters you can call the `Path::withoutEmptySegments` method which convert you path as described below:

~~~php
<?php

use League\Uri\Components\HierarchicalPath;

$path = HierarchicalPath::new("path////to/the/sky//");
$newPath = $path->withoutEmptySegments();
echo $path; //displays 'path////to/the/sky//'
echo $newPath; //displays 'path/to/the/sky/'
~~~

15 changes: 0 additions & 15 deletions docs/components/7.0/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ echo $path; //displays 'path/to/./the/../the/sky%7bfoo%7d'
echo $newPath; //displays 'path/to/the/sky%7Bfoo%7D'
~~~

### Removing empty segments

Sometimes your path may contain multiple adjacent delimiters. Since removing them may result in a semantically different URI, this normalization can not be applied by default. To remove adjacent delimiters you can call the `Path::withoutEmptySegments` method which convert you path as described below:

~~~php
<?php

use League\Uri\Components\Path;

$path = Path::new("path////to/the/sky//");
$newPath = $path->withoutEmptySegments();
echo $path; //displays 'path////to/the/sky//'
echo $newPath; //displays 'path/to/the/sky/'
~~~

## Specialized Path Object

What makes a URI specific apart from the scheme is how the path is parse and manipulated. This simple path class
Expand Down

0 comments on commit eeadce6

Please sign in to comment.