/**
  * Print information about the visited node.
  *
  * @param ItemInterface $item the node to visit
  */
 public function visit(ItemInterface $item)
 {
     if (!$item instanceof NodeInterface) {
         throw new \Exception("Internal error: did not expect to visit a non-node object: {$item}");
     }
     if ($item->getDepth() == 0) {
         $name = 'ROOT';
     } elseif ($this->showFullPath) {
         $name = $item->getPath();
     } else {
         $name = $item->getName();
     }
     $out = str_repeat('  ', $this->level) . '<comment>' . $name . '</comment>';
     if ($this->identifiers) {
         $identifier = $item->getIdentifier();
         if ($identifier) {
             $out .= "({$identifier})";
         }
     }
     $out .= ':';
     $this->output->writeln($out);
 }
Beispiel #2
0
 /**
  * Determine whether this item is to be considered a system item that you
  * usually want to hide and that should not be removed when purging the
  * repository.
  *
  * @param ItemInterface $item
  *
  * @return boolean true if $item is a system item, false otherwise
  */
 public static function isSystemItem(ItemInterface $item)
 {
     if ($item->getDepth() > 1) {
         return false;
     }
     $name = $item->getName();
     return strpos($name, 'jcr:') === 0 || strpos($name, 'rep:') === 0;
 }