Skip to content

Method: Check

Alejandro Mostajo edited this page Sep 7, 2019 · 1 revision

check() requests the validate endpoint and returns the response. In comparison to the validate() method, check() does not validate the license string or perform retries.

Call and parameters

$response = Api::check($client, $getClosure, $setClosure);

Parameters

Parameter Type Description
$client Client An instance of the client.
$getClosure Closure (callable on php5) A function that should return an instance of LicenseRequest.
$setClosure Closure (callable on php5) A function used removed and delete the activated license string.

Returns

Type Description
null If response is empty.
object The decoded response as an object. Use $response->error to check if response had an error. Use $response->errors for the list of errors. Use $response->message for the message returned by the API.

Usage

The following example will show how to deactivate a license key and how to delete the stored license string.

$response = Api::check(
    Client::instance(), // Client instance
    function() {

        // ---------------------------------------------
        // Code here...
        // Code to load the LICENSE STRING saved on activation.
        // Apply decryption if necessary.
        // ---------------------------------------------

        // MUST RETURN AN INSTANCE OF LicenseRequest

        return new LicenseRequest($licenseString);

    }, // getClosure
    function($licenseString) {

        // ---------------------------------------------
        // Code here...
        // Code to update the LICENSE STRING saved on activation.
        // Apply encryption if necessary.
        // ---------------------------------------------
        
        // as sample
        update_license($licenseString);

    } // setClosure
);
Clone this wiki locally