You are here

protected function TranslatorCacheTest::deleteTmpDir in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Tests/TranslatorCacheTest.php \Symfony\Component\Translation\Tests\TranslatorCacheTest::deleteTmpDir()
2 calls to TranslatorCacheTest::deleteTmpDir()
TranslatorCacheTest::setUp in vendor/symfony/translation/Tests/TranslatorCacheTest.php
TranslatorCacheTest::tearDown in vendor/symfony/translation/Tests/TranslatorCacheTest.php

File

vendor/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);
}