CloudFlare\Api::__construct PHP Method

__construct() public method

Make a new instance of the API client This can be done via providing the email address and api key as seperate parameters or by passing in an already instantiated object from which the details will be extracted
public __construct ( )
    public function __construct()
    {
        $num_args = func_num_args();
        if ($num_args === 1) {
            $parameters = func_get_args();
            $client = $parameters[0];
            $this->email = $client->email;
            $this->auth_key = $client->auth_key;
            $this->curl_options = $client->curl_options;
        } elseif ($num_args === 2) {
            $parameters = func_get_args();
            $this->email = $parameters[0];
            $this->auth_key = $parameters[1];
        }
    }

Usage Example

Example #1
0
 public function __construct($key)
 {
     parent::__construct($key);
     // 5 seconds is too low for admin operations like full_zone_set
     $this->setCurlOption(CURLOPT_TIMEOUT, 20);
 }