You are here

public static function HttpCacheTestCase::clearDirectory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php \Symfony\Component\HttpKernel\Tests\HttpCache\HttpCacheTestCase::clearDirectory()
4 calls to HttpCacheTestCase::clearDirectory()
HttpCacheTestCase::setUp in vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php
HttpCacheTestCase::tearDown in vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php
StoreTest::setUp in vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php
StoreTest::tearDown in vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php

File

vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php, line 154

Class

HttpCacheTestCase

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public static function clearDirectory($directory) {
  if (!is_dir($directory)) {
    return;
  }
  $fp = opendir($directory);
  while (false !== ($file = readdir($fp))) {
    if (!in_array($file, array(
      '.',
      '..',
    ))) {
      if (is_link($directory . '/' . $file)) {
        unlink($directory . '/' . $file);
      }
      elseif (is_dir($directory . '/' . $file)) {
        self::clearDirectory($directory . '/' . $file);
        rmdir($directory . '/' . $file);
      }
      else {
        unlink($directory . '/' . $file);
      }
    }
  }
  closedir($fp);
}