Hoa central
Public Member Functions | Static Protected Attributes | List of all members
Hoa\Xyl\Interpreter\Common\Translate Class Reference
Inheritance diagram for Hoa\Xyl\Interpreter\Common\Translate:

Public Member Functions

static paint (Stream\IStream\Out $out)
 
- Public Member Functions inherited from Hoa\Xyl\Element\Concrete
 computeDataBinding (Array &$data, Array &$parent=null)
 
 render (Stream\IStream\Out $out)
 
 computeValue (Stream\IStream\Out $out=null)
 
 computeTransientValue (Stream\IStream\Out $out=null)
 
 computeAttributeValue ($value, $type=self::ATTRIBUTE_TYPE_UNKNOWN, $name=null)
 
 isLastIteration ()
 
 setVisibility ($visibility)
 
 getVisibility ()
 
- Public Member Functions inherited from Hoa\Xml\Element\Concrete
 __construct (Element $abstract, Element $superRoot, Array $rank=[], $namespace=null)
 
 construct ()
 
 getAbstractElement ()
 
 getAbstractElementSuperRoot ()
 
 getName ()
 
 count ()
 
 getIterator ()
 
 __set ($name, Concrete $value)
 
 __get ($name)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $element)
 
 offsetUnset ($offset)
 
 __call ($name, Array $arguments=[])
 

Static Protected Attributes

static $_attributes
 
- Static Protected Attributes inherited from Hoa\Xyl\Element\Concrete
static $_attributes
 
- Static Protected Attributes inherited from Hoa\Xml\Element\Concrete
static $_store = []
 
static $_superRoots = []
 
static $_multiton = []
 

Additional Inherited Members

- Static Public Member Functions inherited from Hoa\Xml\Element\Concrete
static getAbstractElementId (Element $element)
 
static getConcreteElement (Element $element)
 
static getAbstractElementSuperRootOf (Element $element)
 
- Public Attributes inherited from Hoa\Xyl\Element\Concrete
const ATTRIBUTE_TYPE_UNKNOWN = 0
 
const ATTRIBUTE_TYPE_NORMAL = 1
 
const ATTRIBUTE_TYPE_ID = 2
 
const ATTRIBUTE_TYPE_CUSTOM = 4
 
const ATTRIBUTE_TYPE_LIST = 8
 
const ATTRIBUTE_TYPE_LINK = 16
 
- Protected Member Functions inherited from Hoa\Xyl\Element\Concrete
 selectData ($expression, Array &$bucket)
 
 getCurrentData ()
 
 paint (Stream\IStream\Out $out)
 
 cleanTransientValue ()
 
 formatValue ($value, $name=null)
 
 _formatValue ($value)
 
 computeFromString ($xyl)
 
 getDeclaredAttributes ()
 
- Static Protected Member Functions inherited from Hoa\Xyl\Element\Concrete
static _getDeclaredAttributes ()
 
- Protected Attributes inherited from Hoa\Xyl\Element\Concrete
 $_visibility = true
 
 $_transientValue = null
 
 $_lastIteration = false
 
- Protected Attributes inherited from Hoa\Xml\Element\Concrete
 $_name = null
 
 $_children = []
 
 $_iterator = []
 
 $abstract = null
 
 $_superRoot = null
 

Detailed Description

Class .

The <_> component.

Definition at line 50 of file Translate.php.

Member Function Documentation

static Hoa\Xyl\Interpreter\Common\Translate::paint ( Stream\IStream\Out  $out)

Paint the element.

Parameters
\Hoa\Stream\IStream\Out$outOut stream.
Returns
void

Definition at line 70 of file Translate.php.

71  {
72  $root = $this->getAbstractElementSuperRoot();
73  $value = $this->computeValue();
74  $with = '__main__';
75 
76  if (true === $this->abstract->attributeExists('with')) {
77  $with = $this->abstract->readAttribute('with');
78  }
79 
80 
81  $translation = $root->getTranslation($with);
82 
83  if (null === $translation) {
84  $out->writeAll($value);
85 
86  return;
87  }
88 
89  $callable = null;
90  $arguments = [$value];
91 
92  if (true === $this->abstract->attributeExists('n')) {
93  $callable = xcallable($translation, '_n');
94  $arguments[] = $this->abstract->readAttribute('n');
95  } else {
96  $callable = xcallable($translation, '_');
97  }
98 
99  $with = $this->abstract->readCustomAttributes('with');
100 
101  if (!empty($with)) {
102  foreach ($with as $w) {
103  $arguments[] = $this->computeAttributeValue($w);
104  }
105  }
106 
107  $result = $callable->distributeArguments($arguments);
108 
109  if (false !== strpos($result, '<')) {
110  $this->computeFromString($result);
111  } else {
112  $out->writeAll($result);
113  }
114 
115  return;
116  }
computeValue(Stream\IStream\Out $out=null)
Definition: Concrete.php:410
computeAttributeValue($value, $type=self::ATTRIBUTE_TYPE_UNKNOWN, $name=null)
Definition: Concrete.php:488

Here is the call graph for this function:

Member Data Documentation

Hoa\Xyl\Interpreter\Common\Translate::$_attributes
staticprotected
Initial value:
= [
'n' => self::ATTRIBUTE_TYPE_NORMAL

Definition at line 57 of file Translate.php.


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