system/library/squareup/exception.php

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Squareup;

class Exception extends \Exception {
    const ERR_CODE_ACCESS_TOKEN_REVOKED = 'ACCESS_TOKEN_REVOKED';
    const ERR_CODE_ACCESS_TOKEN_EXPIRED = 'ACCESS_TOKEN_EXPIRED';

    private $config;
    private $log;
    private $language;
    private $errors;
    private $isCurlError;

    private $overrideFields = array(
        'billing_address.country',
        'shipping_address.country',
        'email_address',
        'phone_number'
    );

    public function __construct($registry, $errors, $is_curl_error = false) {
        $this->errors = $errors;
        $this->isCurlError = $is_curl_error;
        $this->config = $registry->get('config');
        $this->log = $registry->get('log');
        $this->language = $registry->get('language');

        $message = $this->concatErrors();

        if ($this->config->get('config_error_log')) {
            $this->log->write($message);
        }

        parent::__construct($message);
    }

    public function isCurlError() {
        return $this->isCurlError;
    }

    public function isAccessTokenRevoked() {
        return $this->errorCodeExists(self::ERR_CODE_ACCESS_TOKEN_REVOKED);
    }

    public function isAccessTokenExpired() {
        return $this->errorCodeExists(self::ERR_CODE_ACCESS_TOKEN_EXPIRED);
    }

    protected function errorCodeExists($code) {
        if (is_array($this->errors)) {
            foreach ($this->errors as $error) {
                if ($error['code'] == $code) {
                    return true;
                }
            }
        }

        return false;
    }
后面还有 33 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。