Evercode1\ViewMaker\RemovesFiles::extractMethodsFromFiles PHP Method

extractMethodsFromFiles() private method

    private function extractMethodsFromFiles()
    {
        foreach ($this->extractFromFiles as $type => $file) {
            $start = '// Begin ' . $this->modelName . ' ' . $type;
            $end = '// End ' . $this->modelName . ' ' . $type;
            $replaceWith = "";
            //read the entire string from file
            $content = file_get_contents($file);
            // define pattern
            $stringToDelete = $this->patternMatch($start, $end, $content);
            //replace the file string
            $updatedContent = str_replace("{$stringToDelete}", "{$replaceWith}", $content);
            //writes the entire file with updated content
            file_put_contents($file, $updatedContent);
        }
        $this->removeApiControllerIfEmpty();
    }