original_string: public function clear($check)
      {
          if (!$this->_init) {
              return false;
          }
          $this->_File = null;
  
          $threshold = $now = false;
          if ($check) {
              $now = time();
              $threshold = $now - $this->_config['duration'];
          }
  
          $this->_clearDirectory($this->_config['path'], $now, $threshold);
  
          $directory = new RecursiveDirectoryIterator(
              $this->_config['path'],
              \FilesystemIterator::SKIP_DOTS
          );
          $contents = new RecursiveIteratorIterator(
              $directory,
              RecursiveIteratorIterator::SELF_FIRST
          );
          $cleared = [];
          foreach ($contents as $path) {
              if ($path->isFile()) {
                  continue;
              }
  
              $path = $path->getRealPath() . DIRECTORY_SEPARATOR;
              if (!in_array($path, $cleared)) {
                  $this->_clearDirectory($path, $now, $threshold);
                  $cleared[] = $path;
              }
          }
  
          return true;
      }
code: public function clear($check)
      {
          if (!$this->_init) {
              return false;
          }
          $this->_File = null;
  
          $threshold = $now = false;
          if ($check) {
              $now = time();
              $threshold = $now - $this->_config['duration'];
          }
  
          $this->_clearDirectory($this->_config['path'], $now, $threshold);
  
          $directory = new RecursiveDirectoryIterator(
              $this->_config['path'],
              \FilesystemIterator::SKIP_DOTS
          );
          $contents = new RecursiveIteratorIterator(
              $directory,
              RecursiveIteratorIterator::SELF_FIRST
          );
          $cleared = [];
          foreach ($contents as $path) {
              if ($path->isFile()) {
                  continue;
              }
  
              $path = $path->getRealPath() . DIRECTORY_SEPARATOR;
              if (!in_array($path, $cleared)) {
                  $this->_clearDirectory($path, $now, $threshold);
                  $cleared[] = $path;
              }
          }
  
          return true;
      }
code_tokens: public function clear ( $ check ) { if ( ! $ this -> _init ) { return false ; } $ this -> _File = null ; $ threshold = $ now = false ; if ( $ check ) { $ now = time ( ) ; $ threshold = $ now - $ this -> _config [ 'duration' ] ; } $ this -> _clearDirectory ( $ this -> _config [ 'path' ] , $ now , $ threshold ) ; $ directory = new RecursiveDirectoryIterator ( $ this -> _config [ 'path' ] , \ FilesystemIterator :: SKIP_DOTS ) ; $ contents = new RecursiveIteratorIterator ( $ directory , RecursiveIteratorIterator :: SELF_FIRST ) ; $ cleared = [ ] ; foreach ( $ contents as $ path ) { if ( $ path -> isFile ( ) ) { continue ; } $ path = $ path -> getRealPath ( ) . DIRECTORY_SEPARATOR ; if ( ! in_array ( $ path , $ cleared ) ) { $ this -> _clearDirectory ( $ path , $ now , $ threshold ) ; $ cleared [ ] = $ path ; } } return true ; }
docstring: Delete all values from the cache
  
  @param bool $check Optional - only delete expired cache items
  @return bool True if the cache was successfully cleared, false otherwise
docstring_tokens: Delete all values from the cache