updated example
This commit is contained in:
parent
d13c79f00f
commit
ee3df78313
|
@ -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()));
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue