ScaffoldFilePath
class ScaffoldFilePath (View source)
| internal |
Manage the path to a file to scaffold.
Both the relative and full path to the file is maintained so that the shorter name may be used in progress and error messages, as needed. The name of the package that provided the file path is also recorded for the same reason.
ScaffoldFilePaths may be used to represent destination scaffold files, or the source files used to create them. Static factory methods named destinationPath and sourcePath, respectively, are provided to create ScaffoldFilePath objects.
Properties
| protected string | $type | The type of scaffold file this is, 'src' or 'dest'. |
|
| protected string | $packageName | The name of the package containing the file. |
|
| protected string | $relativePath | The relative path to the file. |
|
| protected string | $fullPath | The full path to the file. |
Methods
ScaffoldFilePath constructor.
Gets the name of the package this source file was pulled from.
Gets the relative path to the source file (best to use in messages).
Gets the full path to the source file.
Converts the relative source path into an absolute path.
Converts the relative destination path into an absolute path.
Adds data about the relative and full path to the provided interpolator.
Interpolate a string using the data from this scaffold file info.
Details
__construct(string $path_type, string $package_name, string $rel_path, string $full_path)
ScaffoldFilePath constructor.
string
packageName()
Gets the name of the package this source file was pulled from.
string
relativePath()
Gets the relative path to the source file (best to use in messages).
string
fullPath()
Gets the full path to the source file.
static ScaffoldFilePath
sourcePath(string $package_name, string $package_path, string $destination, string $source)
Converts the relative source path into an absolute path.
The path returned will be relative to the package installation location.
static ScaffoldFilePath
destinationPath(string $package_name, string $destination, Interpolator $location_replacements)
Converts the relative destination path into an absolute path.
Any placeholders in the destination path, e.g. '[web-root]', will be replaced using the provided location replacements interpolator.
addInterpolationData(Interpolator $interpolator, string $name_prefix = '')
Adds data about the relative and full path to the provided interpolator.
Interpolator
getInterpolator(string $name_prefix = '')
Interpolate a string using the data from this scaffold file info.