Viewing File: /usr/local/cpanel/whostmgr/docroot/cgi/ncssl/source/src/Service/Certificate/ProductManager.php
<?php
namespace App\Service\Certificate;
use App\Service\NcPlugin\PluginException;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
class ProductManager
{
public function __construct(#[Autowire(param: 'products')] private $products) { }
/**
* @throws PluginException
*/
public function isAvailable($certType)
{
$features = $this->getFeaturesByType($certType);
return $features['available'];
}
/**
* @throws PluginException
*/
public function getNameByType($certType)
{
$features = $this->getFeaturesByType($certType);
return $features['name'];
}
/**
* @throws PluginException
*/
public function isMdc($certType)
{
$features = $this->getFeaturesByType($certType);
return $features['isMdc'];
}
/**
* @throws PluginException
*/
public function isWildcard($certType)
{
$features = $this->getFeaturesByType($certType);
return $features['isWildcard'];
}
/**
* @throws PluginException
*/
public function isDV($certType): bool
{
$features = $this->getFeaturesByType($certType);
return $features['validation'] == 'dv';
}
/**
* @throws PluginException
*/
public function getCaName($certType)
{
$features = $this->getFeaturesByType($certType);
return $features['ca'];
}
/**
* @throws PluginException
*/
public function getFeaturesByType($certType)
{
if (empty($certType)) {
throw new \InvalidArgumentException('Certificate type not specified');
}
$certType = strtolower(trim($certType));
if (empty($this->products[$certType])) {
throw new PluginException('Unknown certificate type');
};
return $this->products[$certType];
}
}
Back to Directory
File Manager