From 02f26af14d1a781ab6950053327d8af00d0bf2ff Mon Sep 17 00:00:00 2001 From: Jan Pecha Date: Sun, 23 Mar 2014 15:26:57 +0100 Subject: [PATCH] Readme: updated (formatting) --- readme.md | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/readme.md b/readme.md index 5feeb4a..fb65774 100644 --- a/readme.md +++ b/readme.md @@ -1,34 +1,48 @@ -Cz\Paths-helper -=============== +# Cz\Paths-helper Helper class for generating relative paths, absolutizing paths, ... -Usage ------ +## Usage + ``` php -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 except ```/```*. -Installation ------------- +## Installation [Download a latest package](https://github.com/nette/tester/releases) or use [Composer](http://getcomposer.org/):