an example doc string in php
 public function __toString()
 {
     $content = "";
     if ($this->return) {
         $content .= AbstractClass::tab() . "/**\n";
         foreach ($this->params as $param) {
             $content .= AbstractClass::tab() . ' * @param';
             if ($param->getType()) {
                 $content .= " " . $param->getType();
             }
             $content .= ' $' . $param->getName() . "\n";
         }
         $content .= AbstractClass::tab() . ' * @return ' . $this->return . "\n";
         $content .= AbstractClass::tab() . " */\n";
     }
     $params = implode(", ", $this->params);
     $content .= AbstractClass::tab() . $this->scope . $this->getStatic() . "function " . $this->name;
     $content .= "(" . $params . ")\n";
     $content .= AbstractClass::tab() . '{' . "\n";
     $content .= $this->content;
     $content .= AbstractClass::tab() . '}' . "\n";
     return $content;
 }
Exemple #2
0
 /**
  * This private function takes the authors and the answers
  * from a posted form, which replace the current paper description
  */
 private function setDependentFromArray(&$input)
 {
     // Now we must take embedded objects: abstracts
     $abstract = new AbstractClass();
     if (isset($input["abstract"])) {
         foreach ($input["abstract"] as $id => $content) {
             $this->_abstract[$id] = $abstract->createRow();
             $this->_abstract[$id]->content = htmlSpecialChars($content, ENT_NOQUOTES);
             $this->_abstract[$id]->id_section = $id;
         }
     }
     // Next, authors
     $this->_authors = array();
     $this->_contactAuthor = -1;
     $user = new User();
     // Instantiate all the authors
     if (isset($input["last_name"])) {
         $emails = $input["email"];
         $lastNames = $input["last_name"];
         $firstNames = $input["first_name"];
         $affiliations = $input["affiliation"];
         $country_code = $input["country_code"];
         if (isset($input["contact_author"])) {
             $contactAuthor = $input["contact_author"];
         } else {
             $contactAuthor = -1;
         }
         foreach ($lastNames as $i => $lastName) {
             // Since the array comes from a form with possibly left
             // blank lines, we do not consider an empty name as a mistake
             if ($lastName != "") {
                 $userRow = $user->createRow();
                 $userRow->setFilterData(true);
                 $userRow->setFromArray(array("last_name" => $lastName, "first_name" => $firstNames[$i], "affiliation" => $affiliations[$i], "country_code" => $country_code[$i], "email" => $emails[$i]));
                 $this->_authors[] = $userRow;
                 // Check the contact author
                 if ($contactAuthor == $i) {
                     $this->_contactAuthor = $i;
                     $this->emailContact = $emails[$i];
                 }
             }
         }
         // End of loop on last_name
     }
     // End of test of the existence of 'last_name'
     // Get the answers to additional questions
     $this->_answers = array();
     $paperAnswer = new PaperAnswer();
     if (isset($input['answers'])) {
         foreach ($input['answers'] as $idQuestion => $idAnswer) {
             $this->_answers[$idQuestion] = $paperAnswer->createRow();
             // Initialize the answer object. Note: the paper d is not know yet
             $this->_answers[$idQuestion]->setFromArray(array("id_question" => $idQuestion, "id_answer" => $idAnswer));
         }
     }
 }
 public function getName()
 {
     parent::getName();
     echo "I n Concrete : getName()\n";
 }