-
-
Notifications
You must be signed in to change notification settings - Fork 0
DevToolsPathResolver
Resolves canonical paths for the DevTools package itself.
- Full name:
\FastForward\DevTools\Path\DevToolsPathResolver - This class is marked as final and can't be subclassed
- This class is a Final class
| Constant | Visibility | Type | Value |
|---|---|---|---|
BINARY |
public | string | 'bin/dev-tools' |
RESOURCES |
public | string | 'resources' |
Returns the DevTools package directory or a path under it.
public static getPackagePath(string $path = ''): string- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the optional relative segment to append under the package directory |
Returns the packaged DevTools binary path.
public static getBinaryPath(): string- This method is static.
Returns the packaged DevTools binary command with a subcommand.
public static getBinaryCommand(string $command): string- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$command |
string | the DevTools subcommand to append |
Returns the packaged resources directory or a path under it.
public static getResourcesPath(string $path = ''): string- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the optional relative segment to append under resources |
Returns a packaged path rendered relative to the active project root when possible.
public static getPackagePathRelativeToProject(string $path, string $projectPath = '', string $packagePath = ''): stringWhen the project root and package root do not share a filesystem root, the packaged absolute path MUST be returned unchanged so globally installed DevTools can still point hooks at the packaged fallback file.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the relative path under the package root |
$projectPath |
string | an optional project root path; defaults to the working project root |
$packagePath |
string | an optional package root path; defaults to the current package root |
Returns the active Composer autoload file for the current DevTools installation mode.
public static getRuntimeAutoloadPath(string $packagePath = ''): stringWhen DevTools runs as a dependency, the runtime autoloader lives at the
Composer vendor root. Repository checkouts instead use the package-local
vendor/autoload.php.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$packagePath |
string | an optional package root path; defaults to the current package root |
Returns the active Composer runtime binary path for the current DevTools installation mode.
public static getRuntimeToolBinaryPath(string $binary, string $packagePath = ''): stringRepository checkouts use the package-local vendor/bin/<binary>, while
dependency installs resolve binaries from the active Composer vendor root.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$binary |
string | the binary name relative to vendor/bin
|
$packagePath |
string | an optional package root path; defaults to the current package root |
Returns the active Composer vendor path for the current DevTools installation mode.
public static getRuntimeVendorPath(string $path, string $packagePath = ''): stringRelative vendor paths MAY be passed either with or without a leading
vendor/ prefix.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the vendor-relative path to resolve |
$packagePath |
string | an optional package root path; defaults to the current package root |
Returns the preferred tooling binary path for the active project and DevTools runtime.
public static getPreferredToolBinaryPath(string $binary, string $projectPath = '', string $packagePath = ''): stringConsumer projects SHOULD take precedence when they provide a local
vendor/bin/<binary> entry. If the binary is absent locally, the method
MUST fall back to the active DevTools runtime binary path.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$binary |
string | the binary name relative to vendor/bin
|
$projectPath |
string | an optional project root path; defaults to the working project root |
$packagePath |
string | an optional package root path; defaults to the current package root |
Returns the preferred Composer vendor path for the active project and DevTools runtime.
public static getPreferredVendorPath(string $path, string $projectPath = '', string $packagePath = ''): stringConsumer projects SHOULD take precedence when they provide the requested vendor path locally. If the path is absent locally, the method MUST fall back to the active DevTools runtime vendor path.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the vendor-relative path to resolve |
$projectPath |
string | an optional project root path; defaults to the working project root |
$packagePath |
string | an optional package root path; defaults to the current package root |
Detects whether the provided path belongs to an installed vendor copy of DevTools.
public static isInstalledAsDependency(string $packagePath = ''): bool- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$packagePath |
string | an optional path within the package; defaults to the package root |
Detects whether the provided path belongs to the DevTools repository checkout itself.
public static isRepositoryCheckout(string $packagePath = ''): bool- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$packagePath |
string | an optional path within the package; defaults to the package root |