Skip to content

Commit

Permalink
Readme: updated (formatting)
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Mar 23, 2014
1 parent 6d17a20 commit 02f26af
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
Cz\Paths-helper
===============
# Cz\Paths-helper

Helper class for generating relative paths, absolutizing paths, ...

Usage
-----
## Usage


``` php
<?php
$helper = new Cz\PathsHelper;
```

### Absolutize paths

``` php
$helper->absolutizePath('path/to/my/../text/./file.txt');
// Prints: 'path/to/text/file.txt'
```

Returns ```path/to/text/file.txt```


### Generating relative paths

``` php
$source = 'root/dir/docs/1.0/index.html';
$dest = 'root/dir/imgs/image.jpg';
$helper->makeRelativePath($source, $dest);
// Prints: '../../imgs/image.jpg'
```

Returns ```../../imgs/image.jpg```

$helper->isPathCurrent('dir/file.txt', 'dir/file-2.txt'); // return FALSE
$helper->isPathCurrent('dir/file.txt', 'dir/*'); // return TRUE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/*'); // return FALSE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/*/*'); // return TRUE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/**'); // return TRUE

### Is given paths current?

``` php
$helper->isPathCurrent('dir/file.txt', 'dir/file-2.txt'); // returns FALSE
$helper->isPathCurrent('dir/file.txt', 'dir/*'); // returns TRUE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/*'); // returns FALSE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/*/*'); // returns TRUE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/**'); // returns TRUE
```

**Mask:** ```**``` means *everything*, ```*``` means *everything <b>except</b> ```/```*.


Installation
------------
## Installation

[Download a latest package](https://github.com/nette/tester/releases) or use [Composer](http://getcomposer.org/):

Expand Down

0 comments on commit 02f26af

Please sign in to comment.