Spaces:
No application file
No application file
File size: 1,813 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
<?php
namespace MauticPlugin\MauticFullContactBundle\Services;
use MauticPlugin\MauticFullContactBundle\Exception\ApiException;
use MauticPlugin\MauticFullContactBundle\Exception\BaseException;
class FullContact_API extends FullContact_Person
{
public function __construct(string $api_key)
{
parent::__construct($api_key);
trigger_error('The FullContactAPI class has been deprecated. Please use FullContact instead.', E_USER_NOTICE);
}
/**
* Instead of using this implementation, you should create a
* FullContact_Person class and use the lookup method you prefer.
*
* @deprecated
*
* @param string $search - Search Term (Could be an email address or a phone number,
* depending on the specified search type)
* @param string $type - Search Type (Specify the API search method to use.
* E.g. email -- tested with email and phone)
* @param int $timeout
*
* @return array - All information associated with this email address
*/
public function doLookup($search = null, $type = 'email', $timeout = 30)
{
if (is_null($search)) {
throw new BaseException('To search, you must supply a search term.');
}
match ($type) {
'email' => $this->lookupByEmail($search),
'phone' => $this->lookupByPhone($search),
'twitter' => $this->lookupByTwitter($search),
default => throw new ApiException("UnsupportedLookupMethodException: Invalid lookup method specified [{$type}]"),
};
$result = json_decode($this->response_json, true);
$result['is_error'] = !in_array($this->response_code, [200, 201, 204], true);
return $result;
}
}
|