bin/dephpugger
#!/usr/bin/env php
<?php
function findInnerPart($search, $parts=[]) {
do {
$part = array_pop($parts);
} while(($part != $search) && (count($parts) > 1));
return implode(DIRECTORY_SEPARATOR, $parts);
}
function autoload_path($dir) {
$pathParts = explode(DIRECTORY_SEPARATOR, $dir);
if(in_array('vendor', $pathParts, true)) {
return findInnerPart('vendor', $pathParts);
} else if(in_array('bin', $pathParts, true)) {
return findInnerPart('bin', $pathParts);
}
throw new Exception("Can't find any base-paths. Please keep file within repository");
}
$basePath = autoload_path(__DIR__);
require_once implode(DIRECTORY_SEPARATOR, [$basePath, 'vendor', 'autoload.php']);
// Create application
$application = new Dephpug\Dephpugger();
$application->run();