protected function fakeStat($dir = FALSE) {

    $request_time = time();

    // Set inode type to directory or file.
    $type = $dir ? 040000 : 0100000;
    // Fake world-readible
    $mode = $type + $this->cxt('swiftfs_fake_stat_mode', 0777);

    $values = array(
      'dev' => 0,
      'ino' => 0,
      'mode' => $mode,
      'nlink' => 0,
      'uid' => 0,
      'gid' => 0,
      'rdev' => 0,
      'size' => 0,
      'atime' => $request_time,
      'mtime' => $request_time,
      'ctime' => $request_time,
      'blksize' => -1,
      'blocks' => -1,
    );

    // We have to fake the UID value in order for is_readible()/is_writable()
    // to work. Note that on Windows systems, stat does not look for a UID.
    if (function_exists('posix_geteuid')) {
      $values['uid'] = posix_geteuid();
      $values['gid'] = posix_getegid();
    }

    $final = array_values($values) + $values;

    return $final;
  }