Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcTreeVisitorPlainText

Tree::ezcTreeVisitorPlainText

Class ezcTreeVisitorPlainText

An implementation of the ezcTreeVisitor interface that generates a plain text representation of a tree structure.

  1.  <?php
  2.      $visitor = new ezcTreeVisitorPlainText( ezcTreeVisitorPlainText::SYMBOL_UTF8 );
  3.      $tree->accept( $visitor );
  4.      echo (string) $visitor; // print the plot
  5.  ?>

Shows (something like):

  1.  Hylobatidae
  2.  ├─Hylobates
  3.  │ ├─Lar Gibbon
  4.  │ ├─Agile Gibbon
  5.  │ ├─Müller's Bornean Gibbon
  6.  │ ├─Silvery Gibbon
  7.  │ ├─Pileated Gibbon
  8.  │ └─Kloss's Gibbon
  9.  ├─Hoolock
  10.  │ ├─Western Hoolock Gibbon
  11.  │ └─Eastern Hoolock Gibbon
  12.  ├─Symphalangus
  13.  └─Nomascus
  14.    ├─Black Crested Gibbon
  15.    ├─Eastern Black Crested Gibbon
  16.    ├─White-cheecked Crested Gibbon
  17.    └─Yellow-cheecked Gibbon

Source for this file: /Tree/src/visitors/plain_text.php

Implements interfaces:

Version:   //autogentag//

Constants

SYMBOL_ASCII = 1 Represents the ASCII symbol set.
SYMBOL_UTF8 = 2 Represents the UTF-8 symbol set.

Member Variables

protected array(string=>array(string)) $edges = array()
Holds all the edges of the graph.
protected string $root = null
Holds the root ID

Method Summary

public ezcTreeVisitorPlainText __construct( [ $symbolCharset = self::SYMBOL_UTF8] )
Constructs a new ezcTreeVisitorPlainText visualizer using $symbolCharset as character set.
public bool visit( $visitable )
Visits the node and sets the the member variables according to the node type and contents.

Methods

__construct

ezcTreeVisitorPlainText __construct( [int $symbolCharset = self::SYMBOL_UTF8] )

Constructs a new ezcTreeVisitorPlainText visualizer using $symbolCharset as character set.

This class only supports 'ascii' and 'utf-8' as character sets. Default is 'utf-8'.

Parameters:
Name Type Description
$symbolCharset int

visit

bool visit( ezcTreeVisitable $visitable )

Visits the node and sets the the member variables according to the node type and contents.

Parameters:
Name Type Description
$visitable ezcTreeVisitable
Implementation of:
Method Description
ezcTreeVisitor::visit() Visit the $visitable.
Documentation generated by phpDocumentor 1.4.3