add client factory, Sms wrapper, further configuration options
This commit is contained in:
66
src/Application/Model/Configuration.php
Normal file
66
src/Application/Model/Configuration.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Linkmobility4OXID\Application\Model;
|
||||
|
||||
use Assert\Assert;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class Configuration
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiToken(): string
|
||||
{
|
||||
$token = trim(Registry::getConfig()->getConfigParam('d3linkmobility_apitoken'));
|
||||
|
||||
Assert::that($token)->string()->notEmpty();
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getTestMode(): bool
|
||||
{
|
||||
return (bool) Registry::getConfig()->getConfigParam( 'd3linkmobility_debug');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSmsSenderNumber(): string
|
||||
{
|
||||
$number = trim(Registry::getConfig()->getConfigParam('d3linkmobility_smsSenderNumber'));
|
||||
|
||||
Assert::that($number)->string()->notEmpty();
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSmsSenderCountry(): string
|
||||
{
|
||||
$country = trim(Registry::getConfig()->getConfigParam('d3linkmobility_smsSenderCountry'));
|
||||
|
||||
Assert::that($country)->string()->length(2);
|
||||
|
||||
return strtoupper($country);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user