AddLinesConfigurator
extends AbstractConfigurator
in package
Tags
Table of Contents
- POSITION_AFTER_TARGET = 'after_target'
- POSITION_BOTTOM = 'bottom'
- POSITION_TOP = 'top'
- VALID_POSITIONS = [self::POSITION_TOP, self::POSITION_BOTTOM, self::POSITION_AFTER_TARGET]
- $composer : mixed
- $io : mixed
- $options : mixed
- $path : mixed
- $fileContents : array<string|int, string>
- Holds file contents for files that have been loaded.
- __construct() : mixed
- configure() : void
- executeConfigure() : void
- executeUnconfigure() : void
- unconfigure() : void
- update() : void
- extractSection() : string|null
- isFileMarked() : bool
- isFileXmlMarked() : bool
- markData() : string
- markXmlData() : string
- updateData() : bool
- updateDataString() : string|null
- write() : mixed
- getPatchedContents() : string
- getUnPatchedContents() : string
- isPackageInstalled() : bool
- readFile() : string
- relativize() : string
Constants
POSITION_AFTER_TARGET
private
mixed
POSITION_AFTER_TARGET
= 'after_target'
POSITION_BOTTOM
private
mixed
POSITION_BOTTOM
= 'bottom'
POSITION_TOP
private
mixed
POSITION_TOP
= 'top'
VALID_POSITIONS
private
mixed
VALID_POSITIONS
= [self::POSITION_TOP, self::POSITION_BOTTOM, self::POSITION_AFTER_TARGET]
Properties
$composer
protected
mixed
$composer
$io
protected
mixed
$io
$options
protected
mixed
$options
$path
protected
mixed
$path
$fileContents
Holds file contents for files that have been loaded.
private
array<string|int, string>
$fileContents
= []
This allows us to "change" the contents of a file multiple times before we actually write it out.
Methods
__construct()
public
__construct(Composer $composer, IOInterface $io, Options $options) : mixed
Parameters
- $composer : Composer
- $io : IOInterface
- $options : Options
Return values
mixed —configure()
public
configure(Recipe $recipe, mixed $config, Lock $lock[, array<string|int, mixed> $options = [] ]) : void
Parameters
Return values
void —executeConfigure()
public
executeConfigure(Recipe $recipe, mixed $config) : void
Parameters
- $recipe : Recipe
- $config : mixed
Return values
void —executeUnconfigure()
public
executeUnconfigure(Recipe $recipe, mixed $config) : void
Parameters
- $recipe : Recipe
- $config : mixed
Return values
void —unconfigure()
public
unconfigure(Recipe $recipe, mixed $config, Lock $lock) : void
Parameters
Return values
void —update()
public
update(RecipeUpdate $recipeUpdate, array<string|int, mixed> $originalConfig, array<string|int, mixed> $newConfig) : void
Parameters
- $recipeUpdate : RecipeUpdate
- $originalConfig : array<string|int, mixed>
- $newConfig : array<string|int, mixed>
Return values
void —extractSection()
protected
extractSection(Recipe $recipe, string $contents) : string|null
Parameters
- $recipe : Recipe
- $contents : string
Return values
string|null —isFileMarked()
protected
isFileMarked(Recipe $recipe, string $file) : bool
Parameters
- $recipe : Recipe
- $file : string
Return values
bool —isFileXmlMarked()
protected
isFileXmlMarked(Recipe $recipe, string $file) : bool
Parameters
- $recipe : Recipe
- $file : string
Return values
bool —markData()
protected
markData(Recipe $recipe, string $data) : string
Parameters
- $recipe : Recipe
- $data : string
Return values
string —markXmlData()
protected
markXmlData(Recipe $recipe, string $data) : string
Parameters
- $recipe : Recipe
- $data : string
Return values
string —updateData()
protected
updateData(string $file, string $data) : bool
Parameters
- $file : string
- $data : string
Return values
bool —True if section was found and replaced
updateDataString()
protected
updateDataString(string $contents, string $data) : string|null
Parameters
- $contents : string
- $data : string
Return values
string|null —returns the updated content if the section was found, null if not found
write()
protected
write(mixed $messages[, mixed $verbosity = IOInterface::VERBOSE ]) : mixed
Parameters
- $messages : mixed
- $verbosity : mixed = IOInterface::VERBOSE
Return values
mixed —getPatchedContents()
private
getPatchedContents(string $file, string $value, string $position, string|null $target, bool $warnIfMissing) : string
Parameters
- $file : string
- $value : string
- $position : string
- $target : string|null
- $warnIfMissing : bool
Return values
string —getUnPatchedContents()
private
getUnPatchedContents(string $file, mixed $value) : string
Parameters
- $file : string
- $value : mixed
Return values
string —isPackageInstalled()
private
isPackageInstalled(mixed $packages) : bool
Parameters
- $packages : mixed
Return values
bool —readFile()
private
readFile(string $file) : string
Parameters
- $file : string
Return values
string —relativize()
private
relativize(string $path) : string
Parameters
- $path : string