Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ class Configuration
}

/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
{
if (null === $variables) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ class HeaderSelector
}

/**
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
*
* @param string[] $accept Array of Accept Headers
* @param string[] $headersWithJson Array of Accept Headers of type "json"
*
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
*/
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
*
* @param string[] $accept Array of Accept Headers
* @param string[] $headersWithJson Array of Accept Headers of type "json"
*
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
*/
private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
{
$processedHeaders = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ use {{invokerPackage}}\ObjectSerializer;
{{/exts.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ enum {{classname}}: {{exts.x-php-enum-type}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{enumDescription}}
*/
* {{enumDescription}}
*/
{{/enumDescription}}
case {{{name}}} = {{{value}}};
{{^-last}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,47 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};

/**
* The original name of the model.
*
* @var string
*/
* The original name of the model.
*
* @var string
*/
protected static string $openAPIModelName = '{{name}}';

/**
* Array of property to type mappings. Used for (de)serialization
*
* @var array<string, string>
*/
* Array of property to type mappings. Used for (de)serialization
*
* @var array<string, string>
*/
protected static array $openAPITypes = [
{{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}},
{{/-last}}{{/vars}}
];

/**
* Array of property to format mappings. Used for (de)serialization
*
* @var array<string, string|null>
*/
* Array of property to format mappings. Used for (de)serialization
*
* @var array<string, string|null>
*/
protected static array $openAPIFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}},
{{/-last}}{{/vars}}
];

/**
* Array of nullable properties. Used for (de)serialization
*
* @var array<string, bool>
*/
* Array of nullable properties. Used for (de)serialization
*
* @var array<string, bool>
*/
protected static array $openAPINullables = [
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
{{/-last}}{{/vars}}
];

/**
* If a nullable field gets set to null, insert it here
*
* @var array<string, bool>
*/
* If a nullable field gets set to null, insert it here
*
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];

/**
Expand Down Expand Up @@ -262,14 +262,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}

/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
}

/**
* Sets {{name}}.
*
* @param {{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
* Sets {{name}}.
*
* @param {{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}): self
{
$this->{{name}} = ${{name}};
Expand All @@ -46,22 +46,22 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}

{{#isEnumRef}}
/**
* Gets {{name}} for serialization.
*
* @return string|null
*/
* Gets {{name}} for serialization.
*
* @return string|null
*/
public function getSerialized{{nameInPascalCase}}(): string|null
{
return !is_null($this->{{name}}?->value) ? (string) $this->{{name}}->value : null;
}

/**
* Sets {{name}}.
*
* @param string|{{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
* Sets {{name}}.
*
* @param string|{{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function setDeserialized{{nameInPascalCase}}(string|{{#vendorExtensions.x-comment-type}}{{vendorExtensions.x-comment-type}} {{/vendorExtensions.x-comment-type}}${{name}}{{^required}} = null{{/required}}): self
{
if (is_string(${{name}})) {
Expand All @@ -78,10 +78,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
{{#items}}
{{#isEnumRef}}
/**
* Gets {{name}} for serialization.
*
* @return array
*/
* Gets {{name}} for serialization.
*
* @return array
*/
public function getSerialized{{nameInPascalCase}}(): array
{
return array_map(
Expand All @@ -91,12 +91,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
}

/**
* Sets {{name}}.
*
* @param {{^required}}?{{/required}}array ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
* Sets {{name}}.
*
* @param {{^required}}?{{/required}}array ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function setDeserialized{{nameInPascalCase}}({{^required}}?{{/required}}array ${{name}}{{^required}} = []{{/required}}): self
{
$this->{{name}} = array_map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* @Type("DateTime")
{{/isDateTime}}
{{#isEnumRef}}
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Type("string")
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Type("string")
{{/isEnumRef}}
{{^isDate}}
{{^isDateTime}}
Expand All @@ -42,7 +42,7 @@
{{/isDateTime}}
{{/isDate}}
{{/isContainer}}
*/
*/
{{#required}}
#[Assert\NotNull]
{{^isPrimitiveType}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};

/**
* The original name of the model.
*
* @var string
*/
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = '{{name}}';

/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
{{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}},
{{/-last}}{{/vars}}
];

/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}},
{{/-last}}{{/vars}}
];

/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
{{/-last}}{{/vars}}
];

/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];

/**
Expand Down Expand Up @@ -251,14 +251,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}

/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@ public function getHostSettings(): array
}

/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
{
if (null === $variables) {
Expand Down
Loading
Loading