ComposerJson
extends ArrayObject
in package
implements
Wrapper, Stringable
Uses
WrapperTrait
Wrapper for the composer.json file.
Tags
Interfaces, Classes, Traits and Enums
- Wrapper
- Interface for the component file wrappers.
- Stringable
Table of Contents
- $_file : string
- Full path to the file.
- __construct() : mixed
- Constructor.
- __toString() : string
- Returns the file contents.
- diff() : string
- Returns a diff between the saved and the current version of the file.
- exists() : bool
- Returns whether the file exists.
- getFileName() : string
- Returns the file name.
- getFullPath() : string
- Returns the full path to the file.
- getLocalPath() : string
- Returns the local path to the file inside the package.
- save() : mixed
- Saves this object to the file.
Properties
$_file
Full path to the file.
protected
string
$_file
Methods
__construct()
Constructor.
public
__construct(string $baseDir) : mixed
Parameters
- $baseDir : string
-
Directory with composer.json.
Return values
mixed —__toString()
Returns the file contents.
public
__toString() : string
Return values
string —diff()
Returns a diff between the saved and the current version of the file.
public
diff([Wrapper $wrapper = null ]) : string
Parameters
- $wrapper : Wrapper = null
Return values
string —File diff.
exists()
Returns whether the file exists.
public
exists() : bool
Return values
bool —True if the file exists.
getFileName()
Returns the file name.
public
getFileName() : string
Return values
string —The file name.
getFullPath()
Returns the full path to the file.
public
getFullPath() : string
Return values
string —Path to the file.
getLocalPath()
Returns the local path to the file inside the package.
public
getLocalPath(string $dir) : string
Parameters
- $dir : string
-
The package directory.
Return values
string —Path to the file.
save()
Saves this object to the file.
public
save() : mixed