opens a directory

@param   string  $path
@param   int     $options
@return  bool
188752
public function dir_opendir(string $path, int $options): bool
    {
        $path      = $this->resolvePath(vfsStream::path($path));
        $this->dir = null;

        /** @var vfsStreamDirectory|null $dir */
        $dir = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR);
        if (null === $dir) {
            return false;
        }

        $this->dir = $dir;
        if (!$this->dir->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup())) {
            return false;
        }

        $this->dirIterator = $this->dir->getIterator();
        return true;
    }
1229378
public static function add($menu, $path, $options = [])
    {
        // Juggle argument for backward compatibility
        if (is_array($path)) {
            $options = $path;
            $path    = $menu;
            $menu    = self::activeMenu();
        } else {
            self::activeMenu($menu);
        }

        $pathE  = explode('.', $path);
        $pathE  = array_splice($pathE, 0, count($pathE) - 2);
        $parent = join('.', $pathE);

        if (!empty($parent) && !Hash::check(self::$_items[$menu], $parent)) {
            $title = Inflector::humanize(end($pathE));
            $opt = ['title' => $title];
            self::_setupOptions($opt);
            self::add($parent, $opt);
        }

        self::_setupOptions($options);
        $current = Hash::extract(self::$_items[$menu], $path);

        if (!empty($current)) {
            self::_replace(self::$_items[$menu], $path, $options);
        } else {
            self::$_items[$menu] = Hash::insert(self::$_items[$menu], $path, $options);
        }
    }
94610
private function createUrl($path, $options = [])
    {
        if (!is_string($path)) {
            $url = implode('/', array_map(function ($a) {
                return urlencode(is_array($a) ? implode(',', $a) : $a);
            }, $path));
            if (!empty($options)) {
                $url .= '?' . http_build_query($options);
            }
        } else {
            $url = $path;
            if (!empty($options)) {
                $url .= (strpos($url, '?') === false ? '?' : '&') . http_build_query($options);
            }
        }

        return $url;
    }
288456
public function dir_opendir($path, $options)
    {
        $dirName = $this->_getNamePart($path).'/';
        if (preg_match('@^([a-z0-9+.]|-)+://$@', $path) || $dirName == '/') {
            $list = $this->_getOssClient($path)->listObjects(AliyunOSS::getBucket());
        } else {
            $list = $this
                ->_getOssClient($path)
                ->listObjects(AliyunOSS::getBucket(), [
                    OssClient::OSS_PREFIX => $dirName,
                ]);
        }

        foreach ((array) $list->getPrefixList() as $l) {
            array_push($this->_bucketList, basename($l->getPrefix()));
        }

        foreach ((array) $list->getObjectList() as $l) {
            if ($l->getKey() == $dirName) {
                continue;
            }

            array_push($this->_bucketList, basename($l->getKey()));
        }

        return $this->_bucketList !== false;
    }
299701
public static function add($path, $options) {
		if (Reveal::is('Sapi.cli')) {
			return;
		}

		if (!empty($options['access'])) {
			foreach ((array) $options['access'] as $rule) {
				$check = strpos($rule, '!') === 0;
				if ($check) {
					$rule = substr($rule, 1);
				}
				if (Reveal::is($rule) == $check) {
					return;
				}
			}
			unset($options['access']);
		}

		$pathE = explode('.', $path);
		$pathE = array_splice($pathE, 0, count($pathE) - 2);
		$parent = join('.', $pathE);
		if (!empty($parent) && !Hash::check(self::$_items, $parent)) {
			$title = Inflector::humanize(end($pathE));
			$o = array('title' => $title);
			self::_setupOptions($o);
			self::add($parent, $o);
		}
		self::_setupOptions($options);
		$current = Hash::extract(self::$_items, $path);
		if (!empty($current)) {
			self::_replace(self::$_items, $path, $options);
		} else {
			self::$_items = Hash::insert(self::$_items, $path, $options);
		}
	}
414060
public function parse(string $path, array $options = []): \stdClass
    {
        $data = $this->getEmptyResult();

        if (!empty($options)) {
            $this->setConfig($options);
        }

        try {
            $result = $this->getDataFromPath($path);
            $data = Convert::dataToJson($result, $this->getConfig('lint'));
            if ($this->getConfig('validate') === true) {
                $this->validate($data);
            }
        } catch (ParsingException $e) {
            $message = sprintf("File: %s\n%s", $path, $e->getMessage());
            $this->errors[] = $message;

            throw new InvalidArgumentException($message, 0, $e);
        } catch (InvalidArgumentException $e) {
            $this->errors[] = $e->getMessage();

            throw $e;
        } catch (JsonValidationException $e) {
            $schemaFile = explode(DIRECTORY_SEPARATOR, $path);

            throw new InvalidArgumentException(sprintf('[%s] : %s', end($schemaFile), $e->getMessage()), 0, $e);
        }

        return $data;
    }
663470
public function stream_open($path, $mode, $options, &$opened_path)
    {
        $stream = $this->optsData()->getStream();
        if (!$stream || !$stream instanceof StreamInterface)
            return false;

        $this->_w__mode   = $mode;
        $this->_w__stream = $stream;

        return true;
    }
1169786
public function removeDirectory($path, $options)
  {
    $list = $this->getList($path);
    if (is_null($list)) {
      $result = null;
    } elseif (sizeof($list)) {
      $result = null;
    } else {
      $entity = $this->getEntity($path);

      $result = Entity_Deleted::newInstance($entity);

      $changes = $this->getChanges();
      $changes->add($path, $result);
    }

    if (is_null($result) && ($options & STREAM_REPORT_ERRORS)) {
      trigger_error(
        "Could not remove directory '$path'", E_USER_WARNING
      );
    }

    return $result;
  }
1274893
protected function _path($options) {
		if (empty($options['method'])) {
			$options['method'] = 'path';
		}

		$options['entity'] = $this;
		$event = $this->dispatchEvent('FileStorage.path', $options);

		return $event->getResult();
	}
1294342
public function to(string $path, array $options = []): string
    {
        if ($this->urlGenerator->isValidUrl($path)) {
            return $path;
        }

        list($package, $route) = $this->locate($path, $options);

        // Get the path from route configuration, and append route.
        $locate = $this->route($package)->to($route);

        empty($locate) && $locate = '/';

        return $this->urlGenerator->to($locate);
    }
158619
public function stream_open($path, $mode, $options, &$opened_path)
    {
        if ($this->fileHandle !== null) {
            return false;
        }
        self::restore();
        $path = self::overlayPath($path);
        $this->fileHandle = fopen($path, $mode, (bool)($options & STREAM_USE_PATH));
        self::register();
        return $this->fileHandle !== false;
    }
841516
public function handles_acl($path, array $options = [])
    {
        $url = $this->app->make('url');
        if ($url->isValidUrl($path)) {
            return $path;
        }
        @list($component, $action) = explode('/', $path);
        if (is_null($component) or is_null($action)) {
            return $this->handles($path, $options);
        }
//        $resourceMap = app('antares.resource.repository')->findOneByAttributes(['component' => $component, 'action' => $action]);
//        if (is_null($resourceMap)) {
//            return $this->handles($path, $options);
//        }
//        $resource  = $resourceMap->resource;
//        $component = str_replace('::', '/', $component);
//        if (!app('antares.acl')->make($component)->can($resource)) {
//            return '';
//        }

        return $this->handles($path, $options);
    }
728961
public function dir_opendir($uri, $options)
    {
        $parts = Uri::parse($uri);

        // Provoke ResourceNotFoundException if not found
        $resource = $this->getRepository($parts['scheme'])->get($parts['path']);

        $this->childIterator = new ResourceCollectionIterator(
            $resource->listChildren(),
            ResourceCollectionIterator::CURRENT_AS_NAME
        );

        return true;
    }
627959
public static function get($path, $options = array()) {
    $requestOptions = array(
      "path" => $path,
      "method" => "GET"
    );

    if (!empty($options["sign"])) {
      $requestOptions["sign"] = $options["sign"];
    }

    return self::request($requestOptions);
  }
793308
public function dir_opendir($path)
    {
        $this->restore();
        if (isset($this->context)) {
            $this->resource = opendir($path, $this->context);
        } else {
            $this->resource = opendir($path);
        }
        $this->intercept();

        return $this->resource !== false;
    }
1073671
public function fileOpen($path, $mode, $options, &$entity)
  {
    $entity = $this->getEntity($path);

    $filePointer = null;
    if (!is_null($entity)) {
      $exists = $entity->file_exists();

      if ($exists && !$entity->is_file()) {
        $filePointer = null;
      } else {
        $fopenWillFail = false;
        $mode = strtolower($mode);
        if ($mode != "r") {
          $isVirtual = ($entity instanceof Entity_Virtual_Interface);
          if (!$exists || !$isVirtual) {
            /* @var $entity Entity */
            $tmpPath = $this->_files->tempnam();
            $basename = basename($path);

            if ($exists) {
              if ($mode == "x" || $mode == "x+") {
                $fopenWillFail = true;
              } else {
                copy($entity->path(), $tmpPath);
              }
            }
            if (!$fopenWillFail) {
              $entity = Entity_Virtual::newInstance(
                $entity, $tmpPath, $basename
              );

              $changes = $this->getChanges();
              $changes->add($path, $entity);
            }
          }
        }

        if ($fopenWillFail) {
          $entity = null;
        } else {
          if ($options & STREAM_REPORT_ERRORS) {
            $filePointer = fopen($entity->path(), $mode);
          } else {
            $filePointer = @fopen($entity->path(), $mode);
          }
        }
      }
    }

    return $filePointer;
  }
220715
public function mkdir($path, $mode, $options = 0)
    {
        self::restore();
        $path = self::overlayPath($path);
        $success = mkdir($path, $mode, (bool)($options & STREAM_MKDIR_RECURSIVE));
        self::register();
        return $success;
    }