You are here

abstract class vfsStreamAbstractVisitor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php \org\bovigo\vfs\visitor\vfsStreamAbstractVisitor

Abstract base class providing an implementation for the visit() method.

@since 0.10.0

Hierarchy

Expanded class hierarchy of vfsStreamAbstractVisitor

See also

https://github.com/mikey179/vfsStream/issues/10

File

vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php, line 20

Namespace

org\bovigo\vfs\visitor
View source
abstract class vfsStreamAbstractVisitor implements vfsStreamVisitor {

  /**
   * visit a content and process it
   *
   * @param   vfsStreamContent  $content
   * @return  vfsStreamVisitor
   * @throws  \InvalidArgumentException
   */
  public function visit(vfsStreamContent $content) {
    switch ($content
      ->getType()) {
      case vfsStreamContent::TYPE_BLOCK:
        $this
          ->visitBlockDevice($content);
        break;
      case vfsStreamContent::TYPE_FILE:
        $this
          ->visitFile($content);
        break;
      case vfsStreamContent::TYPE_DIR:
        if (!$content
          ->isDot()) {
          $this
            ->visitDirectory($content);
        }
        break;
      default:
        throw new \InvalidArgumentException('Unknown content type ' . $content
          ->getType() . ' for ' . $content
          ->getName());
    }
    return $this;
  }

  /**
   * visit a block device and process it
   *
   * @param   vfsStreamBlock $block
   * @return  vfsStreamVisitor
   */
  public function visitBlockDevice(vfsStreamBlock $block) {
    return $this
      ->visitFile($block);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
vfsStreamAbstractVisitor::visit public function visit a content and process it Overrides vfsStreamVisitor::visit
vfsStreamAbstractVisitor::visitBlockDevice public function visit a block device and process it Overrides vfsStreamVisitor::visitBlockDevice 2
vfsStreamVisitor::visitDirectory public function visit a directory and process it 2
vfsStreamVisitor::visitFile public function visit a file and process it 2