コード例 #1
0
 /**
  * Generates the documentation page with all classes, methods etc.
  *
  * @param string Template file (optional)
  *
  * @return string
  */
 public function getDocumentation($template = null)
 {
     if ($template === null) {
         $template = __DIR__ . '/../../doc/templates/docclass.xsl';
     }
     if (!is_file($template)) {
         throw new WSException("Could not find the template file: '{$template}'");
     }
     $xtpl = new IPXSLTemplate($template);
     $documentation = array();
     $documentation['menu'] = array();
     //loop menu items
     $documentation['menu'] = $this->getClasses();
     if ($this->class) {
         if ($this->class->isUserDefined()) {
             $this->class->properties = $this->class->getProperties(false, false);
             $this->class->methods = $this->class->getMethods(false, false);
             foreach ((array) $this->class->methods as $method) {
                 $method->params = $method->getParameters();
             }
         } else {
             $documentation['fault'] = 'Native class';
         }
         $documentation['class'] = $this->class;
     }
     echo $xtpl->execute($documentation);
 }
コード例 #2
0
 /**
  * Generates the documentations for the webservice usage.
  *
  * @TODO: "int", "boolean", "double", "float", "string", "void"
  *
  * @param string Template filename
  */
 public function createDocumentation($template = '')
 {
     if ($template == '') {
         $template = $this->docTemplate;
     }
     if ($template == '') {
         throw new WSException('No template file to generate documentation');
     }
     if (!is_file($template)) {
         throw new WSException("Could not find the template file: '{$template}'");
     }
     $this->class = new IPReflectionClass($this->name);
     $xtpl = new IPXSLTemplate($template);
     $documentation = array();
     $documentation['menu'] = array();
     //loop menu items
     sort($this->classNameArr);
     //ff sorteren
     foreach ($this->classNameArr as $className) {
         $documentation['menu'][] = new IPReflectionClass($className);
     }
     if ($this->class) {
         $this->class->properties = $this->class->getProperties(false, false);
         $this->class->methods = $this->class->getMethods(false, false);
         foreach ((array) $this->class->methods as $method) {
             $method->params = $method->getParameters();
         }
         $documentation['class'] = $this->class;
     }
     echo $xtpl->execute($documentation);
 }