Extends
lithium\console\Command
Helper method for `console\command\Library::extract()` to gather
replacements to perform on the newly extracted files
It looks for a json file specified by `$this->replacementsFile`
which defaults to _replacements.json.
Running eval on a php file to get the `$replacements`
would be more flexible than using json, but definitely much more of a
security hole if the library is not trusted.
Parameters
- string $base File path to the extracted library
Returns
array A multi-dimensional array. Keys on the top level are filenames or glob-style paths. Those hold an array with keys being the search param and values being the replacement valuesSource
protected function _findReplacements($base = null) {
$replacements = null;
if (file_exists($base . '/' . $this->replacementsFile)) {
$replacementsFilename = $base . '/' . $this->replacementsFile;
$replacements = json_decode(file_get_contents($replacementsFilename), true);
if ($replacements !== false) {
unlink($base . '/' . $this->replacementsFile);
}
}
return $replacements;
}