/** * use visitor to inspect a content structure * * If the given content is null it will fall back to use the current root * directory of the stream wrapper. * * Returns given visitor for method chaining comfort. * * @param vfsStreamVisitor $visitor the visitor who inspects * @param vfsStreamContent $content directory structure to inspect * @return vfsStreamVisitor * @throws \InvalidArgumentException * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/10 */ public static function inspect(vfsStreamVisitor $visitor, vfsStreamContent $content = null) { if (null !== $content) { return $visitor->visit($content); } $root = vfsStreamWrapper::getRoot(); if (null === $root) { throw new \InvalidArgumentException('No content given and no root directory set.'); } return $visitor->visitDirectory($root); }