updated example

This commit is contained in:
R. Eric Wheeler 2017-02-02 18:35:22 -08:00
parent d13c79f00f
commit ee3df78313
2 changed files with 7 additions and 2 deletions

View File

@ -21,13 +21,13 @@ define('BASE_DIR', dirname((string)$finder));
or or
```php ```php
define('BASE_DIR', dirname((string)(new Finder('composer.json')))); define('BASE_DIR', dirname((string)(new Finder('autoload.php'))));
``` ```
Although this could set BASE_DIR as an empty string if it found nothing. Although this could set BASE_DIR as an empty string if it found nothing.
```php ```php
$finder = new Finder('composer.json'); $finder = new Finder('autoload.php');
if(true === $finder->isFound()) if(true === $finder->isFound())
{ {
define('BASE_DIR', dirname($finder->getPath())); define('BASE_DIR', dirname($finder->getPath()));

View File

@ -22,6 +22,11 @@ namespace Sikofitt\Retrorsum;
/** /**
* Class Finder. * Class Finder.
* @Todo - Handle symlinks
* @Todo - Add ability to continue after finding, like
* PHP 7.0's extra parameter in dirname.
* Example new Finder($file, 2) would return the second
* instance of $file.
*/ */
class Finder class Finder
{ {