1
0
Fork 0
mirror of synced 2025-04-20 01:21:01 +00:00

add factory class

This commit is contained in:
Sergey Chazov 2020-08-31 11:18:57 +03:00
parent b4841a871d
commit b33f3e05a0

View file

@ -0,0 +1,24 @@
<?php
namespace Intaro\RetailCrm\Component\Factory;
use Bitrix\Main\Config\Option;
use Intaro\RetailCrm\Component\ApiClient\ClientAdapter;
class ClientFactory
{
/**
* @return \Intaro\RetailCrm\Component\ApiClient\ClientAdapter|null
*/
public static function creacteClientAdapter(): ?ClientAdapter
{
$apiHost = Option::get('intaro.retailcrm', 'api_host');
$apiKey = Option::get('intaro.retailcrm', 'api_key');
if (empty($apiHost) || empty($apiKey)) {
return null;
} else {
return new ClientAdapter;
}
}
}