Potsky\LaravelLocalizationHelpers\Factory\Localization::getBackupPath PHP 메소드

getBackupPath() 공개 메소드

Get the backup file path according to the current file path
public getBackupPath ( string $file_lang_path, string $date, string $ext = 'php' ) : mixed
$file_lang_path string
$date string
$ext string
리턴 mixed
    public function getBackupPath($file_lang_path, $date, $ext = 'php')
    {
        return preg_replace('/\\.' . $ext . '$/', '.' . $date . '.' . $ext, $file_lang_path);
    }

Usage Example

 /**
  * https://github.com/potsky/laravel-localization-helpers/issues/20
  */
 public function testDotInPath()
 {
     $messageBag = new MessageBag();
     $manager = new Localization($messageBag);
     $now = '20160129_202938';
     $this->assertSame('/nia/nio/message.' . $now . '.php', $manager->getBackupPath('/nia/nio/message.php', $now));
     $this->assertSame('/var/www/kd/domain.com/message.' . $now . '.php', $manager->getBackupPath('/var/www/kd/domain.com/message.php', $now));
     $this->assertSame('/var/www/kd/domain.com/message.' . $now . '.txt', $manager->getBackupPath('/var/www/kd/domain.com/message.txt', $now, 'txt'));
 }