예제 #1
0
 /**
  * @covers Puml\Model\Method::getParameters
  */
 public function testGetParameters()
 {
     $this->assertInternalType('array', $this->object->getParameters());
     $parameter = $this->getMock('\\Puml\\Model\\MethodParameter');
     $this->object->addParameter($parameter);
     $this->assertContains($parameter, $this->object->getParameters());
 }
예제 #2
0
 /**
  * toDocTypeString
  * @param Method $method
  * @return string
  */
 public function toDocTypeString(Method $method)
 {
     $longestType = 0;
     $longestName = 0;
     foreach ($method->getParameters() as $parameter) {
         if (strlen($parameter->getType()) > $longestType) {
             $longestType = strlen($parameter->getType());
         }
         if (strlen($parameter->getName()) > $longestName) {
             $longestName = strlen($parameter->getName());
         }
     }
     $returnVar = '	 * @param';
     $returnVar .= ' ' . $this->getType() . str_repeat(' ', $longestType - strlen($this->getType()));
     $returnVar .= ' $' . $this->getName();
     if (strlen($this->getDescription()) > 0) {
         $returnVar .= str_repeat(' ', $longestName - strlen($this->getName())) . ' ' . $this->getDescription();
     }
     $returnVar .= "\n";
     return $returnVar;
 }