protected function copyConfigFile(string $configFileName)
    {
        $this->displayMsgInCli(' >> Copy '.$configFileName.' ... ');

        //Define paths to the config file
        $sourceFile = realpath($this->sourceConfigPath.'/'.$configFileName);
        $targetFile = realpath($this->targetConfigPath).'/'.$configFileName;

        //Check if config file already exist
        if (file_exists($targetFile)) {
            $this->displayMsgNLInCli('Already exist', 'yellow', 'bold');
            return;
        }

        //If source file not exist
        if (!file_exists($sourceFile)) {
            $this->displayMsgNLInCli(
                'Config file not exist in module source.',
                'red',
                'bold'
            );
            
            throw new Exception(
                'Source file not exist',
                $this::ERR_COPY_CONFIG_SRC_FILE_NOT_EXIST
            );
        }

        //Alors on copie le fichier vers le dossier /configs/[monModule]/
        if (!copy($sourceFile, $targetFile)) {
            $this->displayMsgNLInCli('Fail', 'red', 'bold');
            throw new Exception(
                'Copy fail',
                $this::ERR_COPY_CONFIG_FAIL
            );
        }

        $this->displayMsgNLInCli('Done', 'green', 'bold');
    }
protected function copyConfigFile(string $configFileName)
    {
        $this->displayMsgInCli(' >> Copy '.$configFileName.' ... ');

        //Define paths to the config file
        $sourceFile = realpath($this->sourceConfigPath.'/'.$configFileName);
        $targetFile = realpath($this->targetConfigPath).'/'.$configFileName;

        //Check if config file already exist
        if (file_exists($targetFile)) {
            $this->displayMsgNLInCli('Already exist', 'yellow', 'bold');
            return;
        }

        //If source file not exist
        if (!file_exists($sourceFile)) {
            $this->displayMsgNLInCli(
                'Config file not exist in module source.',
                'red',
                'bold'
            );
            
            throw new Exception(
                'Source file not exist',
                $this::ERR_COPY_CONFIG_SRC_FILE_NOT_EXIST
            );
        }

        //Alors on copie le fichier vers le dossier /configs/[monModule]/
        if (!copy($sourceFile, $targetFile)) {
            $this->displayMsgNLInCli('Fail', 'red', 'bold');
            throw new Exception(
                'Copy fail',
                $this::ERR_COPY_CONFIG_FAIL
            );
        }

        $this->displayMsgNLInCli('Done', 'green', 'bold');
    }
protected function copyConfigFile ( string $ configFileName ) { $ this -> displayMsgInCli ( ' >> Copy ' . $ configFileName . ' ... ' ) ; //Define paths to the config file $ sourceFile = realpath ( $ this -> sourceConfigPath . '/' . $ configFileName ) ; $ targetFile = realpath ( $ this -> targetConfigPath ) . '/' . $ configFileName ; //Check if config file already exist if ( file_exists ( $ targetFile ) ) { $ this -> displayMsgNLInCli ( 'Already exist' , 'yellow' , 'bold' ) ; return ; } //If source file not exist if ( ! file_exists ( $ sourceFile ) ) { $ this -> displayMsgNLInCli ( 'Config file not exist in module source.' , 'red' , 'bold' ) ; throw new Exception ( 'Source file not exist' , $ this :: ERR_COPY_CONFIG_SRC_FILE_NOT_EXIST ) ; } //Alors on copie le fichier vers le dossier /configs/[monModule]/ if ( ! copy ( $ sourceFile , $ targetFile ) ) { $ this -> displayMsgNLInCli ( 'Fail' , 'red' , 'bold' ) ; throw new Exception ( 'Copy fail' , $ this :: ERR_COPY_CONFIG_FAIL ) ; } $ this -> displayMsgNLInCli ( 'Done' , 'green' , 'bold' ) ; }
Copy a config file into config directory for the module

@param string $configFileName : The config filename

@return void

@throws \Exception If copy fail or if the source file not exist
Copy a config file into config directory for the module