Public Member Functions | |
tokenize () | |
getString () | |
isNumeric () | |
isQuote () | |
getMethodArgs () | |
getNumber () |
Definition at line 35 of file Variable.php.
getMethodArgs | ( | ) |
Return array of arguments for method.
Definition at line 150 of file Variable.php.
00150 { 00151 $value = array(); 00152 $numberStr = ''; 00153 00154 while($this->next() && $this->char() != ')') { 00155 if($this->isWhiteSpace() || $this->char() == ',') { 00156 continue; 00157 } else if($this->isNumeric()) { 00158 $value[] = $this->getNumber(); 00159 } else { 00160 $value[] = $this->getString(); 00161 } 00162 } 00163 00164 return $value; 00165 }
getNumber | ( | ) |
Return number value for method args
Definition at line 172 of file Variable.php.
00172 { 00173 $value = $this->char(); 00174 while( ($this->isNumeric() || $this->char()=='.') && $this->next() ) { 00175 $value.= $this->char(); 00176 } 00177 00178 if(!$this->isNumeric()) { 00179 $this->prev(); 00180 } 00181 00182 return floatval($value); 00183 }
getString | ( | ) |
Get string value for method args
Definition at line 94 of file Variable.php.
00094 { 00095 00096 $value = ''; 00097 if($this->isWhiteSpace()) { 00098 return $value; 00099 } 00100 $qouteStart = $this->isQuote(); 00101 00102 if($qouteStart) { 00103 $breakSymbol = $this->char(); 00104 } else { 00105 $breakSymbol = false; 00106 $value .= $this->char(); 00107 } 00108 00109 while ($this->next()) { 00110 if (!$breakSymbol && ($this->isWhiteSpace() || $this->char() == ',' || $this->char() == ')') ) { 00111 $this->prev(); 00112 break; 00113 } else if ($breakSymbol && $this->char() == $breakSymbol) { 00114 break; 00115 } else if ($this->char() == '\\') { 00116 $this->next(); 00117 $value .= $this->char(); 00118 } else { 00119 $value .= $this->char(); 00120 00121 } 00122 } 00123 00124 return $value; 00125 }
isNumeric | ( | ) |
Return true if current char is a number
Definition at line 132 of file Variable.php.
isQuote | ( | ) |
Return true if current char is qoute or apostroph
Definition at line 141 of file Variable.php.
tokenize | ( | ) |
Tokenize string and return getted variable stack path
Reimplemented from Varien_Filter_Template_Tokenizer_Abstract.
Definition at line 43 of file Variable.php.
00044 { 00045 $actions = array(); 00046 $parameterName = ''; 00047 $variableSet = false; 00048 do { 00049 if($this->isWhiteSpace()) { 00050 // Ignore white spaces 00051 continue; 00052 } else if($this->char()!='.' && $this->char()!='(') { 00053 // Property or method name 00054 $parameterName .= $this->char(); 00055 } else if($this->char()=='(') { 00056 // Method declaration 00057 $methodArgs = $this->getMethodArgs(); 00058 $actions[] = array('type'=>'method', 00059 'name'=>$parameterName, 00060 'args'=>$methodArgs); 00061 $parameterName = ''; 00062 } else if($parameterName!='') { 00063 // Property or variable declaration 00064 if($variableSet) { 00065 $actions[] = array('type'=>'property', 00066 'name'=>$parameterName); 00067 } else { 00068 $variableSet = true; 00069 $actions[] = array('type'=>'variable', 00070 'name'=>$parameterName); 00071 } 00072 $parameterName = ''; 00073 } 00074 } while ($this->next()); 00075 00076 if($parameterName != '' ) { 00077 if($variableSet) { 00078 $actions[] = array('type'=>'property', 00079 'name'=>$parameterName); 00080 } else { 00081 $actions[] = array('type'=>'variable', 00082 'name'=>$parameterName); 00083 } 00084 } 00085 00086 return $actions; 00087 }