private function replace()
    {
        $destination = Yii::getAlias($this->destination);
        $destinationModuleName = $this->getDestinationModuleName();
        foreach (FileHelper::findFiles($destination) as $path) {
            if (!$this->replace && in_array($path, $this->keepFiles)) {
                continue;
            }
            if (!preg_match('/^.*\.php$/', $path, $matches)) { // php file.
                continue;
            } else if (preg_match('/^.*\W([A-Z]\w+)\.php$/', $path, $matches)) { // Class file.
                file_put_contents($path, $this->createClassContent($matches[1], $path));
            } else if (self::isMigration($path)) { // Class file.
                file_put_contents($path, $this->updateFileContent($path));
                if ($destinationModuleName) {
                    $this->renameClassFile($path, function($className) use ($destinationModuleName){
                        return $className . '_' . $destinationModuleName;
                    });
                }
            } else if ($this->inheritContent) {
                file_put_contents($path, $this->createFileContent($path));
            } else {
                file_put_contents($path, $this->updateFileContent($path));
            }
        }
        return true;
    }
private function replace()
    {
        $destination = Yii::getAlias($this->destination);
        $destinationModuleName = $this->getDestinationModuleName();
        foreach (FileHelper::findFiles($destination) as $path) {
            if (!$this->replace && in_array($path, $this->keepFiles)) {
                continue;
            }
            if (!preg_match('/^.*\.php$/', $path, $matches)) { // php file.
                continue;
            } else if (preg_match('/^.*\W([A-Z]\w+)\.php$/', $path, $matches)) { // Class file.
                file_put_contents($path, $this->createClassContent($matches[1], $path));
            } else if (self::isMigration($path)) { // Class file.
                file_put_contents($path, $this->updateFileContent($path));
                if ($destinationModuleName) {
                    $this->renameClassFile($path, function($className) use ($destinationModuleName){
                        return $className . '_' . $destinationModuleName;
                    });
                }
            } else if ($this->inheritContent) {
                file_put_contents($path, $this->createFileContent($path));
            } else {
                file_put_contents($path, $this->updateFileContent($path));
            }
        }
        return true;
    }
private function replace ( ) { $ destination = Yii :: getAlias ( $ this -> destination ) ; $ destinationModuleName = $ this -> getDestinationModuleName ( ) ; foreach ( FileHelper :: findFiles ( $ destination ) as $ path ) { if ( ! $ this -> replace && in_array ( $ path , $ this -> keepFiles ) ) { continue ; } if ( ! preg_match ( '/^.*\.php$/' , $ path , $ matches ) ) { // php file. continue ; } else if ( preg_match ( '/^.*\W([A-Z]\w+)\.php$/' , $ path , $ matches ) ) { // Class file. file_put_contents ( $ path , $ this -> createClassContent ( $ matches [ 1 ] , $ path ) ) ; } else if ( self :: isMigration ( $ path ) ) { // Class file. file_put_contents ( $ path , $ this -> updateFileContent ( $ path ) ) ; if ( $ destinationModuleName ) { $ this -> renameClassFile ( $ path , function ( $ className ) use ( $ destinationModuleName ) { return $ className . '_' . $ destinationModuleName ; } ) ; } } else if ( $ this -> inheritContent ) { file_put_contents ( $ path , $ this -> createFileContent ( $ path ) ) ; } else { file_put_contents ( $ path , $ this -> updateFileContent ( $ path ) ) ; } } return true ; }
Replaces all new module classes content with empty template.
@return boolean
Replaces all new module classes content with empty template .