Skip to content

Commit bd6c567

Browse files
Fix lint
1 parent 3e8a71d commit bd6c567

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/LaravelRequestDocsToOpenApi.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private function docsToOpenApi(array $docs)
3333
{
3434
$this->openApi['paths'] = [];
3535
foreach ($docs as $doc) {
36-
$requestHasFile = false;
36+
$requestHasFile = false;
3737
$httpMethod = strtolower($doc['httpMethod']);
3838
$isGet = $httpMethod == 'get';
3939
$isPost = $httpMethod == 'post';
@@ -45,21 +45,21 @@ private function docsToOpenApi(array $docs)
4545

4646
$this->openApi['paths'][$doc['uri']][$httpMethod]['responses'] = config('request-docs.open_api.responses', []);
4747

48-
foreach ($doc['rules'] as $attribute => $rules) {
48+
foreach ($doc['rules'] as $attribute => $rules) {
4949
foreach ($rules as $rule) {
50-
if ($isPost || $isPut || $isDelete) {
51-
$requestHasFile = $this->attributeIsFile($rule);
50+
if ($isPost || $isPut || $isDelete) {
51+
$requestHasFile = $this->attributeIsFile($rule);
5252

53-
if ($requestHasFile) {
54-
break 2;
55-
}
56-
}
57-
}
58-
}
53+
if ($requestHasFile) {
54+
break 2;
55+
}
56+
}
57+
}
58+
}
5959

60-
$contentType = $requestHasFile ? 'multipart/form-data' : 'application/json';
60+
$contentType = $requestHasFile ? 'multipart/form-data' : 'application/json';
6161

62-
if ($isGet) {
62+
if ($isGet) {
6363
$this->openApi['paths'][$doc['uri']][$httpMethod]['parameters'] = [];
6464
}
6565
if ($isPost || $isPut || $isDelete) {
@@ -80,10 +80,10 @@ private function docsToOpenApi(array $docs)
8080
}
8181
}
8282

83-
protected function attributeIsFile(string $rule)
84-
{
85-
return str_contains($rule, 'file') || str_contains($rule, 'image');
86-
}
83+
protected function attributeIsFile(string $rule)
84+
{
85+
return str_contains($rule, 'file') || str_contains($rule, 'image');
86+
}
8787

8888
protected function makeQueryParameterItem(string $attribute, string $rule): array
8989
{
@@ -118,12 +118,12 @@ protected function makeRequestBodyItem(string $contentType): array
118118

119119
protected function makeRequestBodyContentPropertyItem(string $rule): array
120120
{
121-
$type = $this->getAttributeType($rule);
121+
$type = $this->getAttributeType($rule);
122122

123123
return [
124124
'type' => $type,
125-
'nullable' => str_contains($rule, 'nullable'),
126-
'format' => $this->attributeIsFile($rule) ? 'binary' : $type,
125+
'nullable' => str_contains($rule, 'nullable'),
126+
'format' => $this->attributeIsFile($rule) ? 'binary' : $type,
127127
];
128128
}
129129

@@ -139,18 +139,18 @@ protected function getAttributeType(string $rule): string
139139
if (str_contains($rule, 'integer')) {
140140
return 'integer';
141141
}
142-
if (str_contains($rule, 'boolean')) {
142+
if (str_contains($rule, 'boolean')) {
143143
return 'boolean';
144144
}
145145
return "object";
146146
}
147147

148-
public function toJson() : string
148+
public function toJson(): string
149149
{
150150
return collect($this->openApi)->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
151151
}
152152

153-
public function toArray() : array
153+
public function toArray(): array
154154
{
155155
return $this->openApi;
156156
}

0 commit comments

Comments
 (0)