Overview

Packages

  • PHP
  • vsword
    • node
    • parser
      • addesed
    • structure
      • style

Classes

  • AlignNode
  • ArbitraryCompositeNode
  • ArbitraryNode
  • BodyCompositeNode
  • BoldStyleNode
  • BrNode
  • CompositeNode
  • DocumentCompositeNode
  • DrawingNode
  • EmptyCompositeNode
  • FontSizeStyleNode
  • HyperlinkCompositeNode
  • ItalicStyleNode
  • ListCompositeNode
  • ListItemCompositeNode
  • Node
  • PageBreakNode
  • PCompositeNode
  • PPrCompositeNode
  • RCompositeNode
  • RPrCompositeNode
  • StringNode
  • TableColCompositeNode
  • TableCompositeNode
  • TableRowCompositeNode
  • TextNode
  • UnderlineStyleNode
  • Overview
  • Package
  • Class
  • Tree
  1: <?php 
  2: 
  3: /**
  4: *  Class Node base node class.
  5: * 
  6: *  @version 1.0.1
  7: *  @author v.raskin
  8:  * @package vsword.node
  9: */
 10: abstract class Node implements INode {
 11:     
 12:     /**
 13:      *
 14:      * @var array 
 15:      */
 16:     protected $attributes = array();
 17:     
 18:     /**
 19:     * @var Node
 20:     */
 21:     protected $parent;
 22:     
 23:     /**
 24:     * Id style
 25:     * @var string
 26:     */
 27:     protected $styleId;
 28:     
 29:     /**
 30:      * 
 31:      * @return CompositeNode
 32:      */
 33:     public function getParent() {
 34:         return $this->parent;
 35:     }
 36:     
 37:     /**
 38:      * 
 39:      * @return string
 40:      */
 41:     public function getName() {
 42:         return get_class($this);
 43:     }
 44:     
 45:     /**
 46:      * 
 47:      * @param string $styleId
 48:      */
 49:     public function setStyleID($styleId) {
 50:         $this->styleId = $styleId;
 51:     }
 52:     
 53:     /**
 54:      * 
 55:      * @param Style $style
 56:      */
 57:     public function setStyle(Style $style) {
 58:         $this->setStyleID($style->getStyleId());
 59:     }
 60:     
 61:     /**
 62:      * 
 63:      * @param CompositeNode $parent
 64:      */
 65:     public function setParent( $parent) {
 66:         $this->parent = $parent;
 67:     }
 68:     
 69:     /**
 70:      * 
 71:      * @param string $key
 72:      * @param string $value
 73:      */
 74:     public function addAttribute($key, $value) {
 75:         $this->attributes[$key] = $value; 
 76:     }
 77:     
 78:     /**
 79:      * 
 80:      * @param array $attributes
 81:      */
 82:     public function addAttributes($attributes) {
 83:         foreach($attributes as $key=>$value) {
 84:             $this->addAttribute($key, $value);
 85:         }
 86:     }
 87:     
 88:     /**
 89:      * 
 90:      * @return array list attributes node
 91:      */
 92:     public function getAttributes() {
 93:         return $this->attributes;
 94:     }
 95:     
 96:     /**
 97:      * 
 98:      * @param string $key
 99:      * @return string
100:      */
101:     public function getAttribute($key) {
102:         return isset($this->attributes[$key]) ? $this->attributes[$key] : NULL; 
103:     }
104:     
105:     /**
106:      * 
107:      * @return string
108:      */
109:     public function attributeToString() {
110:         $attr = array();
111:         foreach($this->attributes as $key=>$value){
112:             $attr[] = $key.'="'.$value.'"'; 
113:         }
114:         return ' '.join(' ', $attr);
115:     }
116:     
117:     /**
118:      * 
119:      * @throws Exception
120:      */
121:     public function getWord() {
122:         throw new Exception('No implementation');
123:     }
124:     
125:     /**
126:      * 
127:      * @throws Exception
128:      */
129:     public function getHtml() {
130:         throw new Exception('No implementation');
131:     }
132:     
133:     /**
134:     * This method view tree nodes
135:     * @return string
136:     */
137:     public function look($tab = '') {
138:         return $tab.($this)."\n";
139:     }
140:     
141:     /**
142:      * 
143:      * @return string
144:      */
145:     public function __toString() {
146:         return get_class($this);
147:     }
148: }
149: 
150: 
wordx API documentation generated by ApiGen 2.8.0