<?php
namespace App\Service\CpanelApi\Adapter;
use App\Service\NcPlugin\PluginException;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
class WebAdapter implements AdapterInterface
{
public function __construct(
#[Autowire(service: 'cpanel')]
private readonly \CPANEL $cpanel
) {}
/**
* @throws PluginException
*/
public function call($module, $func, array $args = []): array
{
if (!$this->cpanel) {
throw new PluginException('CPanel service not initialized');
}
return $this->cpanel->uapi($module, $func, $args);
}
/**
* @throws PluginException
*/
public function callApi2($module, $func, array $args = []): array
{
if (!$this->cpanel) {
throw new PluginException('CPanel service not initialized');
}
return $this->cpanel->api2($module, $func, $args);
}
}