解密数据
@param  string $endata 加密的字符串
@param  string $key 密钥
@param  array $setting 配置
@return mixed 加密的数据
@throws Exception
778707
public static function decrypt($endata, $key, array $setting = [])
    {
        if(!is_string($endata)){
            throw  new Exception(Exception::CODE_PARAM_ERROR_MSG,Exception::CODE_PARAM_VALUE_ERROR);
        }
        $setting = array_merge(Utils::CRYPT_DEFAULT, $setting);
        $data = openssl_decrypt(base64_decode($endata), $setting['cipher'], $key, $setting['options'],$setting['iv']);
        if($data === false){
            throw new Exception('Can not decrypt data',Exception::CODE_PARAM_VALUE_ERROR);
        }
        return $data;
    }
871370
public function call($endpoint, $method = 'GET', array $data = [])
    {
        if (substr($endpoint, -1) == '/') {
            $endpoint = substr($endpoint, 0, strlen($endpoint)-1);
        }
        
        self::log("Calling $method /api/$endpoint");
            
        $params = [
            'headers'=> [
                'Accept'     => sprintf('application/vnd.xac.v%d+json', self::$apiVersion),
                'AC-API-KEY' => self::$apiKey,
            ],
        ];
        
        if (count($data) > 0) {
            $params['json'] = $data;
        }
        
        try {
            $this->initTransport();
            
            $res = $this->transport->request($method, $endpoint, $params);
        } catch (ConnectException $e) {
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception($e->getMessage());
        
        } catch (ServerException $e) {
            $response = json_decode((string) $e->getResponse()->getBody(), true);
            self::$lastResponse = $response['ACResponse'];
            self::$lastResponse['httpCode'] = $e->getResponse()->getStatusCode();
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception(self::$lastResponse['message']);
        
        } catch (ClientException $e) {
            $response = json_decode((string) $e->getResponse()->getBody(), true);
            self::$lastResponse = $response['ACResponse'];
            self::$lastResponse['httpCode'] = $e->getResponse()->getStatusCode();
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception(self::$lastResponse['message']);
             
        } finally {
            if (isset($res)) {
                $response = json_decode((string) $res->getBody(), !self::$returnObject);
                $response = $response['ACResponse'];
            }
        }
        
        self::$lastResponse = $response;
        
        return $response['body']['data'];
    }
453190
public function getSetting($key)
    {
        if (!isset($this->_settings[$key])) {
            return null;
        }
        return $this->_settings[$key];
    }
496713
public function getSettingsKey(): string
    {
        $key = $this->settingsKey;

        if (empty($this->$key)) {
            throw new Exception("No settings key is set on the constructor");
        }

        return $this->$key;
    }
1044462
public function get($key, $default = null)
	{
        $value = $this->settings;
        $value = set_nested_array_value($value, $key);

        if ( ! is_null($value))
        {
            return $value;
        }

        return $default;
	}
1267149
public function getByKey($key, array $queryParams = [])
    {
        $response = $this->api->settings()->getByKey($key, $queryParams);

        return new SettingResponse($response);
    }
1101835
public function addTable(string $key) : TomlBuilder
    {
        $this->exceptionIfKeyEmpty($key);
        $addPreNewline = $this->currentLine > 0 ? true : false;
        $keyParts = explode('.', $key);

        foreach ($keyParts as $keyPart) {
            $this->exceptionIfKeyEmpty($keyPart, "Table: \"{$key}\".");
            $this->exceptionIfKeyIsNotUnquotedKey($keyPart);
        }

        $line = "[{$key}]";
        $this->addTableKey($key);
        $this->append($line, true, false, $addPreNewline);

        return $this;
    }
12766
private function get_detail_setting( $setting, $data ) {
		$data['key'] = $setting;
		$type        = $this->app->utility->array_get( $data, 'type', '' );
		$default     = $this->app->utility->array_get( $data, 'default', '' );
		if ( is_callable( $default ) ) {
			$default = $default( $this->app );
		}
		$default = $this->get_expression( $default, $type );
		if ( ! empty( $data['translate'] ) ) {
			$default = $this->app->translate( $default );
		}
		$data['info'] = [];
		if ( '' !== $default ) {
			$data['info'][] = $this->app->translate( 'default' ) . ' = ' . $default;
		}
		if ( isset( $data['min'] ) ) {
			$data['info'][] = $this->app->translate( 'min' ) . ' = ' . $this->get_expression( $data['min'], $type );
		}
		if ( isset( $data['max'] ) ) {
			$data['info'][] = $this->app->translate( 'max' ) . ' = ' . $this->get_expression( $data['max'], $type );
		}
		$data['name']        = $this->get_filter_prefix() . $data['key'];
		$data['saved']       = $this->app->get_option( $data['name'] );
		$data['placeholder'] = $default;
		$value               = $this->apply_filters( $data['key'], $default );
		$data['value']       = $value;
		$data['used']        = $this->get_expression( $value, $type );

		return $data;
	}
169919
function get($key, $default = null)
    {
        $key = $this->_normalizeKey($key);

        $properties = &$this->_referDataArrayReference();

        // avoid recursive trait call, may conflict on classes that
        // implement in this case has() method
        /*if (
            !array_key_exists($key, $properties)
            && $default === null
        )
            throw new \Exception(sprintf(
                'Property (%s) not found in entity.', $key
            ));*/

        return (array_key_exists($key, $properties))
            ? $properties[$key]
            : $default;
    }
1330566
public function setting($setting = []) {
		
		/*
		 * 指定某一个服务运行仅设置该服务下的配置
		 */
		$setting = $this->config[$this->service];
		unset($setting['host'], $setting['port'], $setting['sync'], $setting['socket']);
		parent::set($setting);
	}
712848
public function lgetrange($key, $start, $end)
    {
        try {
            return $this->redis->lgetrange($key, $start, $end);
        } catch (\RedisException $e) {
            die("Error!: " . $e->getMessage() . "<br/>");
        }
    }
719665
public function bitPos($key, $bit, $start = null, $end = null) {
        $payload = ['bitpos', $key, $bit];

        if ($start !== null) {
            $payload[] = $start;

            if ($end !== null) {
                $payload[] = $end;
            }
        }

        return $this->send($payload);
    }
516085
public function endTiming($key, $sampleRate = 1)
    {
        $end = gettimeofday(true);
        if (isset($this->timings[$key])) {
            $timing = ($end - $this->timings[$key]) * 1000;
            $this->timing($key, $timing, $sampleRate);
            unset($this->timings[$key]);
            return $timing;
        }
        return null;
    }
445230
public function addSetting($name, $settings, $key = null)
	{
		$value = $this->settingExists($name,$key) ? $this->getSetting($name, $key) : null;

		if(is_array($settings))
		{
			$settings = array_merge((array)$value, $settings);
		}

		if($key)
		{
			$this->_settings[$name][$key] = $settings;
		}
		else
		{
			$this->_settings[$name] = $settings;
		}

		return $this;
	}
732457
public function setup($data) {

    if (is_object($data[0])) {
      $data = Converter::toArray($data[0]);
    }

    foreach ($data as $k => $d) {
      if (!in_array($k,array("token","expires"))) {
        throw new CatapultApiException("$k is not a valid key for endpoint token");
      }
    }
    $arr = array('token', 'expires');
    foreach ($arr as $a) {
      if (isset($data[$a])) {
        $this->$a = $data[$a];
      }
    }
    // important don't serialize
    // when sending in a Endpoints object
    $this->serialize = FALSE;
  }
268690
public function get($key, $default = null)
    {
        /** @var SettingsInterface[] $providers */
        $providers = array_reverse($this->settingsProviders);
        foreach ($providers as $provider) {
            if (!is_null($setting = $provider->get($key, null))) {
                return $setting;
            }
        }
        return $default;
    }
566004
public function init($setting = array())
    {
        if (!is_array($setting) || count($setting) == 0) return $this;
        foreach ($setting as $key => $value) {
            if (property_exists($this, $key)) {
                $this->$key = (string)$value;
            }
        }

        return $this;
    }