/** * visit a content and process it * * @param vfsStreamContent $content * @return vfsStreamVisitor * @throws \InvalidArgumentException */ public function visit(vfsStreamContent $content) { switch ($content->getType()) { case vfsStreamContent::TYPE_FILE: $this->visitFile($content); break; case vfsStreamContent::TYPE_DIR: $this->visitDirectory($content); break; default: throw new \InvalidArgumentException('Unknown content type ' . $content->getType() . ' for ' . $content->getName()); } return $this; }
/** * helper method to print the content * * @param vfsStreamContent $content */ protected function printContent(vfsStreamContent $content) { fwrite($this->out, str_repeat(' ', $this->depth) . '- ' . $content->getName() . "\n"); }