Skip to content

Commit

Permalink
spacing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Jun 20, 2022
1 parent c0b79ac commit 341d654
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions templates/php/base/requests/params.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
$params = [];
{% if method.parameters.all | length %}
{% for parameter in method.parameters.all %}
{% if parameter.required %}
if (!isset(${{ parameter.name | caseCamel | escapeKeyword }})) {
throw new {{spec.title | caseUcfirst}}Exception('Missing required parameter: "{{ parameter.name | caseCamel | escapeKeyword }}"');
}
{% endif %}
{% endfor %}

{% for parameter in method.parameters.query %}
if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) {
$params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }};
Expand All @@ -22,4 +23,5 @@
if (!is_null(${{ parameter.name | caseCamel | escapeKeyword }})) {
$params['{{ parameter.name }}'] = ${{ parameter.name | caseCamel | escapeKeyword }};
}
{% endfor %}
{% endfor %}
{% endif %}
2 changes: 0 additions & 2 deletions templates/php/src/Services/Service.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ class {{ service.name | caseUcfirst }} extends Service
public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {{ method | getReturn }}
{
$path = str_replace([{% for parameter in method.parameters.path %}'{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}'{% if not loop.last %}, {% endif %}{% endfor %}], [{% for parameter in method.parameters.path %}${{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %}, {% endif %}{% endfor %}], '{{ method.path }}');
$params = [];
{{ include('php/base/requests/params.twig') }}
{% if 'multipart/form-data' in method.consumes %}
{{ include('php/base/requests/file.twig') }}
{% else %}
Expand Down

0 comments on commit 341d654

Please sign in to comment.