Skip to content

Commit

Permalink
#29: fixed using deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Dubrovin committed Oct 29, 2019
1 parent 88a257e commit 450609f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/Services/SwaggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Container\Container;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Minime\Annotations\Interfaces\AnnotationsBagInterface;
use Minime\Annotations\Reader as AnnotationReader;
Expand Down Expand Up @@ -159,7 +160,7 @@ protected function prepareItem()
$this->uri = "/{$this->getUri()}";
$this->method = strtolower($this->request->getMethod());

if (empty(array_get($this->data, "paths.{$this->uri}.{$this->method}"))) {
if (empty(Arr::get($this->data, "paths.{$this->uri}.{$this->method}"))) {
$this->data['paths'][$this->uri][$this->method] = [
'tags' => [],
'consumes' => [],
Expand Down Expand Up @@ -189,7 +190,7 @@ protected function getPathParams()

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

$params = array_collapse($params);
$params = Arr::collapse($params);

$result = [];

Expand Down Expand Up @@ -309,7 +310,7 @@ protected function saveGetRequestParameters($rules, AnnotationsBagInterface $ann

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

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

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

$bodyParamExisted = array_where($parameters, function ($value, $key) {
$bodyParamExisted = Arr::where($parameters, function ($value, $key) {
return $value['name'] == 'body';
});

Expand All @@ -451,7 +452,7 @@ public function getConcreteRequest()
$route->parametersWithoutNulls(), $instance, $method
);

return array_first($parameters, function ($key, $parameter) {
return Arr::first($parameters, function ($key, $parameter) {
return preg_match('/Request/', $key);
});
}
Expand All @@ -472,7 +473,7 @@ public function saveTags()

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

$tag = array_get($explodedUri, $tagIndex);
$tag = Arr::get($explodedUri, $tagIndex);

$this->item['tags'] = [$tag];
}
Expand Down Expand Up @@ -614,17 +615,17 @@ protected function replaceObjectValues($parameters)
File::class => '[uploaded_file]',
];

$parameters = array_dot($parameters);
$parameters = Arr::dot($parameters);
$returnParameters = [];

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

$value = array_get($classNamesValues, $class, $class);
$value = Arr::get($classNamesValues, $class, $class);
}

array_set($returnParameters, $parameter, $value);
Arr::set($returnParameters, $parameter, $value);
}

return $returnParameters;
Expand Down

0 comments on commit 450609f

Please sign in to comment.