TeamSpeak 3 PHP Framework
Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
TeamSpeak3_Viewer_Text Class Reference

Renders nodes used in ASCII-based TeamSpeak 3 viewers. More...

+ Inheritance diagram for TeamSpeak3_Viewer_Text:

Public Member Functions

 fetchObject (TeamSpeak3_Node_Abstract $node, array $siblings=array())
 Returns the code needed to display a node in a TeamSpeak 3 viewer. More...
 
- Public Member Functions inherited from TeamSpeak3_Viewer_Interface
 fetchObject (TeamSpeak3_Node_Abstract $node, array $siblings=array())
 Returns the code needed to display a node in a TeamSpeak 3 viewer. More...
 

Protected Member Functions

 getCorpusIcon ()
 Returns an ASCII string which can be used to display the status icon for a TeamSpeak_Node_Abstract object. More...
 
 getCorpusName ()
 Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object. More...
 
 getPrefix ()
 Returns the ASCII string to display the prefix of the current node. More...
 

Detailed Description

Renders nodes used in ASCII-based TeamSpeak 3 viewers.

Member Function Documentation

◆ fetchObject()

fetchObject ( TeamSpeak3_Node_Abstract  $node,
array  $siblings = array() 
)

Returns the code needed to display a node in a TeamSpeak 3 viewer.

Parameters
TeamSpeak3_Node_Abstract$node
array$siblings
Returns
string
49  {
50  $this->currObj = $node;
51  $this->currSib = $siblings;
52 
53  $args = array(
54  $this->getPrefix(),
55  $this->getCorpusIcon(),
56  $this->getCorpusName(),
57  );
58 
59  return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
60  }
getPrefix()
Returns the ASCII string to display the prefix of the current node.
Definition: Text.php:67
getCorpusIcon()
Returns an ASCII string which can be used to display the status icon for a TeamSpeak_Node_Abstract ob...
Definition: Text.php:92
getCorpusName()
Returns a string for the current corpus element which contains the display name for the current TeamS...
Definition: Text.php:103
static factory($string)
Returns a TeamSpeak3_Helper_String object for thegiven string.
Definition: String.php:60

◆ getCorpusIcon()

getCorpusIcon ( )
protected

Returns an ASCII string which can be used to display the status icon for a TeamSpeak_Node_Abstract object.

Returns
string
93  {
94  return $this->currObj->getSymbol();
95  }

◆ getCorpusName()

getCorpusName ( )
protected

Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object.

Returns
string
104  {
105  return $this->currObj;
106  }

◆ getPrefix()

getPrefix ( )
protected

Returns the ASCII string to display the prefix of the current node.

Returns
string
68  {
69  $prefix = "";
70 
71  if(count($this->currSib))
72  {
73  $last = array_pop($this->currSib);
74 
75  foreach($this->currSib as $sibling)
76  {
77  $prefix .= ($sibling) ? "| " : " ";
78  }
79 
80  $prefix .= ($last) ? "\\-" : "|-";
81  }
82 
83  return $prefix;
84  }

The documentation for this class was generated from the following file: