/**
  *
  * @param string $encodeType (optional) default encode possible: decode, encode
  * @param boolean $arraysAsPhpNotation (optional) should arrays be notated as php arrays?
  * @return mixed the encoded string or decoded data
  */
 public function render($encodeType = 'encode', $arraysAsPhpNotation = TRUE)
 {
     $content = $this->renderChildren();
     if ($encodeType == 'decode') {
         return json_decode($content);
     } else {
         $content = json_encode($content);
         if ($arraysAsPhpNotation) {
             $content = Tx_ExtensionBuilder_Utility_Tools::convertJSONArrayToPHPArray($content);
         }
         return $content;
     }
 }
 /**
  * This methods renders the parameters of a method, including typeHints and default values.
  *
  * @param $methodObject
  * @return string parameters
  */
 private function renderMethodParameter($methodObject)
 {
     $parameters = array();
     if (is_array($methodObject->getParameters())) {
         foreach ($methodObject->getParameters() as $parameter) {
             $parameterName = $parameter->getName();
             $typeHint = $parameter->getTypeHint();
             if ($parameter->isOptional()) {
                 $defaultValue = $parameter->getDefaultValue();
                 // optional parameters have a default value
                 if (!empty($typeHint)) {
                     // typeHints of optional parameter have the format "typeHint or defaultValue"
                     $typeHintParts = explode(' ', $typeHint);
                     $typeHint = $typeHintParts[0];
                 }
                 // the default value has to be json_encoded to render its string representation
                 if (is_array($defaultValue)) {
                     if (!empty($defaultValue)) {
                         $defaultValue = json_encode($defaultValue);
                         // now we render php notation from JSON notation
                         $defaultValue = Tx_ExtensionBuilder_Utility_Tools::convertJSONArrayToPHPArray($defaultValue);
                         //t3lib_div::devLog('default Value: '. $defaultValue, 'parameter debug');
                     } else {
                         $defaultValue = 'array()';
                     }
                 } elseif ($defaultValue === NULL) {
                     $defaultValue = 'NULL';
                 } else {
                     $defaultValue = json_encode($defaultValue);
                 }
                 $parameterName .= ' = ' . $defaultValue;
             }
             $parameterName = '$' . $parameterName;
             if ($parameter->isPassedByReference()) {
                 $parameterName = '&' . $parameterName;
             }
             if (!empty($typeHint)) {
                 $parameterName = $typeHint . ' ' . $parameterName;
             }
             $parameters[] = $parameterName;
             //t3lib_div::devLog($methodSchemaObject->getName().':'.$parameter->getName(), 'parameter debug');
         }
     }
     return implode(', ', $parameters);
 }