Skip to content

Commit 450609f

Browse files
author
Roman Dubrovin
committed
#29: fixed using deprecated functions
1 parent 88a257e commit 450609f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Services/SwaggerService.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Container\Container;
66
use Illuminate\Http\Request;
7+
use Illuminate\Support\Arr;
78
use Illuminate\Support\Str;
89
use Minime\Annotations\Interfaces\AnnotationsBagInterface;
910
use Minime\Annotations\Reader as AnnotationReader;
@@ -159,7 +160,7 @@ protected function prepareItem()
159160
$this->uri = "/{$this->getUri()}";
160161
$this->method = strtolower($this->request->getMethod());
161162

162-
if (empty(array_get($this->data, "paths.{$this->uri}.{$this->method}"))) {
163+
if (empty(Arr::get($this->data, "paths.{$this->uri}.{$this->method}"))) {
163164
$this->data['paths'][$this->uri][$this->method] = [
164165
'tags' => [],
165166
'consumes' => [],
@@ -189,7 +190,7 @@ protected function getPathParams()
189190

190191
preg_match_all('/{.*?}/', $this->uri, $params);
191192

192-
$params = array_collapse($params);
193+
$params = Arr::collapse($params);
193194

194195
$result = [];
195196

@@ -309,7 +310,7 @@ protected function saveGetRequestParameters($rules, AnnotationsBagInterface $ann
309310

310311
$description = $annotations->get($parameter, implode(', ', $validation));
311312

312-
$existedParameter = array_first($this->item['parameters'], function ($existedParameter, $key) use ($parameter) {
313+
$existedParameter = Arr::first($this->item['parameters'], function ($existedParameter, $key) use ($parameter) {
313314
return $existedParameter['name'] == $parameter;
314315
});
315316

@@ -424,7 +425,7 @@ protected function requestHasBody()
424425
{
425426
$parameters = $this->data['paths'][$this->uri][$this->method]['parameters'];
426427

427-
$bodyParamExisted = array_where($parameters, function ($value, $key) {
428+
$bodyParamExisted = Arr::where($parameters, function ($value, $key) {
428429
return $value['name'] == 'body';
429430
});
430431

@@ -451,7 +452,7 @@ public function getConcreteRequest()
451452
$route->parametersWithoutNulls(), $instance, $method
452453
);
453454

454-
return array_first($parameters, function ($key, $parameter) {
455+
return Arr::first($parameters, function ($key, $parameter) {
455456
return preg_match('/Request/', $key);
456457
});
457458
}
@@ -472,7 +473,7 @@ public function saveTags()
472473

473474
$explodedUri = explode('/', $this->uri);
474475

475-
$tag = array_get($explodedUri, $tagIndex);
476+
$tag = Arr::get($explodedUri, $tagIndex);
476477

477478
$this->item['tags'] = [$tag];
478479
}
@@ -614,17 +615,17 @@ protected function replaceObjectValues($parameters)
614615
File::class => '[uploaded_file]',
615616
];
616617

617-
$parameters = array_dot($parameters);
618+
$parameters = Arr::dot($parameters);
618619
$returnParameters = [];
619620

620621
foreach ($parameters as $parameter => $value) {
621622
if (is_object($value)) {
622623
$class = get_class($value);
623624

624-
$value = array_get($classNamesValues, $class, $class);
625+
$value = Arr::get($classNamesValues, $class, $class);
625626
}
626627

627-
array_set($returnParameters, $parameter, $value);
628+
Arr::set($returnParameters, $parameter, $value);
628629
}
629630

630631
return $returnParameters;

0 commit comments

Comments
 (0)