-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exception.php
48 lines (47 loc) · 1.93 KB
/
Exception.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Dfe\GoogleFont;
# 2015-11-17
# В документации об этом ни слова не сказано, однако в случае сбоя Google API возвращает JSON следующией структуры:
# {
# error: {
# errors: [
# {
# domain: "usageLimits",
# reason: "accessNotConfigured",
# message: "Access Not Configured. The API (Google Fonts Developer API) is not enabled for your project.Please use the Google Developers Console to update your configuration.",
# extendedHelp: "https://console.developers.google.com"
# }
# ],
# code: 403,
# message: "Access Not Configured. The API (Google Fonts Developer API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
# }
# }
# https://developers.google.com/fonts/docs/developer_api
/** @used-by \Dfe\GoogleFont\Fonts::responseA() */
final class ResponseValidator extends \Df\API\Response\Validator {
/**
* 2015-11-27
* @override
* @see \Df\API\Exception::short()
* @used-by \Df\API\Client::_p()
* @used-by \Df\API\Exception::message()
*/
function short():string {return df_cc_n("Google Fonts API error: «{$this->r('message')}».",
# 2015-11-28
# {
# domain: "usageLimits",
# reason: "accessNotConfigured",
# message: "Access Not Configured. The API (Google Fonts Developer API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
# extendedHelp: "https://console.developers.google.com"
# }
'accessNotConfigured' !== dfa(df_first($this->r('errors')), 'reason') ? '' :
"You need to setup the Google Fonts' API using the instruction https://mage2.pro/t/269"
);}
/**
* 2024-05-22 "Remove `Df\Core\Exception::$_data`": https://github.com/mage2pro/core/issues/385
* @override
* @see \Df\API\Response\Validator::valid()
* @used-by \Df\API\Client::_p()
*/
function valid():bool {return !$this->r();}
}