PackerFile
class PackerFile (View source)
Constants
TYPE_OTHER |
File type: other. |
TYPE_TRANSLATIONS_POT |
File type: source .pot translation file. |
TYPE_TRANSLATIONS_PO |
File type: source .po translation file. |
TYPE_SVGICON_PACKAGE |
File type: package source .svg icon file. |
TYPE_SVGICON_BLOCKTYPE |
File type: block type source .svg icon file. |
TYPE_SVGICON_THEME |
File type: theme source .svg icon file. |
Properties
private string | $absolutePath | The absolute path to the actual file/directory (with directory separators normalized to '/', without trailing slashes). |
|
private string | $relativePath | The path to the file/directory relative to the package root directory (with directory separators normalized to '/', without trailing slashes). |
|
private bool | $isDirectory | Is this a directory? |
|
private bool | $isModified | Is this a file that has been modified? |
|
private string|null | $basename | The name of the file/directory, without the path. |
|
private string|null | $extension | The extension of the file, lower case without the leading dot. |
|
private int|null | $type | The type of the file (one of the TYPE_... constants). |
Methods
Initialize the instance.
Create a new instance of a file/directory as read from the source package directory (marking it as not changed).
Create a new instance of a file, representing a replacement for an existing original package file.
Create a new instance of a file, representing a new file added to the package directory.
Get the absolute path to the actual file/directory (with directory separators normalized to '/', without trailing slashes).
Generate a new absolute path, with a new file extension.
Get the path to the file/directory relative to the package root directory (with directory separators normalized to '/', without trailing slashes).
Generate a new relative path, with a new file extension.
Is this a directory?
Is this a file that has been modified?
The name of the file/directory, without the path.
Get the extension of the file, lower case without the leading dot.
Get the type of the file (one of the TYPE_... constants).
Change the extension of a path.
Details
protected
__construct(string $absolutePath, string $relativePath, bool $isDirectory, bool $isModified)
Initialize the instance.
static PackerFile
fromSourceFileInfo(string $basePath, SplFileInfo $fileInfo)
Create a new instance of a file/directory as read from the source package directory (marking it as not changed).
static PackerFile
newChangedFile(PackerFile $originalFile, string $actualSourcePath)
Create a new instance of a file, representing a replacement for an existing original package file.
static
newlyCreatedFile(string $absolutePath, string $relativePath)
Create a new instance of a file, representing a new file added to the package directory.
string
getAbsolutePath()
Get the absolute path to the actual file/directory (with directory separators normalized to '/', without trailing slashes).
string
getAbsolutePathWithExtension(string $newExtension)
Generate a new absolute path, with a new file extension.
string
getRelativePath()
Get the path to the file/directory relative to the package root directory (with directory separators normalized to '/', without trailing slashes).
string
getRelativePathWithExtension(string $newExtension)
Generate a new relative path, with a new file extension.
bool
isDirectory()
Is this a directory?
bool
isModified()
Is this a file that has been modified?
string
getBasename()
The name of the file/directory, without the path.
string
getExtension()
Get the extension of the file, lower case without the leading dot.
Lower case, wihout dot.
int
getType()
Get the type of the file (one of the TYPE_... constants).
protected string
getPathWithExtension(string $myPath, string $newExtension)
Change the extension of a path.