PHP Class Neos\Flow\Core\Migrations\Tools

Show file Open project: neos/flow-development-collection Class Usage Examples

Public Methods

Method Description
getPackagesData ( string $packagesPath ) : array Will return an array with all available packages.
readComposerManifest ( string $pathAndFileName ) : array Read the package manifest from the composer.json file at $pathAndFileName
searchAndReplace ( string $search, string | Closure $replace, string $pathAndFilename, boolean $regularExpression = false ) : boolean | null Does a search and replace operation on the given file.
writeComposerManifest ( array $manifest, string $pathAndFilename ) : void Write the manifest to the given file.

Protected Methods

Method Description
readPackageMetaData ( string $pathAndFileName ) : array | null Read the package metadata from the Package.xml file at $pathAndFileName

Method Details

getPackagesData() public static method

The data for each entry will be an array with the key, full path to the package (index 'path') and a category (the packages subfolder, index 'category'). The array is indexed by package key.
public static getPackagesData ( string $packagesPath ) : array
$packagesPath string
return array

readComposerManifest() public static method

Read the package manifest from the composer.json file at $pathAndFileName
public static readComposerManifest ( string $pathAndFileName ) : array
$pathAndFileName string
return array

readPackageMetaData() protected static method

Read the package metadata from the Package.xml file at $pathAndFileName
protected static readPackageMetaData ( string $pathAndFileName ) : array | null
$pathAndFileName string
return array | null

searchAndReplace() public static method

A simple str_replace is used, unless $regularExpression is set to TRUE. In that case preg_replace is used. The given patterns are used as given, no quoting is applied! In case $regularExpression is TRUE, a closure can be given for the $replace variable. It should return a string and is given an array of matches as parameter.
public static searchAndReplace ( string $search, string | Closure $replace, string $pathAndFilename, boolean $regularExpression = false ) : boolean | null
$search string
$replace string | Closure
$pathAndFilename string
$regularExpression boolean
return boolean | null FALSE on errors, NULL on skip, TRUE on success

writeComposerManifest() public static method

Write the manifest to the given file.
public static writeComposerManifest ( array $manifest, string $pathAndFilename ) : void
$manifest array
$pathAndFilename string
return void