/** * Returns the name of the value as constant * @see WsdlToPhpModel::getCleanName() * @uses WsdlToPhpModel::getCleanName() * @uses WsdlToPhpModel::getName() * @uses WsdlToPhpModel::getOwner() * @uses WsdlToPhpStructValue::constantSuffix() * @uses WsdlToPhpStructValue::getIndex() * @uses WsdlToPhpStructValue::getOwner() * @uses WsdlToPhpGenerator::getOptionGenericConstantsNames() * @param bool $_keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores * @return string */ public function getCleanName($_keepMultipleUnderscores = false) { if (WsdlToPhpGenerator::getOptionGenericConstantsNames() && is_numeric($this->getIndex()) && $this->getIndex() >= 0) { return 'ENUM_VALUE_' . $this->getIndex(); } else { $key = self::constantSuffix($this->getOwner()->getName(), parent::getCleanName($_keepMultipleUnderscores), $this->getIndex()); return 'VALUE_' . strtoupper(parent::getCleanName($_keepMultipleUnderscores)) . ($key ? '_' . $key : ''); } }
/** * Returns the comment lines for this service * @uses WsdlToPhpModel::getModelByName() * @uses WsdlToPhpModel::getPackagedName() * @uses WsdlToPhpModel::getGenericWsdlClassName() * @uses WsdlToPhpModel::getMetaValue() * @uses WsdlToPhpModel::cleanString() * @uses WsdlToPhpStruct::getContextualPart() * @uses WsdlToPhpService::getFunctions() * @uses WsdlToPhpFunction::getReturnType() * @uses WsdlToPhpFunction::getComment() * @uses WsdlToPhpFunction::getBody() * @uses WsdlToPhpGenerator::getPackageName() * @uses WsdlToPhpGenerator::getOptionGenerateWsdlClassFile() * @param array $_body * @return void */ public function getClassBody(&$_body) { if (count($this->getFunctions())) { $returnTypes = array(); $soapHeaders = array(); /** * Gather informations */ foreach ($this->getFunctions() as $function) { /** * Gather return types */ $model = self::getModelByName($function->getReturnType()); if ($model && $model->getIsStruct()) { array_push($returnTypes, $model->getPackagedName()); unset($model); } else { array_push($returnTypes, $function->getReturnType()); } /** * Gather SoapHeader informations */ $soapHeaderNames = $function->getMetaValue('SOAPHeaderNames', array()); $soapHeaderTypes = $function->getMetaValue('SOAPHeaderTypes', array()); $soapHeaderNameSpaces = $function->getMetaValue('SOAPHeaderNamespaces', ''); if (count($soapHeaderNames) && count($soapHeaderNames) == count($soapHeaderTypes)) { foreach ($soapHeaderNames as $index => $soapHeaderName) { $soapHeaderType = str_replace('{@link ', '', $soapHeaderTypes[$index]); $soapHeaderType = str_replace('}', '', $soapHeaderType); $soapHeaderKey = $soapHeaderName . '-' . $soapHeaderType; if (!array_key_exists($soapHeaderKey, $soapHeaders)) { $soapHeaders[$soapHeaderKey] = array('name' => $soapHeaderName, 'type' => $soapHeaderType, 'namespaces' => array($soapHeaderNameSpaces[$index])); } elseif (!in_array($soapHeaderNameSpaces[$index], $soapHeaders[$soapHeaderKey]['namespaces'])) { array_push($soapHeaders[$soapHeaderKey]['namespaces'], $soapHeaderNameSpaces[$index]); } } } } /** * Generates the SoapHeaders setter methods */ if (count($soapHeaders) && WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { $whateverStruct = new WsdlToPhpStruct('whatever'); $soapHeaderNameUniqueMethods = array(); foreach ($soapHeaders as $soapHeader) { $soapHeaderName = $soapHeader['name']; $soapHeaderType = $soapHeader['type']; $soapHeaderNameSpaces = $soapHeader['namespaces']; $cleanedName = $this->cleanString($soapHeaderName, false); $headerParamKnown = strpos($soapHeaderType, WsdlToPhpGenerator::getPackageName() . $whateverStruct->getContextualPart()) === 0; $methodName = ucfirst($cleanedName); /** * Ensure unique setter naming */ if (!array_key_exists($methodName, $soapHeaderNameUniqueMethods)) { $soapHeaderNameUniqueMethods[$methodName] = 0; } else { $soapHeaderNameUniqueMethods[$methodName]++; } $methodName .= $soapHeaderNameUniqueMethods[$methodName] ? '_' . $soapHeaderNameUniqueMethods[$methodName] : ''; /** * setSoapHeader() method comments */ $comments = array(); array_push($comments, 'Sets the ' . $soapHeaderName . ' SoapHeader param'); array_push($comments, '@uses ' . self::getGenericWsdlClassName() . '::setSoapHeader()'); array_push($comments, '@param ' . $soapHeaderType . ' $_' . lcfirst($headerParamKnown ? $soapHeaderType : $cleanedName)); array_push($comments, '@param string $_nameSpace ' . implode(', ', $soapHeaderNameSpaces)); array_push($comments, '@param bool $_mustUnderstand'); array_push($comments, '@param string $_actor'); array_push($comments, '@return bool true|false'); /** * getResult() method body */ array_push($_body, array('comment' => $comments)); array_push($_body, 'public function setSoapHeader' . $methodName . '(' . ($headerParamKnown ? $soapHeaderType . ' ' : '') . '$_' . lcfirst($headerParamKnown ? $soapHeaderType : $cleanedName) . ',$_nameSpace' . (count($soapHeaderNameSpaces) > 1 ? '' : ' = ' . var_export($soapHeaderNameSpaces[0], true)) . ',$_mustUnderstand = false,$_actor = null)'); array_push($_body, '{'); array_push($_body, 'return $this->setSoapHeader($_nameSpace,\'' . $soapHeaderName . '\',$_' . lcfirst($headerParamKnown ? $soapHeaderType : $cleanedName) . ',$_mustUnderstand,$_actor);'); array_push($_body, '}'); unset($soapHeaderName, $soapHeaderType, $soapHeaderNameSpaces, $cleanedName, $headerParamKnown, $methodName, $comments); } } /** * Generates service methods */ foreach ($this->getFunctions() as $function) { array_push($_body, array('comment' => $function->getComment())); $function->getBody($_body); } /** * Generates the override getResult method if needed */ if (count($returnTypes) && WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { $returnTypes = array_unique($returnTypes); natcasesort($returnTypes); /** * getResult() method comments */ $comments = array(); array_push($comments, 'Returns the result'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::getResult()'); array_push($comments, '@return ' . implode('|', $returnTypes)); /** * getResult() method body */ array_push($_body, array('comment' => $comments)); array_push($_body, 'public function getResult()'); array_push($_body, '{'); array_push($_body, 'return parent::getResult();'); array_push($_body, '}'); unset($comments); } unset($returnTypes, $soapHeaders); } }
/** * Set the function body * @uses WsdlToPhpModel::getName() * @uses WsdlToPhpModel::getPackagedName() * @uses WsdlToPhpModel::getModelByName() * @uses WsdlToPhpModel::nameIsClean() * @uses WsdlToPhpModel::cleanString() * @uses WsdlToPhpModel::uniqueName() * @uses WsdlToPhpFunction::getParameterType() * @uses WsdlToPhpFunction::getOwner() * @uses WsdlToPhpFunction::getMethodName() * @uses WsdlToPhpStruct::getAttributes() * @uses WsdlToPhpStruct::getIsStruct() * @uses WsdlToPhpStructAttribute::getGetterName() * @uses WsdlToPhpGenerator::getOptionResponseAsWsdlObject() * @uses WsdlToPhpGenerator::getOptionSendParametersAsArray() * @uses WsdlToPhpGenerator::getOptionSendArrayAsParameter() * @uses WsdlToPhpGenerator::getOptionSendArrayAsParameter() * @param array * @return void */ public function getBody(&$_body) { $parameterModel = self::getModelByName($this->getParameterType()); $parameterModel = $parameterModel && $parameterModel->getIsStruct() && !$parameterModel->getIsRestriction() ? $parameterModel : null; $returnModel = self::getModelByName($this->getReturnType()); $returnModel = $returnModel && $returnModel->getIsStruct() && !$returnModel->getIsRestriction() ? $returnModel : null; if ($parameterModel) { if (count($parameterModel->getAttributes(true, true))) { $parameterName = '$_' . lcfirst($parameterModel->getPackagedName()); $parameter = $parameterModel->getPackagedName() . ' ' . $parameterName; } else { $parameterName = $parameter = ''; } } elseif (is_string($this->getParameterType())) { $parameterName = $parameter = '$_' . lcfirst(self::cleanString($this->getParameterType())); } elseif (is_array($this->getParameterType())) { $parameters = array(); foreach ($this->getParameterType() as $parameterName => $parameterType) { $model = self::getModelByName($parameterType); if (false && $model && $model->getIsStruct() && !$model->getIsRestriction()) { $parameterName = $model->getPackagedName(); } else { $parameterName = self::cleanString($parameterName); } array_push($parameters, ($model && $model->getIsStruct() && !$model->getIsRestriction() ? $model->getPackagedName() . ' ' : '') . '$_' . lcfirst($parameterName)); } $parameterName = $parameter = implode(',', $parameters); } else { $parameterName = $parameter = ''; } array_push($_body, 'public function ' . $this->getMethodName() . '(' . $parameter . ')'); array_push($_body, '{'); array_push($_body, 'try'); array_push($_body, '{'); /** * Response */ $responseAsObjStart = WsdlToPhpGenerator::getOptionResponseAsWsdlObject() && $returnModel ? 'new ' . $returnModel->getPackagedName() . '(' : ''; $responseAsObjEnd = WsdlToPhpGenerator::getOptionResponseAsWsdlObject() && $returnModel ? ')' : ''; /** * Soap parameters */ if ($parameterModel) { $attributes = $parameterModel->getAttributes(true, true); if (count($attributes)) { $soapParametersStart = $parameterName; $soapParametersEnd = ''; } else { $soapParametersStart = $soapParametersEnd = ''; } } elseif (is_string($this->getParameterType())) { $soapParametersStart = WsdlToPhpGenerator::getOptionSendArrayAsParameter() ? '\'' . addslashes($this->getParameterType()) . '\'=>' : ''; $soapParametersEnd = '$_' . lcfirst(self::cleanString($this->getParameterType())); } elseif (is_array($this->getParameterType())) { $soapParametersStart = array(); $soapParametersEnd = ''; foreach ($this->getParameterType() as $parameterName => $parameterType) { $model = self::getModelByName($parameterType); if (false && $model && $model->getIsStruct() && !$model->getIsRestriction()) { $paramName = $model->getPackagedName(); } else { $paramName = self::cleanString($parameterName); } array_push($soapParametersStart, (WsdlToPhpGenerator::getOptionSendArrayAsParameter() ? '\'' . addslashes($parameterName) . '\'=>' : '') . '$_' . lcfirst($paramName)); unset($model); } $soapParametersStart = implode(',', $soapParametersStart); } else { $soapParametersStart = $soapParametersEnd = ''; } /** * Soap call */ $soapCallStart = 'self::getSoapClient()->' . ($this->nameIsClean() ? $this->getName() . '(' : '__soapCall(\'' . $this->getName() . '\'' . (!empty($soapParametersStart) || !empty($soapParametersEnd) ? ',array(' : '')); $soapCallEnd = (!$this->nameIsClean() && (!empty($soapParametersStart) || !empty($soapParametersEnd)) ? ')' : '') . ')' . (WsdlToPhpGenerator::getOptionSendParametersAsArray() ? '->parameters' : ''); /** * Send parameters in parameters array */ if (!empty($soapParametersStart) && $this->nameIsClean()) { $sendParametersAsArrayStart = WsdlToPhpGenerator::getOptionSendParametersAsArray() ? 'array(\'parameters\'=>' : ''; $sendParametersAsArrayEnd = WsdlToPhpGenerator::getOptionSendParametersAsArray() ? ')' : ''; } else { $sendParametersAsArrayStart = $sendParametersAsArrayEnd = ''; } /** * Send an array */ if (!empty($soapParametersStart) && $this->nameIsClean()) { $sendArrayAsParameterStart = WsdlToPhpGenerator::getOptionSendArrayAsParameter() ? 'array(' : ''; $sendArrayAsParameterEnd = WsdlToPhpGenerator::getOptionSendArrayAsParameter() ? ')' : ''; } else { $sendArrayAsParameterStart = $sendArrayAsParameterEnd = ''; } array_push($_body, 'return $this->setResult(' . $responseAsObjStart . $soapCallStart . $sendParametersAsArrayStart . $sendArrayAsParameterStart . $soapParametersStart . $soapParametersEnd . $sendArrayAsParameterEnd . $sendParametersAsArrayEnd . $soapCallEnd . $responseAsObjEnd . ');'); array_push($_body, '}'); array_push($_body, 'catch(SoapFault $soapFault)'); array_push($_body, '{'); array_push($_body, 'return !$this->saveLastError(__METHOD__,$soapFault);'); array_push($_body, '}'); array_push($_body, '}'); unset($parameterModel, $parameter, $responseAsObjStart, $responseAsObjEnd, $soapCallStart, $soapCallEnd, $sendParametersAsArrayStart, $sendParametersAsArrayEnd, $sendParametersAsArrayStart, $sendArrayAsParameterEnd, $soapParametersStart, $soapParametersEnd); }
/** * Returns the generic name of the WsdlClass * @uses WsdlToPhpGenerator::getPackageName() * @return string */ public static function getGenericWsdlClassName() { return WsdlToPhpGenerator::getPackageName() . 'WsdlClass'; }
/** * Returns the constructor method * @uses WsdlToPhpModel::getName() * @uses WsdlToPhpModel::getModelByName() * @uses WsdlToPhpModel::getPackagedName() * @uses WsdlToPhpModel::getCleanName() * @uses WsdlToPhpModel::getInheritance() * @uses WsdlToPhpModel::getGenericWsdlClassName() * @uses WsdlToPhpStruct::isArray() * @uses WsdlToPhpStruct::getIsRestriction() * @uses WsdlToPhpStruct::getValues() * @uses WsdlToPhpStruct::getAttributes() * @uses WsdlToPhpStruct::getIsStruct() * @uses WsdlToPhpStructValue::getComment() * @uses WsdlToPhpStructValue::getDeclaration() * @uses WsdlToPhpStructValue::getCleanName() * @uses WsdlToPhpStructAttribute::getComment() * @uses WsdlToPhpStructAttribute::getDeclaration() * @uses WsdlToPhpStructAttribute::isRequired() * @uses WsdlToPhpStructAttribute::getType() * @uses WsdlToPhpStructAttribute::getDefaultValue() * @uses WsdlToPhpStructAttribute::getGetterDeclaration() * @uses WsdlToPhpStructAttribute::getSetterDeclaration() * @uses WsdlToPhpGenerator::getOptionGenerateWsdlClassFile() * @uses WsdlToPhpGenerator::getPackageName() * @param array $_body the body which will be populated * @return array */ public function getClassBody(&$_body) { /** * A restriction struct with enumeration values */ if ($this->getIsRestriction() && count($this->getValues())) { $constantsDefined = array(); foreach ($this->getValues() as $index => $value) { array_push($_body, array('comment' => $value->getComment())); array_push($_body, $value->getDeclaration($this->getName(), $index)); array_push($constantsDefined, $this->getPackagedName() . '::' . $value->getCleanName()); } /** * valueIsValid() method comments */ $comments = array(); array_push($comments, 'Return true if value is allowed'); foreach ($constantsDefined as $constantName) { array_push($comments, '@uses ' . $constantName); } array_push($comments, '@param mixed $_value value'); array_push($comments, '@return bool true|false'); array_push($_body, array('comment' => $comments)); /** * valueIsValid() method body */ array_push($_body, 'public static function valueIsValid($_value)'); array_push($_body, '{'); array_push($_body, 'return in_array($_value,array(' . implode(',', $constantsDefined) . '));'); array_push($_body, '}'); unset($comments); } elseif (count($this->getAttributes())) { /** * Gathers informations about attributes */ $bodyParameters = array(); $bodyParams = array(); $bodyUses = array(); $constructParameters = array(); $attributes = $this->getAttributes(false, true); foreach ($attributes as $attribute) { array_push($_body, array('comment' => $attribute->getComment())); array_push($_body, $attribute->getDeclaration()); array_push($bodyParameters, '$_' . lcfirst($attribute->getCleanName()) . (!$attribute->isRequired() ? ' = ' . var_export($attribute->getDefaultValue(), true) : '')); if (!WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { array_push($bodyUses, $this->getPackagedName() . '::' . $attribute->getSetterName() . '()'); } $model = self::getModelByName($attribute->getType()); if ($model) { if ($model->getIsStruct() && $model->getPackagedName() != $this->getPackagedName()) { if ($model->isArray()) { array_push($constructParameters, '\'' . $attribute->getUniqueName() . '\'=>($_' . lcfirst($attribute->getCleanName()) . ' instanceof ' . $model->getPackagedName() . ')?$_' . lcfirst($attribute->getCleanName()) . ':new ' . $model->getPackagedName() . '($_' . lcfirst($attribute->getCleanName()) . ')'); } else { array_push($constructParameters, '\'' . $attribute->getUniqueName() . '\'=>$_' . lcfirst($attribute->getCleanName())); } $paramType = $model->getPackagedName(); } else { array_push($constructParameters, '\'' . $attribute->getUniqueName() . '\'=>$_' . lcfirst($attribute->getCleanName())); $paramType = $model->getInheritance() ? $model->getInheritance() : $attribute->getType(); } } else { array_push($constructParameters, '\'' . $attribute->getUniqueName() . '\'=>$_' . lcfirst($attribute->getCleanName())); $paramType = $attribute->getType(); } array_push($bodyParams, $paramType . ' $_' . lcfirst($attribute->getCleanName())); unset($paramType, $model); } /** * __contruct() method comments */ $comments = array(); array_push($comments, 'Constructor method for ' . $this->getCleanName()); /** * Uses the parent constructor method */ if (WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { array_push($comments, '@see parent::__construct()'); } foreach ($bodyUses as $bodyUse) { array_push($comments, '@uses ' . $bodyUse); } foreach ($bodyParams as $bodyParam) { array_push($comments, '@param ' . $bodyParam); } array_push($comments, '@return ' . $this->getPackagedName()); array_push($_body, array('comment' => $comments)); /** * __contruct() method body */ array_push($_body, 'public function __construct(' . implode(',', $bodyParameters) . ')'); array_push($_body, '{'); $model = self::getModelByName($this->getInheritance()); /** * Uses the parent constructor method */ if (WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { array_push($_body, ($model && $model->getIsStruct() ? self::getGenericWsdlClassName() : 'parent') . '::__construct(array(' . implode(',', $constructParameters) . '),false);'); } else { foreach ($attributes as $attribute) { array_push($_body, '$this->' . $attribute->getSetterName() . '($_' . lcfirst($attribute->getCleanName()) . ');'); } } array_push($_body, '}'); /** * Setters and getters */ foreach ($this->getAttributes(false, true) as $attribute) { $attribute->getGetterDeclaration($_body, $this); $attribute->getSetterDeclaration($_body, $this); } unset($comments, $bodyParameters, $bodyParams, $constructParameters); /** * A array struct */ if ($this->isArray()) { foreach ($this->getAttributes() as $attr) { $attribute = $attr; } if ($attribute instanceof WsdlToPhpStructAttribute) { $model = self::getModelByName($attribute->getType()); $return = $model && $model->getIsStruct() ? $model->getPackagedName() : $attribute->getType(); $comments = array(); /** * current() method comments */ array_push($comments, 'Returns the current element'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::current()'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * current() method body */ array_push($_body, 'public function current()'); array_push($_body, '{'); array_push($_body, 'return parent::current();'); array_push($_body, '}'); $comments = array(); /** * item() method comments */ array_push($comments, 'Returns the indexed element'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::item()'); array_push($comments, '@param int $_index'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * item() method body */ array_push($_body, 'public function item($_index)'); array_push($_body, '{'); array_push($_body, 'return parent::item($_index);'); array_push($_body, '}'); $comments = array(); /** * first() method comments */ array_push($comments, 'Returns the first element'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::first()'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * first() method body */ array_push($_body, 'public function first()'); array_push($_body, '{'); array_push($_body, 'return parent::first();'); array_push($_body, '}'); $comments = array(); /** * last() method comments */ array_push($comments, 'Returns the last element'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::last()'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * last() method body */ array_push($_body, 'public function last()'); array_push($_body, '{'); array_push($_body, 'return parent::last();'); array_push($_body, '}'); $comments = array(); /** * offsetGet() method comments */ array_push($comments, 'Returns the element at the offset'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::last()'); array_push($comments, '@param int $_offset'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * offsetGet() method body */ array_push($_body, 'public function offsetGet($_offset)'); array_push($_body, '{'); array_push($_body, 'return parent::offsetGet($_offset);'); array_push($_body, '}'); if ($model && $model->getIsRestriction()) { $comments = array(); /** * add() method comments */ array_push($comments, 'Add element to array'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::add()'); array_push($comments, '@uses ' . $model->getPackagedName() . '::valueIsValid()'); array_push($comments, '@param ' . $model->getPackagedName() . ' $_item'); array_push($comments, '@return ' . $return); array_push($_body, array('comment' => $comments)); /** * add() method body */ array_push($_body, 'public function add($_item)'); array_push($_body, '{'); array_push($_body, 'return ' . $model->getPackagedName() . '::valueIsValid($_item)?parent::add($_item):false;'); array_push($_body, '}'); } /** * getAttributeName() method comments */ $comments = array(); array_push($comments, 'Returns the attribute name'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::getAttributeName()'); array_push($comments, '@return string ' . $attribute->getCleanName()); array_push($_body, array('comment' => $comments)); /** * getAttributeName() method body */ array_push($_body, 'public function getAttributeName()'); array_push($_body, '{'); array_push($_body, 'return \'' . $attribute->getCleanName() . '\';'); array_push($_body, '}'); unset($comments, $model); } unset($attribute); } /** * __set_state method override */ if (WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { /** * __set_state() method comments */ $comments = array(); array_push($comments, 'Method called when an object has been exported with var_export() functions'); array_push($comments, 'It allows to return an object instantiated with the values'); array_push($comments, '@see ' . self::getGenericWsdlClassName() . '::__set_state()'); array_push($comments, '@uses ' . self::getGenericWsdlClassName() . '::__set_state()'); array_push($comments, '@param array $_array the exported values'); array_push($comments, '@return ' . $this->getPackagedName()); array_push($_body, array('comment' => $comments)); unset($comments); /** * __set_state method body */ array_push($_body, 'public static function __set_state(array $_array,$_className = __CLASS__)'); array_push($_body, '{'); array_push($_body, 'return parent::__set_state($_array,$_className);'); array_push($_body, '}'); } } }
/** * Sets the package name * @param string $_packageName * @return string */ private static function setPackageName($_packageName) { return self::$packageName = $_packageName; }
WsdlToPhpGenerator::setOptionSendArrayAsParameter(false); WsdlToPhpGenerator::setOptionSendParametersAsArray(false); WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME); WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME); $w->generateClasses($name, dirname(__FILE__) . '/samples/' . $name . '/'); } } /** * Any */ if (true) { $name = 'PayPal'; $wsdl = 'https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl'; exec('rm -rf ' . __DIR__ . '/samples/' . $name . '/*;'); echo "\r\nStart at " . date('H:i:s'); $w = new WsdlToPhpGenerator($wsdl); WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true); WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true); WsdlToPhpGenerator::setOptionGenerateTutorialFile(true); WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_TYPE); WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME); WsdlToPhpGenerator::setOptionAddComments(array('date' => date('Y-m-d'), 'author' => 'Mikaël DELSOL', 'version' => 1)); echo "\r\nStart generation at " . date('H:i:s'); $w->generateClasses($name, dirname(__FILE__) . '/samples/' . $name . '/'); echo "\r\nEnd generation at " . date('H:i:s'); echo "\r\nGenerate doc start " . date('H:i:s'); $ouputs = array(); exec('rm -rf ' . __DIR__ . '/docs/' . $name . '/* && clear && phpdoc --sourcecode on -d ' . __DIR__ . '/samples/' . $name . ' -t ' . __DIR__ . '/docs/' . $name . ' -pp -ti "' . ucfirst($name) . ' package documentation" -o HTML:frames:DOM/earthli;', $ouputs); print_r($ouputs); echo "\r\nGenerate doc end " . date('H:i:s'); print_r($w->getAudit());