Esempio n. 1
0
 private function getServiceActionElement(KalturaServiceReflector $serviceReflector, $actionId)
 {
     $outputTypeReflector = $serviceReflector->getActionOutputType($actionId);
     $actionInfo = $serviceReflector->getActionInfo($actionId);
     $actionParams = $serviceReflector->getActionParams($actionId);
     $outputType = null;
     if ($outputTypeReflector) {
         $outputType = $outputTypeReflector->getType();
     }
     $actionElement = $this->_doc->createElement("action");
     $actionElement->setAttribute("name", $actionInfo->action);
     foreach ($actionParams as $actionParam) {
         $actionParamElement = $this->_doc->createElement("param");
         $actionParamElement->setAttribute("name", $actionParam->getName());
         if ($actionParam->isArray()) {
             $actionParamElement->setAttribute("type", "array");
             $actionParamElement->setAttribute("arrayType", $actionParam->getArrayType());
         } elseif ($actionParam->isEnum()) {
             $actionParamElement->setAttribute("type", "int");
             $actionParamElement->setAttribute("enumType", $actionParam->getType());
         } else {
             if ($actionParam->isStringEnum()) {
                 $actionParamElement->setAttribute("type", "string");
                 $actionParamElement->setAttribute("enumType", $actionParam->getType());
             } else {
                 $actionParamElement->setAttribute("type", $actionParam->getType());
             }
         }
         $actionParamElement->setAttribute("optional", $actionParam->isOptional() ? "1" : "0");
         if ($actionParam->isOptional()) {
             switch ($actionParam->getType()) {
                 case "bool":
                     if ($actionParam->getDefaultValue() === true) {
                         $actionParamElement->setAttribute("default", "true");
                     } else {
                         if ($actionParam->getDefaultValue() === false) {
                             $actionParamElement->setAttribute("default", "false");
                         }
                     }
                     break;
                 case "int":
                 case "float":
                 case "string":
                     if ($actionParam->getDefaultValue() === null) {
                         $actionParamElement->setAttribute("default", "null");
                     } else {
                         $actionParamElement->setAttribute("default", $actionParam->getDefaultValue());
                     }
                     break;
                 default:
                     if ($actionParam->isEnum()) {
                         $actionParamElement->setAttribute("default", $actionParam->getDefaultValue());
                     } else {
                         $actionParamElement->setAttribute("default", "null");
                     }
             }
         }
         $description = $actionParam->getDescription();
         $description = $this->fixDescription($description);
         $actionParamElement->setAttribute("description", $description);
         $actionElement->appendChild($actionParamElement);
     }
     $resultElement = $this->_doc->createElement("result");
     $arrayType = null;
     if ($outputTypeReflector) {
         if ($outputTypeReflector->isArray()) {
             $resultElement->setAttribute("type", "array");
             $arrayType = $outputTypeReflector->getArrayType();
             $resultElement->setAttribute("arrayType", $arrayType);
         } else {
             $resultElement->setAttribute("type", $outputType);
         }
     }
     $description = $actionInfo->description;
     $description = $this->fixDescription($description);
     $actionElement->setAttribute("description", $description);
     $actionElement->appendChild($resultElement);
     return $actionElement;
 }
Esempio n. 2
0
 protected function writeService(KalturaServiceReflector $serviceReflector)
 {
     $serviceName = $serviceReflector->getServiceName();
     $serviceId = $serviceReflector->getServiceId();
     $serviceClass = $serviceReflector->getServiceClass();
     $actions = $serviceReflector->getActions();
     foreach ($actions as $action => $actionName) {
         $actionInfo = $serviceReflector->getActionInfo($action);
         if ($actionInfo->deprecated || $actionInfo->serverOnly) {
             continue;
         }
         if (strpos($actionInfo->clientgenerator, "ignore") !== false) {
             continue;
         }
         $outputTypeReflector = $serviceReflector->getActionOutputType($action);
         $actionParams = $serviceReflector->getActionParams($action);
         $this->writeServiceAction($serviceId, $serviceName, $actionInfo->action, $actionParams, $outputTypeReflector);
     }
 }
Esempio n. 3
0
        ?>
				<?php 
        echo $actionParam->getType();
        ?>
			<?php 
    }
    ?>
		</td>
		<td><?php 
    echo $actionParam->getDescription();
    ?>
</td>
	</tr>
<?php 
}
$returnValue = $serviceReflector->getActionOutputType($action);
if ($returnValue) {
    ?>
	<tr>
		<td colspan="3" class="title">Output Type</td>
	</tr>
	<tr>
		<th colspan="3" class="subtitle">type</th>
	</tr>
	<tr>
		<td colspan="3" ><a href="?object=<?php 
    echo $returnValue->getType();
    ?>
"><?php 
    echo $returnValue->getType();
    ?>