Sunnysideup\UpgradeToSilverstripe4\Api\SearchAndReplaceAPI
Synopsis
class SearchAndReplaceAPI
{
- // members
- private boolean $debug = false;
- private string $basePath = '';
- private boolean $isReplacingEnabled = false;
- private string $searchKey = '';
- private string $replacementKey = '';
- private string $comment = '';
- private string $startMarker = '### @@@@ START REPLACEMENT @@@@ ###';
- private string $endMarker = '### @@@@ STOP REPLACEMENT @@@@ ###';
- private string $replacementHeader = '';
- private string $replacementType = '';
- private boolean $caseSensitive = true;
- private array $ignoreFrom = ;
- private integer $fileReplacementMaxCount = 0;
- private array $ignoreUntil = ;
- private array $ignoreFileIfFound = ;
- private array $fileNameMustContain = ;
- private array $magicReplacers = ;
- private $fileFinder = NULL;
- private string $logString = '';
- private string $errorText = '';
- private integer $totalFound = 0;
- private string $output = '';
- private array $searchKeyTotals = ;
- private array $folderTotals = ;
- private integer $totalTotal = 0;
- private static array $class_name_cache = ;
- private static $finder = NULL;
- // methods
- public void __construct()
- public void setDebug()
- public void setIsReplacingEnabled()
- public void setIgnoreFolderArray()
- public void addToIgnoreFolderArray()
- public void resetIgnoreFolderArray()
- public void setBasePath()
- public void setSearchPath()
- public void setExtensions()
- public void setFindAllExts()
- public void setStartMarker()
- public void setEndMarker()
- public void setReplacementHeader()
- public void setIgnoreFileIfFound()
- public void setFileNameMustContain()
- public void setFileReplacementMaxCount()
- public void setSearchKey()
- public void setReplacementKey()
- public void setComment()
- public string getFullComment()
- public bool getDebug()
- public string getOutput()
- public string getLog()
- public void getTotalTotalSearches()
- public void showFormattedSearchTotals()
- public SearchAndReplaceAPI startSearchAndReplace()
- private void searchFileData()
- private void writeToFile()
- private void appendToLog()
- private string addToOutput()
- private void getClassNameOfFile()
- private void testMustContain()
- private void testFileNameRequirements()
- private void hasStringPresentInFile()
Members
private
- $basePath
- $caseSensitive
-
$class_name_cache
magic replacement functions - $comment
- $debug
- $endMarker
- $errorText
- $fileFinder
- $fileNameMustContain
- $fileReplacementMaxCount
- $finder
- $folderTotals
- $ignoreFileIfFound
- $ignoreFrom
- $ignoreUntil
- $isReplacingEnabled
- $logString
- $magicReplacers
- $output
- $replacementHeader
- $replacementKey
- $replacementType
- $searchKey
- $searchKeyTotals
- $startMarker
- $totalFound
- $totalTotal
Methods
private
- addToOutput() — returns full output and clears it.
- appendToLog() — Appends log data to previous log data
- getClassNameOfFile()
- hasStringPresentInFile()
- searchFileData() — THE KEY METHOD! Searches data, replaces (if enabled) with given key, prepares log
- testFileNameRequirements()
- testMustContain()
- writeToFile() — Writes new data (after the replacement) to file
public
- __construct()
- addToIgnoreFolderArray() — Sets folders to ignore @param array $ignoreFolderArray @return self
- getDebug()
- getFullComment() — makes a comment into a PHP proper comment (like this one)
- getLog() — returns full log and clears it.
- getOutput() — returns full output and clears it.
- getTotalTotalSearches() — returns the TOTAL TOTAL number of found replacements
- resetIgnoreFolderArray() — remove ignore folders
- setBasePath()
- setComment() — Sets a comment to go with the replacement.
- setDebug() — @return $this
- setEndMarker()
- setExtensions() — Sets extensions to look @param array $extensions
- setFileNameMustContain()
- setFileReplacementMaxCount()
- setFindAllExts() — Sets extensions to look @param bool $boolean
- setIgnoreFileIfFound()
- setIgnoreFolderArray() — Sets folders to ignore @param array $ignoreFolderArray @return self
- setIsReplacingEnabled() — @return $this
- setReplacementHeader()
- setReplacementKey() — Sets key to replace searchKey with @param string $replacementKey
- setSearchKey() — Sets search key and case sensitivity
- setSearchPath()
- setStartMarker()
- showFormattedSearchTotals() — should be run at the end of an extension.
- startSearchAndReplace() — Searches all the files and creates the logs