/** * Method to override in sub class * Must return a string in order to declare the function, attribute or the value * @uses WsdlToPhpStruct::getIsStruct() * @uses WsdlToPhpModel::getModelByName() * @uses WsdlToPhpModel::getInheritance() * @uses WsdlToPhpModel::getComment() * @uses WsdlToPhpModel::getPackagedName() * @uses WsdlToPhpModel::getClassBody() * @uses WsdlToPhpModel::getGenericWsdlClassName() * @uses WsdlToPhpGenerator::getOptionInheritsClassIdentifier() * @uses WsdlToPhpGenerator::getOptionGenerateWsdlClassFile() * @return string */ public function getClassDeclaration() { $class = array(); /** * Class comments */ array_push($class, array('comment' => $this->getFileComment())); array_push($class, array('comment' => $this->getClassComment())); /** * Extends */ $extends = ''; $base = WsdlToPhpGenerator::getOptionInheritsClassIdentifier(); if (!empty($base) && ($model = self::getModelByName($this->getName() . $base))) { if ($model->getIsStruct()) { $extends = $model->getPackagedName(); } } elseif ($this->getInheritance() != '' && ($model = self::getModelByName($this->getInheritance()))) { if ($model->getIsStruct()) { $extends = $model->getPackagedName(); } } elseif (class_exists($this->getInheritance()) && stripos($this->getInheritance(), WsdlToPhpGenerator::getPackageName()) === 0) { $extends = $this->getInheritance(); } if (empty($extends) && WsdlToPhpGenerator::getOptionGenerateWsdlClassFile()) { $extends = self::getGenericWsdlClassName(); } array_push($class, ($this->getIsAbstract() ? 'abstract ' : '') . 'class ' . $this->getPackagedName() . (!empty($extends) ? ' extends ' . $extends : '')); /** * Class body starts here */ array_push($class, '{'); /** * Populate class body */ $this->getClassBody($class); /** * __toString() method comments */ $comments = array(); array_push($comments, 'Method returning the class name'); array_push($comments, '@return string __CLASS__'); array_push($class, array('comment' => $comments)); unset($comments); /** * __toString method body */ array_push($class, 'public function __toString()'); array_push($class, '{'); array_push($class, 'return __CLASS__;'); array_push($class, '}'); /** * Class body ends here */ array_push($class, '}'); return $class; }