发送API请求.

允许重复发送请求.

@return null|array 请求参数错误将返回null
435450
public function send()
    {
        $ch = curl_init($this->requestUrl);

        $cOptions = array(
            CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_URL => $this->requestUrl,
            CURLOPT_POSTFIELDS => $this->data
        );
        curl_setopt_array($ch, $cOptions);
        $ret = curl_exec($ch);
        curl_close($ch);

        return $this->parseReturnData($ret);
    }
816811
public function jsonSerialize() {
    $valid = (!isset($this->textColor) ||
        $this->validateTextColor($this->textColor)) &&
      (!isset($this->backgroundColor) ||
        $this->validateBackgroundColor($this->backgroundColor));
    if (!$valid) {
      return NULL;
    }
    return parent::jsonSerialize();
  }
283757
protected function getResponse(){

        $post = false;

        // use output parameter if required by the service
        $this->requestUrl.= $this->service['endpoint']
                            ? $this->endpoint
                            : '';

        // set API Key
        $this->requestUrl.= 'key='.urlencode( $this->key );


        switch( $this->service['type'] ){

            case 'POST':

                    $post =  json_encode( $this->service['param'] );

                break;


            case 'GET':
            default:
                    $this->requestUrl.='&'. Parameters::getQueryString( $this->service['param'] );
                break;
        }


        return $this->make( $post );

    }
422193
protected function getParams()
    {
        $params = ["key=".$this->apiKey];
        if (@count($this->options[0]) > 0 && is_array($this->options[0])) {
            foreach ($this->options[0] as $k => $v) {
                if ($k != "response_type" && $k != "apiKey") {
                    array_push($params, "$k=$v");
                }
            }
        }
        return $params;
    }
20873
public function getInfo()
	{
		if ($this->error || !$this->sql) {
			return null;
		}

		$query = 'EXPLAIN FORMAT=JSON ' . $this->sql;
		$query = $this->db->getPdo()->query($query);

		$data = [];
		if ($query) {
			$data = $query->fetch();
		}

		$data = Json::decode($data['EXPLAIN'] ?? '[]');

		return Dumper::toHtml($data, [
			Dumper::COLLAPSE => true,
			Dumper::DEPTH => 6,
		]);
	}
77692
public function getStatus()
	{
		$response = $this->parent->send(new Request($this->uri->withPath($this->uri->getPath().'operations/'
			.$this->getIdentifier()), 'GET'));

		if ($response->getStatusCode() == 200)
		{
			$response = json_decode($response->getBody(), true);

			if (isset($response['status']))
			{
				return $response['status'];
			}
		}

		return null;
	}
80775
public function jsonSerialize()
    {
        $data = $this->getData();
        if (empty($data)) {
            return null;
        }
        foreach (array_keys(static::FOREIGN_KEYS) as $column) {
            $data[$column] = $this->__get($column);
        }
        return $data;
    }
1218946
public function notFound()
    {
        if (isset($this->request->path_array[1])) {
            switch ($this->request->path_array[1]) {
                case 'methods':
                    return $this->getMethods(true);
                    break;
            }
        }

        return null;
    }
635787
public function getLocation()
    {

        if (! $apiKey = $this->getApiKey()) {
            return null;
        }

        $ip = $this->configHelper->getClientIp();

        // try getting location from cache
        $cacheIdentifier = md5(self::CACHE_PREFIX.$ip);
        $locationJson = $this->cache->load($cacheIdentifier);

        // if found return it
        if ($locationJson) {
            return $locationJson;
        }

        // otherwise call the API
        $locationJson = $this->getLocationJson($ip, $apiKey);

        // if no error cache it and return it
        if ($locationJson) {
            $this->cache->save($locationJson, $cacheIdentifier, [], 86400);
            return $locationJson;
        }

        return null;
    }
950264
public function getAuctionApi()
    {
        if (!$this->apis->has('auction')) {
            $this->apis->set('auction', new Auction($this));
        }

        return $this->apis->get('auction');
    }
712732
public function jsonSerialize()
    {
        return array_filter(
            [
                'type' => $this->getType(),
                'value' => $this->getValue()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
480304
public function jsonSerialize()
    {
        return array_filter(
            [
                'name' => $this->getName(),
                'email' => $this->getEmail()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
125165
public function getRequest()
    {
        if (isset($_SERVER['REQUEST_METHOD'])) {
            return new PhpRequest(
                empty($_SESSION) ? [] : $_SESSION,
                empty($_COOKIE) ? [] : $_COOKIE,
                getallheaders(),
                $_SERVER,
                static::getInputParams($_SERVER, $_POST)
            );
        }

        return new NullRequest();
    }
830519
private function load()
    {
        if ($this->users) {
            return null;
        }
        $content = $this->io->load();
        $this->users = [];
        foreach (explode("\n", $content) as $line) {
            $line = trim($line);
            if ($line !== '') {
                $user = User::loadFromFileLine($line);
                if ($user === null) {
                    return $this->invalid();
                }
                $this->users[$user->getName()] = $user;
            }
        }
        return null;
    }
1052877
public function jsonSerialize()
    {
        return array_filter(
            [
                'click_tracking' => $this->getClickTracking(),
                'open_tracking' => $this->getOpenTracking(),
                'subscription_tracking' => $this->getSubscriptionTracking(),
                'ganalytics' => $this->getGanalytics()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
1157513
public function getArray()
    {
        $address = $two = [];

        $two[] = $this->post_code ?: '';
        $two[] = $this->city      ?: '';
        $two[] = $this->state     ? '('. $this->state .')' : '';

        $address[] = $this->street       ?: '';
        $address[] = $this->street_extra ?: '';
        $address[] = implode(' ', array_filter($two));
        $address[] = $this->country_name ?: '';

        if (count($address = array_filter($address)) > 0)
            return $address;

        return null;
    }
948872
public function executeCallback()
    {
        if (method_exists($this->callbackObject, $this->callbackFunction)) {
            return call_user_func_array(array($this->callbackObject, $this->callbackFunction), $this->callbackParameters);
        }

        return null;
    }