src/Autoload/Finder.php
public function find($basePath)
    {
        if (is_file($basePath)) {
            $basePath = dirname($basePath);
        } elseif (!is_dir($basePath)) {
            throw new \InvalidArgumentException('Base path must be either a file path or directory');
        }

        $basePath = realpath($basePath) ?: $basePath;

        do {
            $autoloaderPath = $this->containsKnownAutoloader($basePath);
            if ($autoloaderPath !== '') {
                return $autoloaderPath;
            }
            $basePath = dirname($basePath);
        } while ($basePath && $basePath !== '/');

        return '';
    }
public function find($basePath)
    {
        if (is_file($basePath)) {
            $basePath = dirname($basePath);
        } elseif (!is_dir($basePath)) {
            throw new \InvalidArgumentException('Base path must be either a file path or directory');
        }

        $basePath = realpath($basePath) ?: $basePath;

        do {
            $autoloaderPath = $this->containsKnownAutoloader($basePath);
            if ($autoloaderPath !== '') {
                return $autoloaderPath;
            }
            $basePath = dirname($basePath);
        } while ($basePath && $basePath !== '/');

        return '';
    }
public function find ( $ basePath ) { if ( is_file ( $ basePath ) ) { $ basePath = dirname ( $ basePath ) ; } elseif ( ! is_dir ( $ basePath ) ) { throw new \ InvalidArgumentException ( 'Base path must be either a file path or directory' ) ; } $ basePath = realpath ( $ basePath ) ? : $ basePath ; do { $ autoloaderPath = $ this -> containsKnownAutoloader ( $ basePath ) ; if ( $ autoloaderPath !== '' ) { return $ autoloaderPath ; } $ basePath = dirname ( $ basePath ) ; } while ( $ basePath && $ basePath !== '/' ) ; return '' ; }
Find the best autoloader for the current project

@example
$finder = new \Cundd\TestFlight\Autoload\Finder();
$foundAutoloaderPath = $finder->find(__DIR__);
assert(substr($foundAutoloaderPath, -19) === 'vendor/autoload.php');
@param string $basePath
@return string
Find the best autoloader for the current project