1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace FnsService \Entity ;
4
6
5
7
use FnsService \Contracts \Response ;
@@ -23,13 +25,19 @@ public function getStatus(): int
23
25
24
26
/**
25
27
* Get the error object of the response, if any.
28
+ * @param string $languages The language for error localization
26
29
* @return object|null The error object or null if not set
27
30
*/
28
- public function getError ($ languages = 'ru ' ): ?object
31
+ public function getErrors ($ languages = 'ru ' ): ?object
29
32
{
30
33
return $ this ->ERRORS ? (object )$ this ->prepareErrors ($ languages ) : null ;
31
34
}
32
35
36
+ /**
37
+ * Prepare errors for localization based on language.
38
+ * @param string $languages The language for error localization
39
+ * @return array The prepared errors array
40
+ */
33
41
private function prepareErrors ($ languages ): array
34
42
{
35
43
if ($ languages ) {
@@ -41,18 +49,18 @@ private function prepareErrors($languages): array
41
49
42
50
/**
43
51
* Get the request ID from the response.
44
- * @return mixed The request ID
52
+ * @return string|null The request ID
45
53
*/
46
- public function getRequestId ()
54
+ public function getRequestId (): ? string
47
55
{
48
56
return $ this ->requestId ;
49
57
}
50
58
51
59
/**
52
60
* Get the INN (Taxpayer Identification Number) from the response.
53
- * @return mixed The INN
61
+ * @return string|null The INN
54
62
*/
55
- public function getInn ()
63
+ public function getInn (): ? string
56
64
{
57
65
return $ this ->inn ;
58
66
}
@@ -61,8 +69,8 @@ public function getInn()
61
69
* Check if the response has an error.
62
70
* @return object|null The error object or null if no error
63
71
*/
64
- public function hasError ()
72
+ public function hasErrors (): ? object
65
73
{
66
- return $ this ->getError ();
74
+ return $ this ->getErrors ();
67
75
}
68
76
}
0 commit comments