Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Removed calling deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed Mar 3, 2021
1 parent 65cd8cd commit 354d8c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": "^7.2.5|^8.0",
"ext-json": "*",
"andrey-helldar/support": "2.8.0",
"andrey-helldar/support": "^2.16.2",
"symfony/http-foundation": "^4.0|^5.0"
},
"require-dev": {
Expand Down
9 changes: 3 additions & 6 deletions src/Parsers/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Helldar\ApiResponse\Parsers;

use Exception as BaseException;
use Helldar\Support\Facades\Helpers\Call;
use Helldar\Support\Facades\Helpers\Instance;
use Throwable;

Expand All @@ -28,11 +29,7 @@ public function getStatusCode(): int
return $this->status_code;
}

if ($code = Instance::callWhen($this->data, ['getStatusCode', 'getCode'], 400)) {
return $code;
}

return parent::getStatusCode();
return Call::runMethods($this->data, ['getStatusCode', 'getCode']) ?: 400;
}

/**
Expand All @@ -41,7 +38,7 @@ public function getStatusCode(): int
protected function getThrowableContent()
{
return Instance::of($this->data, [BaseException::class, Throwable::class])
? Instance::callWhen($this->data, ['getOriginalContent', 'getContent', 'getResponse', 'getMessage'])
? Call::runMethods($this->data, ['getOriginalContent', 'getContent', 'getResponse', 'getMessage'])
: null;
}
}

0 comments on commit 354d8c1

Please sign in to comment.