setOutputMode() public method

public setOutputMode ( string $outputMode ) : ValueGenerator
$outputMode string
return ValueGenerator
示例#1
0
 /**
  * generate()
  *
  * @return string
  */
 public function generate()
 {
     $output = '';
     if ($this->type && !in_array($this->type, self::$simple)) {
         $output .= $this->type . ' ';
     }
     if ($this->passedByReference === true) {
         $output .= '&';
     }
     $output .= '$' . $this->name;
     if ($this->defaultValue !== null) {
         $output .= ' = ';
         if (is_string($this->defaultValue)) {
             $output .= ValueGenerator::escape($this->defaultValue);
         } else {
             if ($this->defaultValue instanceof ValueGenerator) {
                 $this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
                 $output .= (string) $this->defaultValue;
             } else {
                 $output .= $this->defaultValue;
             }
         }
     }
     return $output;
 }
 /**
  * @return string
  */
 public function generate()
 {
     $output = $this->generateTypeHint();
     if (true === $this->passedByReference) {
         $output .= '&';
     }
     if ($this->variadic) {
         $output .= '... ';
     }
     $output .= '$' . $this->name;
     if ($this->defaultValue !== null) {
         $output .= ' = ';
         if (is_string($this->defaultValue)) {
             $output .= ValueGenerator::escape($this->defaultValue);
         } elseif ($this->defaultValue instanceof ValueGenerator) {
             $this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
             $output .= $this->defaultValue;
         } else {
             $output .= $this->defaultValue;
         }
     }
     return $output;
 }