public static function escape($input, $quote = true) { $output = addcslashes($input, "\\'"); // adds quoting strings if ($quote) { $output = "'" . $output . "'"; } 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; }