You are here

protected function TranslatorCacheTest::deleteTmpDir in Plug 7

2 calls to TranslatorCacheTest::deleteTmpDir()
TranslatorCacheTest::setUp in lib/Symfony/translation/Tests/TranslatorCacheTest.php
TranslatorCacheTest::tearDown in lib/Symfony/translation/Tests/TranslatorCacheTest.php

File

lib/Symfony/translation/Tests/TranslatorCacheTest.php, line 35

Class

TranslatorCacheTest

Namespace

Symfony\Component\Translation\Tests

Code

protected function deleteTmpDir() {
  if (!file_exists($dir = $this->tmpDir)) {
    return;
  }
  $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir), \RecursiveIteratorIterator::CHILD_FIRST);
  foreach ($iterator as $path) {
    if (preg_match('#[/\\\\]\\.\\.?$#', $path
      ->__toString())) {
      continue;
    }
    if ($path
      ->isDir()) {
      rmdir($path
        ->__toString());
    }
    else {
      unlink($path
        ->__toString());
    }
  }
  rmdir($this->tmpDir);
}