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

Commit 354d8c1

Browse files
author
Andrey Helldar
committed
Removed calling deprecated methods
1 parent 65cd8cd commit 354d8c1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"require": {
1818
"php": "^7.2.5|^8.0",
1919
"ext-json": "*",
20-
"andrey-helldar/support": "2.8.0",
20+
"andrey-helldar/support": "^2.16.2",
2121
"symfony/http-foundation": "^4.0|^5.0"
2222
},
2323
"require-dev": {

src/Parsers/Exception.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Helldar\ApiResponse\Parsers;
44

55
use Exception as BaseException;
6+
use Helldar\Support\Facades\Helpers\Call;
67
use Helldar\Support\Facades\Helpers\Instance;
78
use Throwable;
89

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

31-
if ($code = Instance::callWhen($this->data, ['getStatusCode', 'getCode'], 400)) {
32-
return $code;
33-
}
34-
35-
return parent::getStatusCode();
32+
return Call::runMethods($this->data, ['getStatusCode', 'getCode']) ?: 400;
3633
}
3734

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

0 commit comments

Comments
 (0)