[
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\n\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"monthly\"\n    groups:\n      main:\n        patterns:\n          - \"*\"\n    commit-message:\n      prefix: \"TECH Dependabot [github-actions] \"\n\n  - package-ecosystem: \"composer\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n    commit-message:\n      prefix: \"TECH Dependabot [composer] \"\n"
  },
  {
    "path": ".github/workflows/test.yml",
    "content": "name: Tests\n\non:\n  push:\n    branches:\n      - master\n  pull_request:\n\njobs:\n  test:\n    runs-on: ubuntu-24.04\n    steps:\n      - uses: actions/checkout@v6\n      - run: docker compose run tests\n      - uses: codecov/codecov-action@v6\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": "/.env\n/vendor/\n/phpunit.xml\n/.phpunit.result.cache\n/coverage.xml\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM php:8.2-cli\n\nRUN apt-get update \\\n    && apt-get install -y unzip \\\n    && docker-php-ext-install pcntl \\\n    && pecl install xdebug \\\n    && echo \"zend_extension=xdebug.so\" > /usr/local/etc/php/conf.d/xdebug.ini \\\n    && echo \"xdebug.mode=coverage\" >> /usr/local/etc/php/conf.d/xdebug.ini \\\n    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 1999-2025. WebPros International GmbH.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "## PHP library for Plesk XML-RPC API\n\n[![Test Status](https://github.com/plesk/api-php-lib/actions/workflows/test.yml/badge.svg)](https://github.com/plesk/api-php-lib/actions/workflows/test.yml)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/plesk/api-php-lib/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/plesk/api-php-lib/?branch=master)\n[![codecov](https://codecov.io/gh/plesk/api-php-lib/branch/master/graph/badge.svg?token=5Kwbddpdeb)](https://codecov.io/gh/plesk/api-php-lib)\n\nPHP object-oriented library for Plesk XML-RPC API.\n\n## Install Via Composer\n\n[Composer](https://getcomposer.org/) is a preferable way to install the library:\n\n`composer require plesk/api-php-lib`\n\n## Usage Examples\n\nHere is an example on how to use the library and create a customer with desired properties:\n```php\n$client = new \\PleskX\\Api\\Client($host);\n$client->setCredentials($login, $password);\n\n$client->customer()->create([\n    'cname' => 'Plesk',\n    'pname' => 'John Smith',\n    'login' => 'john',\n    'passwd' => 'secret',\n    'email' => 'john@smith.com',\n]);\n```\n\nIt is possible to use a secret key instead of password for authentication.\n\n```php\n$client = new \\PleskX\\Api\\Client($host);\n$client->setSecretKey($secretKey)\n```\n\nIn case of Plesk extension creation one can use an internal mechanism to access XML-RPC API. It does not require to pass authentication because the extension works in the context of Plesk.\n\n```php\n$client = new \\PleskX\\Api\\InternalClient();\n$protocols = $client->server()->getProtos();\n```\n\nFor additional examples see tests/ directory.\n\n## How to Run Unit Tests\n\nOne the possible ways to become familiar with the library is to check the unit tests.\n\nTo run the unit tests use the following command:\n\n`REMOTE_HOST=your-plesk-host.dom REMOTE_PASSWORD=password composer test`\n\nTo use custom port one can provide a URL (e.g. for Docker container):\n\n`REMOTE_URL=https://your-plesk-host.dom:port REMOTE_PASSWORD=password composer test`\n\nOne more way to run tests is to use Docker:\n\n`docker-compose run tests`\n\n## Continuous Testing\n\nDuring active development it could be more convenient to run tests in continuous manner. Here is the way how to achieve it:\n\n`REMOTE_URL=https://your-plesk-host.dom:port REMOTE_PASSWORD=password composer test:watch`\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"plesk/api-php-lib\",\n    \"type\": \"library\",\n    \"description\": \"PHP object-oriented library for Plesk XML-RPC API\",\n    \"license\": \"Apache-2.0\",\n    \"authors\": [\n        {\n            \"name\": \"Alexei Yuzhakov\",\n            \"email\": \"sibprogrammer@gmail.com\"\n        },\n        {\n            \"name\": \"WebPros International GmbH.\",\n            \"email\": \"plesk-dev-leads@plesk.com\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"^7.4 || ^8.0\",\n        \"ext-curl\": \"*\",\n        \"ext-xml\": \"*\",\n        \"ext-simplexml\": \"*\",\n        \"ext-dom\": \"*\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"^9\",\n        \"spatie/phpunit-watcher\": \"^1.22\",\n        \"vimeo/psalm\": \"^4.10 || ^5.0\",\n        \"squizlabs/php_codesniffer\": \"^3.6 || ^4.0\"\n    },\n    \"config\": {\n        \"process-timeout\": 0,\n        \"platform\": {\n            \"php\": \"7.4.27\"\n        }\n    },\n    \"scripts\": {\n        \"test\": \"phpunit\",\n        \"test:watch\": \"phpunit-watcher watch\",\n        \"lint\": [\n            \"psalm\",\n            \"phpcs\"\n        ]\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"PleskX\\\\\": \"src/\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"PleskXTest\\\\\": \"tests/\"\n        }\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"2.0.x-dev\"\n        }\n    }\n}\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "# Copyright 1999-2025. WebPros International GmbH.\nversion: '3'\nservices:\n  plesk:\n    image: plesk/plesk:latest\n    logging:\n      driver: none\n    ports:\n      [\"8443:8443\"]\n    tmpfs:\n      - /tmp\n      - /run\n      - /run/lock\n    volumes:\n      - /sys/fs/cgroup:/sys/fs/cgroup\n    cgroup: host\n  tests:\n    build: .\n    environment:\n      REMOTE_URL: https://plesk:8443\n      REMOTE_PASSWORD: changeme1Q**\n    command: >\n      bash -c \"cd /opt/api-php-lib\n      && composer install\n      && ./wait-for-plesk.sh\n      && composer lint\n      && composer test -- --testdox\"\n    depends_on:\n      - plesk\n    links:\n      - plesk\n    volumes:\n      - .:/opt/api-php-lib\n"
  },
  {
    "path": "phpcs.xml.dist",
    "content": "<?xml version=\"1.0\"?>\n<!-- Copyright 1999-2025. WebPros International GmbH. -->\n<ruleset name=\"PHP library for Plesk XML-RPC API\">\n    <file>src</file>\n    <file>tests</file>\n    <rule ref=\"Generic\">\n        <exclude name=\"Generic.WhiteSpace.DisallowSpaceIndent\"/>\n        <exclude name=\"Generic.Files.EndFileNoNewline\"/>\n        <exclude name=\"Generic.Files.LowercasedFilename.NotFound\"/>\n        <exclude name=\"Generic.PHP.RequireStrictTypes\"/>\n        <exclude name=\"Generic.PHP.ClosingPHPTag\"/>\n        <exclude name=\"Generic.PHP.UpperCaseConstant\"/>\n        <exclude name=\"Generic.Arrays.DisallowShortArraySyntax\"/>\n        <exclude name=\"Generic.Classes.OpeningBraceSameLine\"/>\n        <exclude name=\"Generic.Functions.OpeningFunctionBraceKernighanRitchie\"/>\n        <exclude name=\"Generic.Formatting.MultipleStatementAlignment\"/>\n        <exclude name=\"Generic.Formatting.SpaceBeforeCast\"/>\n        <exclude name=\"Generic.Formatting.SpaceAfterNot\"/>\n        <exclude name=\"Generic.Commenting.DocComment\"/>\n        <exclude name=\"Generic.ControlStructures.DisallowYodaConditions\"/>\n    </rule>\n    <rule ref=\"PSR1\"/>\n    <rule ref=\"PSR2\"/>\n    <rule ref=\"PSR12\">\n        <exclude name=\"PSR12.Files.FileHeader\"/>\n    </rule>\n</ruleset>\n"
  },
  {
    "path": "phpunit-watcher.yml",
    "content": "# Copyright 1999-2025. WebPros International GmbH.\nphpunit:\n  arguments: '--stop-on-failure'\n  timeout: 0\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Copyright 1999-2025. WebPros International GmbH. -->\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/9.3/phpunit.xsd\" bootstrap=\"vendor/autoload.php\" verbose=\"true\" colors=\"true\">\n  <coverage processUncoveredFiles=\"true\">\n    <include>\n      <directory suffix=\".php\">./src</directory>\n    </include>\n    <report>\n      <clover outputFile=\"coverage.xml\"/>\n    </report>\n  </coverage>\n  <testsuites>\n    <testsuite name=\"E2E\">\n      <directory>./tests</directory>\n    </testsuite>\n  </testsuites>\n  <php>\n    <ini name=\"error_reporting\" value=\"-1\"/>\n    <env name=\"REMOTE_URL\" value=\"\"/>\n    <env name=\"REMOTE_PASSWORD\" value=\"\"/>\n  </php>\n  <logging/>\n</phpunit>\n"
  },
  {
    "path": "psalm.xml",
    "content": "<?xml version=\"1.0\"?>\n<!-- Copyright 1999-2025. WebPros International GmbH. -->\n<psalm\n    errorLevel=\"3\"\n    resolveFromConfigFile=\"true\"\n    findUnusedBaselineEntry=\"true\"\n    findUnusedCode=\"false\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xmlns=\"https://getpsalm.org/schema/config\"\n    xsi:schemaLocation=\"https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd\"\n>\n    <projectFiles>\n        <directory name=\"src\" />\n        <ignoreFiles>\n            <directory name=\"vendor\" />\n        </ignoreFiles>\n    </projectFiles>\n\n    <issueHandlers>\n        <PropertyNotSetInConstructor errorLevel=\"suppress\" />\n        <UndefinedPropertyFetch errorLevel=\"suppress\" />\n    </issueHandlers>\n</psalm>\n"
  },
  {
    "path": "src/Api/AbstractStruct.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\nabstract class AbstractStruct\n{\n    /**\n     * @param string $property\n     * @param mixed $value\n     *\n     * @throws \\Exception\n     */\n    public function __set(string $property, $value)\n    {\n        throw new \\Exception(\"Try to set an undeclared property '$property' to a value: $value.\");\n    }\n\n    /**\n     * Initialize list of scalar properties by response.\n     *\n     * @param \\SimpleXMLElement $apiResponse\n     * @param array $properties\n     *\n     * @throws \\Exception\n     */\n    protected function initScalarProperties(\\SimpleXMLElement $apiResponse, array $properties): void\n    {\n        foreach ($properties as $property) {\n            if (is_array($property)) {\n                $classPropertyName = current($property);\n                $value = $apiResponse->{key($property)};\n            } else {\n                /** @psalm-suppress PossiblyInvalidArgument */\n                $classPropertyName = $this->underToCamel(str_replace('-', '_', $property));\n                $value = $apiResponse->$property;\n            }\n\n            $reflectionProperty = new \\ReflectionProperty($this, $classPropertyName);\n            $propertyType = $reflectionProperty->getType();\n            if (is_null($propertyType)) {\n                $docBlock = $reflectionProperty->getDocComment();\n                $propertyType = preg_replace('/^.+ @var ([a-z]+) .+$/', '\\1', $docBlock);\n            } else {\n                /** @psalm-suppress UndefinedMethod */\n                $propertyType = $propertyType->getName();\n            }\n\n            if ('string' == $propertyType) {\n                $value = (string) $value;\n            } elseif ('int' == $propertyType) {\n                $value = (int) $value;\n            } elseif ('bool' == $propertyType) {\n                $value = in_array((string) $value, ['true', 'on', 'enabled']);\n            } else {\n                throw new \\Exception(\"Unknown property type '$propertyType'.\");\n            }\n\n            $this->$classPropertyName = $value;\n        }\n    }\n\n    /**\n     * Convert underscore separated words into camel case.\n     *\n     * @param string $under\n     *\n     * @return string\n     */\n    private function underToCamel(string $under): string\n    {\n        $under = '_' . str_replace('_', ' ', strtolower($under));\n\n        return ltrim(str_replace(' ', '', ucwords($under)), '_');\n    }\n}\n"
  },
  {
    "path": "src/Api/Client/Exception.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Client;\n\n/**\n * Transport layer exception.\n */\nclass Exception extends \\Exception\n{\n}\n"
  },
  {
    "path": "src/Api/Client.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\nuse DOMDocument;\nuse SimpleXMLElement;\n\n/**\n * Client for Plesk XML-RPC API.\n */\nclass Client\n{\n    public const RESPONSE_SHORT = 1;\n    public const RESPONSE_FULL = 2;\n\n    private string $host;\n    private int $port;\n    private string $protocol;\n    protected string $login = '';\n    private string $password = '';\n    private string $proxy = '';\n    private string $secretKey = '';\n    private string $version = '';\n\n    protected array $operatorsCache = [];\n\n    /**\n     * @var callable|null\n     */\n    protected $verifyResponseCallback;\n\n    /**\n     * Create client.\n     *\n     * @param string $host\n     * @param int $port\n     * @param string $protocol\n     */\n    public function __construct(string $host, int $port = 8443, string $protocol = 'https')\n    {\n        $this->host = $host;\n        $this->port = $port;\n        $this->protocol = $protocol;\n    }\n\n    /**\n     * Setup credentials for authentication.\n     *\n     * @param string $login\n     * @param string $password\n     */\n    public function setCredentials(string $login, string $password): void\n    {\n        $this->login = $login;\n        $this->password = $password;\n    }\n\n    /**\n     * Define secret key for alternative authentication.\n     *\n     * @param string $secretKey\n     */\n    public function setSecretKey(string $secretKey): void\n    {\n        $this->secretKey = $secretKey;\n    }\n\n    /**\n     * Set proxy server for requests.\n     *\n     * @param string $proxy\n     */\n    public function setProxy(string $proxy): void\n    {\n        $this->proxy = $proxy;\n    }\n\n    /**\n     * Set default version for requests.\n     *\n     * @param string $version\n     */\n    public function setVersion(string $version): void\n    {\n        $this->version = $version;\n    }\n\n    /**\n     * Set custom function to verify response of API call according your own needs.\n     * Default verifying will be used if it is not specified.\n     *\n     * @param callable|null $function\n     */\n    public function setVerifyResponse(?callable $function = null): void\n    {\n        $this->verifyResponseCallback = $function;\n    }\n\n    /**\n     * Retrieve host used for communication.\n     *\n     * @return string\n     */\n    public function getHost(): string\n    {\n        return $this->host;\n    }\n\n    /**\n     * Retrieve port used for communication.\n     *\n     * @return int\n     */\n    public function getPort(): int\n    {\n        return $this->port;\n    }\n\n    /**\n     * Retrieve name of the protocol (http or https) used for communication.\n     *\n     * @return string\n     */\n    public function getProtocol(): string\n    {\n        return $this->protocol;\n    }\n\n    /**\n     * Retrieve XML template for packet.\n     *\n     * @param string|null $version\n     *\n     * @return SimpleXMLElement\n     */\n    public function getPacket($version = null): SimpleXMLElement\n    {\n        $protocolVersion = !is_null($version) ? $version : $this->version;\n        $content = \"<?xml version='1.0' encoding='UTF-8' ?>\";\n        $content .= '<packet' . ('' === $protocolVersion ? '' : \" version='$protocolVersion'\") . '/>';\n\n        return new SimpleXMLElement($content);\n    }\n\n    /**\n     * Perform API request.\n     *\n     * @param string|array|SimpleXMLElement $request\n     * @param int $mode\n     *\n     * @return XmlResponse\n     * @throws \\Exception\n     */\n    public function request($request, int $mode = self::RESPONSE_SHORT): XmlResponse\n    {\n        if ($request instanceof SimpleXMLElement) {\n            $request = $request->asXml();\n        } else {\n            $xml = $this->getPacket();\n\n            if (is_array($request)) {\n                $request = $this->arrayToXml($request, $xml)->asXML();\n            } elseif (preg_match('/^[a-z]/', $request)) {\n                $request = $this->expandRequestShortSyntax($request, $xml);\n            }\n        }\n\n        if ('sdk' == $this->protocol) {\n            $xml = $this->performSdkCall((string) $request);\n        } else {\n            $xml = $this->performHttpRequest((string) $request);\n        }\n\n        $this->verifyResponseCallback\n            ? call_user_func($this->verifyResponseCallback, $xml)\n            : $this->verifyResponse($xml);\n\n        $result = (self::RESPONSE_FULL === $mode)\n            ? $xml\n            : ($xml->xpath('//result') ?: [null])[0];\n\n        return new XmlResponse($result ? (string) $result->asXML() : '');\n    }\n\n    private function performSdkCall(string $request): XmlResponse\n    {\n        $version = ('' == $this->version) ? null : $this->version;\n\n        $requestXml = new SimpleXMLElement($request);\n        $innerNodes = $requestXml->children();\n        $innerXml = $innerNodes && count($innerNodes) > 0 && $innerNodes[0] ? $innerNodes[0]->asXml() : '';\n\n        /** @psalm-suppress UndefinedClass */\n        $result = \\pm_ApiRpc::getService($version)->call($innerXml, $this->login);\n\n        return new XmlResponse($result ? (string) $result->asXML() : '');\n    }\n\n    /**\n     * Perform HTTP request to end-point.\n     *\n     * @param string $request\n     *\n     * @throws Client\\Exception\n     *\n     * @return XmlResponse\n     */\n    private function performHttpRequest($request)\n    {\n        $curl = curl_init();\n\n        curl_setopt($curl, CURLOPT_URL, \"$this->protocol://$this->host:$this->port/enterprise/control/agent.php\");\n        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n        curl_setopt($curl, CURLOPT_POST, true);\n        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);\n        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);\n        curl_setopt($curl, CURLOPT_HTTPHEADER, $this->getHeaders());\n        curl_setopt($curl, CURLOPT_POSTFIELDS, $request);\n\n        if ('' !== $this->proxy) {\n            curl_setopt($curl, CURLOPT_PROXY, $this->proxy);\n        }\n\n        $result = curl_exec($curl);\n\n        if (false === $result) {\n            throw new Client\\Exception(curl_error($curl), curl_errno($curl));\n        }\n\n        curl_close($curl);\n\n        return new XmlResponse((string) $result);\n    }\n\n    /**\n     * Perform multiple API requests using single HTTP request.\n     *\n     * @param array $requests\n     * @param int $mode\n     *\n     * @throws Client\\Exception\n     *\n     * @return array\n     */\n    public function multiRequest(array $requests, int $mode = self::RESPONSE_SHORT): array\n    {\n        $requestXml = $this->getPacket();\n\n        foreach ($requests as $request) {\n            if ($request instanceof SimpleXMLElement) {\n                throw new Client\\Exception('SimpleXML type of request is not supported for multi requests.');\n            } else {\n                if (is_array($request)) {\n                    $request = $this->arrayToXml($request, $requestXml)->asXML();\n                    if (!$request) {\n                        throw new Client\\Exception('Failed to create an XML string for request');\n                    }\n                } elseif (preg_match('/^[a-z]/', $request)) {\n                    $this->expandRequestShortSyntax($request, $requestXml);\n                }\n            }\n        }\n\n        if ('sdk' == $this->protocol) {\n            throw new Client\\Exception('Multi requests are not supported via SDK.');\n        } else {\n            $xmlString = $requestXml->asXML();\n            if (!$xmlString) {\n                throw new Client\\Exception('Failed to create an XML string for request');\n            }\n            $responseXml = $this->performHttpRequest($xmlString);\n        }\n\n        return $this->splitResponseToArray($responseXml, $mode);\n    }\n\n    private function splitResponseToArray(XmlResponse $responseXml, $mode = self::RESPONSE_SHORT): array\n    {\n        $responses = [];\n\n        $nodes = $responseXml->children();\n        if (!$nodes) {\n            return [];\n        }\n\n        foreach ($nodes as $childNode) {\n            $dom = $this->getDomDocument($this->getPacket());\n            if (!$dom) {\n                continue;\n            }\n\n            $childDomNode = dom_import_simplexml($childNode);\n            if (!is_null($childDomNode)) {\n                $childDomNode = $dom->importNode($childDomNode, true);\n                $dom->documentElement->appendChild($childDomNode);\n            }\n\n            $response = simplexml_load_string($dom->saveXML());\n            if (!$response) {\n                return [];\n            }\n\n            $responses[] = (self::RESPONSE_FULL == $mode)\n                ? $response\n                : ($response->xpath('//result') ?: [null])[0];\n        }\n\n        return $responses;\n    }\n\n    private function getDomDocument(SimpleXMLElement $xml): ?DOMDocument\n    {\n        $dom = dom_import_simplexml($xml);\n        if (is_null($dom)) {\n            return null;\n        }\n\n        return $dom->ownerDocument;\n    }\n\n    /**\n     * Retrieve list of headers needed for request.\n     *\n     * @return array\n     */\n    private function getHeaders()\n    {\n        $headers = [\n            'Content-Type: text/xml',\n            'HTTP_PRETTY_PRINT: TRUE',\n        ];\n\n        if ($this->secretKey) {\n            $headers[] = \"KEY: $this->secretKey\";\n        } else {\n            $headers[] = \"HTTP_AUTH_LOGIN: $this->login\";\n            $headers[] = \"HTTP_AUTH_PASSWD: $this->password\";\n        }\n\n        return $headers;\n    }\n\n    /**\n     * Verify that response does not contain errors.\n     *\n     * @param XmlResponse $xml\n     *\n     * @throws Exception\n     */\n    private function verifyResponse($xml): void\n    {\n        if ($xml->system && $xml->system->status && 'error' == (string) $xml->system->status) {\n            throw new Exception((string) $xml->system->errtext, (int) $xml->system->errcode);\n        }\n\n        if ($xml->xpath('//status[text()=\"error\"]') && $xml->xpath('//errcode') && $xml->xpath('//errtext')) {\n            $errorCode = (int) ($xml->xpath('//errcode') ?: [null])[0];\n            $errorMessage = (string) ($xml->xpath('//errtext') ?: [null])[0];\n\n            throw new Exception($errorMessage, $errorCode);\n        }\n    }\n\n    /**\n     * Expand short syntax (some.method.call) into full XML representation.\n     *\n     * @param string $request\n     * @param SimpleXMLElement $xml\n     *\n     * @return false|string\n     */\n    private function expandRequestShortSyntax($request, SimpleXMLElement $xml)\n    {\n        $parts = explode('.', $request);\n        $node = $xml;\n        $lastParts = end($parts);\n\n        foreach ($parts as $part) {\n            // phpcs:ignore\n            @list($name, $value) = explode('=', $part);\n            if ($part !== $lastParts) {\n                $node = $node->addChild($name);\n            } else {\n                $node->{$name} = (string) $value;\n            }\n        }\n\n        return $xml->asXML();\n    }\n\n    /**\n     * Convert array to XML representation.\n     *\n     * @param array $array\n     * @param SimpleXMLElement $xml\n     * @param string $parentEl\n     *\n     * @return SimpleXMLElement\n     */\n    private function arrayToXml(array $array, SimpleXMLElement $xml, $parentEl = null)\n    {\n        foreach ($array as $key => $value) {\n            $el = is_int($key) && $parentEl ? $parentEl : $key;\n            if (is_array($value)) {\n                $this->arrayToXml($value, $this->isAssocArray($value) ? $xml->addChild($el) : $xml, $el);\n            } elseif (!isset($xml->{$el})) {\n                $xml->{$el} = (string) $value;\n            } else {\n                $xml->{$el}[] = (string) $value;\n            }\n        }\n\n        return $xml;\n    }\n\n    /**\n     * @param array $array\n     *\n     * @return bool\n     */\n    private function isAssocArray(array $array)\n    {\n        return $array && array_keys($array) !== range(0, count($array) - 1);\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return mixed\n     */\n    private function getOperator(string $name)\n    {\n        if (!isset($this->operatorsCache[$name])) {\n            $className = '\\\\PleskX\\\\Api\\\\Operator\\\\' . $name;\n            /** @psalm-suppress InvalidStringClass */\n            $this->operatorsCache[$name] = new $className($this);\n        }\n\n        return $this->operatorsCache[$name];\n    }\n\n    public function server(): Operator\\Server\n    {\n        return $this->getOperator('Server');\n    }\n\n    public function customer(): Operator\\Customer\n    {\n        return $this->getOperator('Customer');\n    }\n\n    public function webspace(): Operator\\Webspace\n    {\n        return $this->getOperator('Webspace');\n    }\n\n    public function subdomain(): Operator\\Subdomain\n    {\n        return $this->getOperator('Subdomain');\n    }\n\n    public function dns(): Operator\\Dns\n    {\n        return $this->getOperator('Dns');\n    }\n\n    public function dnsTemplate(): Operator\\DnsTemplate\n    {\n        return $this->getOperator('DnsTemplate');\n    }\n\n    public function databaseServer(): Operator\\DatabaseServer\n    {\n        return $this->getOperator('DatabaseServer');\n    }\n\n    public function mail(): Operator\\Mail\n    {\n        return $this->getOperator('Mail');\n    }\n\n    public function certificate(): Operator\\Certificate\n    {\n        return $this->getOperator('Certificate');\n    }\n\n    public function siteAlias(): Operator\\SiteAlias\n    {\n        return $this->getOperator('SiteAlias');\n    }\n\n    public function ip(): Operator\\Ip\n    {\n        return $this->getOperator('Ip');\n    }\n\n    public function eventLog(): Operator\\EventLog\n    {\n        return $this->getOperator('EventLog');\n    }\n\n    public function secretKey(): Operator\\SecretKey\n    {\n        return $this->getOperator('SecretKey');\n    }\n\n    public function ui(): Operator\\Ui\n    {\n        return $this->getOperator('Ui');\n    }\n\n    public function servicePlan(): Operator\\ServicePlan\n    {\n        return $this->getOperator('ServicePlan');\n    }\n\n    public function virtualDirectory(): Operator\\VirtualDirectory\n    {\n        return $this->getOperator('VirtualDirectory');\n    }\n\n    public function database(): Operator\\Database\n    {\n        return $this->getOperator('Database');\n    }\n\n    public function session(): Operator\\Session\n    {\n        return $this->getOperator('Session');\n    }\n\n    public function locale(): Operator\\Locale\n    {\n        return $this->getOperator('Locale');\n    }\n\n    public function logRotation(): Operator\\LogRotation\n    {\n        return $this->getOperator('LogRotation');\n    }\n\n    public function protectedDirectory(): Operator\\ProtectedDirectory\n    {\n        return $this->getOperator('ProtectedDirectory');\n    }\n\n    public function reseller(): Operator\\Reseller\n    {\n        return $this->getOperator('Reseller');\n    }\n\n    public function resellerPlan(): Operator\\ResellerPlan\n    {\n        return $this->getOperator('ResellerPlan');\n    }\n\n    public function aps(): Operator\\Aps\n    {\n        return $this->getOperator('Aps');\n    }\n\n    public function servicePlanAddon(): Operator\\ServicePlanAddon\n    {\n        return $this->getOperator('ServicePlanAddon');\n    }\n\n    public function site(): Operator\\Site\n    {\n        return $this->getOperator('Site');\n    }\n\n    public function phpHandler(): Operator\\PhpHandler\n    {\n        return $this->getOperator('PhpHandler');\n    }\n}\n"
  },
  {
    "path": "src/Api/Exception.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\n/**\n * Exceptions for XML-RPC API client.\n */\nclass Exception extends \\Exception\n{\n}\n"
  },
  {
    "path": "src/Api/InternalClient.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\n/**\n * Internal client for Plesk XML-RPC API (via SDK).\n */\nclass InternalClient extends Client\n{\n    public function __construct()\n    {\n        parent::__construct('localhost', 0, 'sdk');\n    }\n\n    /**\n     * Setup login to execute requests under certain user.\n     *\n     * @param string $login\n     */\n    public function setLogin(string $login): void\n    {\n        $this->login = $login;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Aps.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nclass Aps extends \\PleskX\\Api\\Operator\n{\n}\n"
  },
  {
    "path": "src/Api/Operator/Certificate.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Certificate as Struct;\n\nclass Certificate extends \\PleskX\\Api\\Operator\n{\n    public function generate(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('generate')->addChild('info');\n\n        foreach ($properties as $name => $value) {\n            $info->{$name} = $value;\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param array $properties\n     * @param string|Struct\\Info $certificate\n     * @param string|null $privateKey\n     */\n    public function install(array $properties, $certificate, ?string $privateKey = null): bool\n    {\n        return $this->callApi('install', $properties, $certificate, $privateKey);\n    }\n\n    /**\n     * @param array $properties\n     * @param Struct\\Info $certificate\n     */\n    public function update(array $properties, Struct\\Info $certificate): bool\n    {\n        return $this->callApi('update', $properties, $certificate);\n    }\n\n    /**\n     * @param string $method\n     * @param array $properties\n     * @param string|Struct\\Info $certificate\n     * @param string|null $privateKey\n     */\n    private function callApi(string $method, array $properties, $certificate, ?string $privateKey = null): bool\n    {\n        $packet = $this->client->getPacket();\n\n        $installTag = $packet->addChild($this->wrapperTag)->addChild($method);\n        foreach ($properties as $name => $value) {\n            $installTag->{$name} = $value;\n        }\n\n        $contentTag = $installTag->addChild('content');\n        if (is_string($certificate)) {\n            $contentTag->addChild('csr', $certificate);\n            $contentTag->addChild('pvt', $privateKey);\n        } elseif ($certificate instanceof \\PleskX\\Api\\Struct\\Certificate\\Info) {\n            foreach ($certificate->getMapping() as $name => $value) {\n                $contentTag->{$name} = $value;\n            }\n        }\n        $result = $this->client->request($packet);\n\n        return 'ok' == (string) $result->status;\n    }\n\n    public function delete(string $name, array $properties): bool\n    {\n        $packet = $this->client->getPacket();\n\n        $removeTag = $packet->addChild($this->wrapperTag)->addChild('remove');\n        $removeTag->addChild('filter')->addChild('name', $name);\n\n        foreach ($properties as $name => $value) {\n            $removeTag->{$name} = $value;\n        }\n\n        $result = $this->client->request($packet);\n\n        return 'ok' == (string) $result->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Customer.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Customer as Struct;\n\nclass Customer extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add')->addChild('gen_info');\n\n        foreach ($properties as $name => $value) {\n            $info->{$name} = $value;\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo\n     */\n    public function get(string $field, $value): Struct\\GeneralInfo\n    {\n        $items = $this->getItems(Struct\\GeneralInfo::class, 'gen_info', $field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll(): array\n    {\n        return $this->getItems(Struct\\GeneralInfo::class, 'gen_info');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function enable(string $field, $value): bool\n    {\n        return $this->setProperties($field, $value, ['status' => 0]);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function disable(string $field, $value): bool\n    {\n        return $this->setProperties($field, $value, ['status' => 16]);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     * @param array $properties\n     *\n     * @return bool\n     */\n    public function setProperties(string $field, $value, array $properties): bool\n    {\n        $packet = $this->client->getPacket();\n        $setTag = $packet->addChild($this->wrapperTag)->addChild('set');\n        $setTag->addChild('filter')->addChild($field, (string) $value);\n        $genInfoTag = $setTag->addChild('values')->addChild('gen_info');\n        foreach ($properties as $property => $propertyValue) {\n            $genInfoTag->addChild($property, (string) $propertyValue);\n        }\n\n        $response = $this->client->request($packet);\n\n        return 'ok' === (string) $response->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Database.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Database as Struct;\nuse PleskX\\Api\\XmlResponse;\n\nclass Database extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        return new Struct\\Info($this->process('add-db', $properties));\n    }\n\n    public function createUser(array $properties): Struct\\UserInfo\n    {\n        return new Struct\\UserInfo($this->process('add-db-user', $properties));\n    }\n\n    private function process(string $command, array $properties): XmlResponse\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild($command);\n\n        foreach ($properties as $name => $value) {\n            if (false !== strpos($value, '&')) {\n                $info->$name = $value;\n                continue;\n            }\n            $info->{$name} = $value;\n        }\n\n        return $this->client->request($packet);\n    }\n\n    public function updateUser(array $properties): bool\n    {\n        $response = $this->process('set-db-user', $properties);\n\n        return 'ok' === (string) $response->status;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\UserInfo\n     */\n    public function getUser(string $field, $value): Struct\\UserInfo\n    {\n        $items = $this->getAllUsers($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string|null $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info[]\n     */\n    public function getAll(?string $field, $value): array\n    {\n        $response = $this->getBy('get-db', $field, $value);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if ($xmlResult && isset($xmlResult->id) && (int) $xmlResult->id > 0) {\n                $items[] = new Struct\\Info($xmlResult);\n            }\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\UserInfo[]\n     */\n    public function getAllUsers(string $field, $value): array\n    {\n        $response = $this->getBy('get-db-users', $field, $value);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if ($xmlResult) {\n                $items[] = new Struct\\UserInfo($xmlResult);\n            }\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param string $command\n     * @param string|null $field\n     * @param int|string $value\n     *\n     * @return XmlResponse\n     */\n    private function getBy(string $command, ?string $field, $value): XmlResponse\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild($command);\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->{$field} = (string) $value;\n        }\n\n        return $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value, 'del-db');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function deleteUser(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value, 'del-db-user');\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/DatabaseServer.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\DatabaseServer as Struct;\n\nclass DatabaseServer extends \\PleskX\\Api\\Operator\n{\n    protected string $wrapperTag = 'db_server';\n\n    public function getSupportedTypes(): array\n    {\n        $response = $this->request('get-supported-types');\n\n        return (array) $response->type;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getBy($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\Info[]\n     */\n    public function getAll(): array\n    {\n        return $this->getBy();\n    }\n\n    public function getDefault(string $type): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get-default');\n        $filterTag = $getTag->addChild('filter');\n        /** @psalm-suppress UndefinedPropertyAssignment */\n        $filterTag->type = $type;\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string|null $field\n     * @param int|string|null $value\n     *\n     * @return Struct\\Info[]\n     */\n    private function getBy($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->{$field} = (string) $value;\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            if (!is_null($xmlResult->data)) {\n                $item = new Struct\\Info($xmlResult->data);\n                $item->id = (int) $xmlResult->id;\n                $items[] = $item;\n            }\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Dns.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Dns as Struct;\n\nclass Dns extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add_rec');\n\n        foreach ($properties as $name => $value) {\n            $info->{$name} = $value;\n        }\n\n        return new Struct\\Info($this->client->request($packet));\n    }\n\n    /**\n     * Send multiply records by one request.\n     *\n     * @param array $records\n     *\n     * @return \\SimpleXMLElement[]\n     */\n    public function bulkCreate(array $records): array\n    {\n        $packet = $this->client->getPacket();\n\n        foreach ($records as $properties) {\n            $info = $packet->addChild($this->wrapperTag)->addChild('add_rec');\n\n            foreach ($properties as $name => $value) {\n                $info->{$name} = $value;\n            }\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if ($xmlResult) {\n                $items[] = $xmlResult;\n            }\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info[]\n     */\n    public function getAll(string $field, $value): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get_rec');\n\n        $filterTag = $getTag->addChild('filter');\n        $filterTag->addChild($field, (string) $value);\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            if (!is_null($xmlResult->data)) {\n                $item = new Struct\\Info($xmlResult->data);\n                $item->id = (int) $xmlResult->id;\n                $items[] = $item;\n            }\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value, 'del_rec');\n    }\n\n    /**\n     * Delete multiply records by one request.\n     *\n     * @param array $recordIds\n     *\n     * @return \\SimpleXMLElement[]\n     */\n    public function bulkDelete(array $recordIds): array\n    {\n        $packet = $this->client->getPacket();\n\n        foreach ($recordIds as $recordId) {\n            $packet->addChild($this->wrapperTag)->addChild('del_rec')\n                ->addChild('filter')->addChild('id', $recordId);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if ($xmlResult) {\n                $items[] = $xmlResult;\n            }\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/DnsTemplate.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Dns as Struct;\n\nclass DnsTemplate extends \\PleskX\\Api\\Operator\n{\n    protected string $wrapperTag = 'dns';\n\n    /**\n     * @param array $properties\n     *\n     * @return Struct\\Info\n     */\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add_rec');\n\n        unset($properties['site-id'], $properties['site-alias-id']);\n        foreach ($properties as $name => $value) {\n            $info->{$name} = $value;\n        }\n\n        return new Struct\\Info($this->client->request($packet));\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info[]\n     */\n    public function getAll($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get_rec');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->{$field} = (string) $value;\n        }\n        $getTag->addChild('template');\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            if (!is_null($xmlResult->data)) {\n                $item = new Struct\\Info($xmlResult->data);\n                $item->id = (int) $xmlResult->id;\n                $items[] = $item;\n            }\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        $packet = $this->client->getPacket();\n        $delTag = $packet->addChild($this->wrapperTag)->addChild('del_rec');\n        $delTag->addChild('filter')->addChild($field, (string) $value);\n        $delTag->addChild('template');\n\n        $response = $this->client->request($packet);\n\n        return 'ok' === (string) $response->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/EventLog.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\EventLog as Struct;\n\nclass EventLog extends \\PleskX\\Api\\Operator\n{\n    protected string $wrapperTag = 'event_log';\n\n    /**\n     * @return Struct\\Event[]\n     */\n    public function get(): array\n    {\n        $records = [];\n        $response = $this->request('get');\n\n        foreach ($response->event ?? [] as $eventInfo) {\n            $records[] = new Struct\\Event($eventInfo);\n        }\n\n        return $records;\n    }\n\n    /**\n     * @return Struct\\DetailedEvent[]\n     */\n    public function getDetailedLog(): array\n    {\n        $records = [];\n        $response = $this->request('get_events');\n\n        foreach ($response->event ?? [] as $eventInfo) {\n            $records[] = new Struct\\DetailedEvent($eventInfo);\n        }\n\n        return $records;\n    }\n\n    public function getLastId(): int\n    {\n        return (int) $this->request('get-last-id')->getValue('id');\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Ip.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Ip as Struct;\n\nclass Ip extends \\PleskX\\Api\\Operator\n{\n    /**\n     * @return Struct\\Info[]\n     */\n    public function get(): array\n    {\n        $ips = [];\n        $packet = $this->client->getPacket();\n        $packet->addChild($this->wrapperTag)->addChild('get');\n        $response = $this->client->request($packet);\n\n        foreach ($response->addresses->ip_info ?? [] as $ipInfo) {\n            $ips[] = new Struct\\Info($ipInfo);\n        }\n\n        return $ips;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Locale.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Locale as Struct;\n\nclass Locale extends \\PleskX\\Api\\Operator\n{\n    /**\n     * @param string|null $id\n     *\n     * @return Struct\\Info|Struct\\Info[]\n     */\n    public function get($id = null)\n    {\n        $locales = [];\n        $packet = $this->client->getPacket();\n        $filter = $packet->addChild($this->wrapperTag)->addChild('get')->addChild('filter');\n\n        if (!is_null($id)) {\n            $filter->addChild('id', $id);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        foreach ($response->locale->get->result ?? [] as $localeInfo) {\n            if (!is_null($localeInfo->info)) {\n                $locales[(string) $localeInfo->info->id] = new Struct\\Info($localeInfo->info);\n            }\n        }\n\n        return !is_null($id) ? reset($locales) : $locales;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/LogRotation.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nclass LogRotation extends \\PleskX\\Api\\Operator\n{\n}\n"
  },
  {
    "path": "src/Api/Operator/Mail.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Client;\nuse PleskX\\Api\\Operator;\nuse PleskX\\Api\\Struct\\Mail as Struct;\n\nclass Mail extends Operator\n{\n    public function create(string $name, int $siteId, bool $mailbox = false, string $password = ''): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('create');\n\n        $filter = $info->addChild('filter');\n        $filter->addChild('site-id', (string) $siteId);\n        $mailname = $filter->addChild('mailname');\n        $mailname->addChild('name', $name);\n        if ($mailbox) {\n            $mailname->addChild('mailbox')->addChild('enabled', 'true');\n        }\n        if (!empty($password)) {\n            /** @psalm-suppress UndefinedPropertyAssignment */\n            $mailname->addChild('password')->value = $password;\n        }\n\n        $response = $this->client->request($packet);\n\n        /** @psalm-suppress PossiblyNullArgument */\n        return new Struct\\Info($response->mailname);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     * @param int $siteId\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value, int $siteId): bool\n    {\n        $packet = $this->client->getPacket();\n        $filter = $packet->addChild($this->wrapperTag)->addChild('remove')->addChild('filter');\n\n        $filter->addChild('site-id', (string) $siteId);\n        $filter->{$field} = (string) $value;\n\n        $response = $this->client->request($packet);\n\n        return 'ok' === (string) $response->status;\n    }\n\n    public function get(string $name, int $siteId): Struct\\GeneralInfo\n    {\n        $items = $this->getAll($siteId, $name);\n\n        return reset($items);\n    }\n\n    /**\n     * @param int $siteId\n     * @param string|null $name\n     *\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll(int $siteId, $name = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get_info');\n\n        $filterTag = $getTag->addChild('filter');\n        $filterTag->addChild('site-id', (string) $siteId);\n        if (!is_null($name)) {\n            $filterTag->addChild('name', $name);\n        }\n\n        $response = $this->client->request($packet, Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult || !isset($xmlResult->mailname)) {\n                continue;\n            }\n            $item = new Struct\\GeneralInfo($xmlResult->mailname);\n            $items[] = $item;\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/PhpHandler.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Client;\nuse PleskX\\Api\\Operator;\nuse PleskX\\Api\\Struct\\PhpHandler\\Info;\n\nclass PhpHandler extends Operator\n{\n    /**\n     * @param string|null $field\n     * @param int|string|null $value\n     *\n     * @return Info\n     */\n    public function get($field = null, $value = null): ?Info\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n        $filterTag = $getTag->addChild('filter');\n\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $response = $this->client->request($packet, Client::RESPONSE_FULL);\n        $xmlResult = ($response->xpath('//result') ?: [null])[0];\n\n        return $xmlResult ? new Info($xmlResult) : null;\n    }\n\n    /**\n     * @param string|null $field\n     * @param int|string $value\n     *\n     * @return Info[]\n     */\n    public function getAll($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $response = $this->client->request($packet, Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            $item = new Info($xmlResult);\n            $items[] = $item;\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/ProtectedDirectory.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Client;\nuse PleskX\\Api\\Operator;\nuse PleskX\\Api\\Struct\\ProtectedDirectory as Struct;\n\nclass ProtectedDirectory extends Operator\n{\n    protected string $wrapperTag = 'protected-dir';\n\n    public function add(string $name, int $siteId, string $header = ''): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add');\n\n        $info->addChild('site-id', (string) $siteId);\n        $info->addChild('name', $name);\n        $info->addChild('header', $header);\n\n        return new Struct\\Info($this->client->request($packet));\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value, 'delete');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\DataInfo\n     */\n    public function get(string $field, $value): Struct\\DataInfo\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\DataInfo[]\n     */\n    public function getAll(string $field, $value): array\n    {\n        $response = $this->getBy('get', $field, $value);\n        $items = [];\n        foreach ((array) $response->xpath('//result/data') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            $items[] = new Struct\\DataInfo($xmlResult);\n        }\n\n        return $items;\n    }\n\n    /**\n     * @param Struct\\Info $protectedDirectory\n     * @param string $login\n     * @param string $password\n     *\n     * @return Struct\\UserInfo\n     * @psalm-suppress UndefinedPropertyAssignment\n     */\n    public function addUser($protectedDirectory, $login, $password)\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add-user');\n\n        $info->{'pd-id'} = (string) $protectedDirectory->id;\n        $info->login = $login;\n        $info->password = $password;\n\n        return new Struct\\UserInfo($this->client->request($packet));\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function deleteUser($field, $value)\n    {\n        return $this->deleteBy($field, $value, 'delete-user');\n    }\n\n    /**\n     * @param string $command\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return \\PleskX\\Api\\XmlResponse\n     */\n    private function getBy(string $command, string $field, $value)\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild($command);\n\n        $filterTag = $getTag->addChild('filter');\n        $filterTag->{$field} = (string) $value;\n\n        return $this->client->request($packet, Client::RESPONSE_FULL);\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Reseller.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Reseller as Struct;\n\nclass Reseller extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add')->addChild('gen-info');\n\n        foreach ($properties as $name => $value) {\n            $info->{$name} = $value;\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo\n     */\n    public function get(string $field, $value): Struct\\GeneralInfo\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $datasetTag = $getTag->addChild('dataset');\n        $datasetTag->addChild('gen-info');\n        $datasetTag->addChild('permissions');\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult || !$xmlResult->data) {\n                continue;\n            }\n\n            $item = new Struct\\GeneralInfo($xmlResult->data);\n            $item->id = (int) $xmlResult->id;\n            $items[] = $item;\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/ResellerPlan.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nclass ResellerPlan extends \\PleskX\\Api\\Operator\n{\n}\n"
  },
  {
    "path": "src/Api/Operator/SecretKey.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\SecretKey as Struct;\n\nclass SecretKey extends \\PleskX\\Api\\Operator\n{\n    protected string $wrapperTag = 'secret_key';\n\n    public function create(string $ipAddress = '', string $description = ''): string\n    {\n        $packet = $this->client->getPacket();\n        $createTag = $packet->addChild($this->wrapperTag)->addChild('create');\n\n        if ('' !== $ipAddress) {\n            $createTag->addChild('ip_address', $ipAddress);\n        }\n\n        if ('' !== $description) {\n            $createTag->addChild('description', $description);\n        }\n\n        $response = $this->client->request($packet);\n\n        return (string) $response->key;\n    }\n\n    public function delete(string $keyId): bool\n    {\n        return $this->deleteBy('key', $keyId, 'delete');\n    }\n\n    public function get(string $keyId): Struct\\Info\n    {\n        $items = $this->getBy($keyId);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\Info[]\n     */\n    public function getAll(): array\n    {\n        return $this->getBy();\n    }\n\n    /**\n     * @param string|null $keyId\n     *\n     * @return Struct\\Info[]\n     */\n    public function getBy($keyId = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get_info');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($keyId)) {\n            $filterTag->addChild('key', $keyId);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result/key_info') as $keyInfo) {\n            if (!$keyInfo) {\n                continue;\n            }\n            $items[] = new Struct\\Info($keyInfo);\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Server.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Server as Struct;\nuse PleskX\\Api\\XmlResponse;\n\nclass Server extends \\PleskX\\Api\\Operator\n{\n    public function getProtos(): array\n    {\n        $packet = $this->client->getPacket();\n        $packet->addChild($this->wrapperTag)->addChild('get_protos');\n        $response = $this->client->request($packet);\n\n        /** @psalm-suppress PossiblyNullPropertyFetch */\n        return (array) $response->protos->proto;\n    }\n\n    public function getGeneralInfo(): Struct\\GeneralInfo\n    {\n        return new Struct\\GeneralInfo($this->getInfo('gen_info'));\n    }\n\n    public function getPreferences(): Struct\\Preferences\n    {\n        return new Struct\\Preferences($this->getInfo('prefs'));\n    }\n\n    public function getAdmin(): Struct\\Admin\n    {\n        return new Struct\\Admin($this->getInfo('admin'));\n    }\n\n    public function getKeyInfo(): array\n    {\n        $keyInfo = [];\n        $keyInfoXml = $this->getInfo('key');\n\n        foreach ($keyInfoXml->property ?? [] as $property) {\n            $keyInfo[(string) $property->name] = (string) $property->value;\n        }\n\n        return $keyInfo;\n    }\n\n    public function getComponents(): array\n    {\n        $components = [];\n        $componentsXml = $this->getInfo('components');\n\n        foreach ($componentsXml->component ?? [] as $component) {\n            $components[(string) $component->name] = (string) $component->version;\n        }\n\n        return $components;\n    }\n\n    public function getServiceStates(): array\n    {\n        $states = [];\n        $statesXml = $this->getInfo('services_state');\n\n        foreach ($statesXml->srv ?? [] as $service) {\n            $states[(string) $service->id] = [\n                'id' => (string) $service->id,\n                'title' => (string) $service->title,\n                'state' => (string) $service->state,\n            ];\n        }\n\n        return $states;\n    }\n\n    public function getSessionPreferences(): Struct\\SessionPreferences\n    {\n        return new Struct\\SessionPreferences($this->getInfo('session_setup'));\n    }\n\n    public function getShells(): array\n    {\n        $shells = [];\n        $shellsXml = $this->getInfo('shells');\n\n        foreach ($shellsXml->shell ?? [] as $shell) {\n            $shells[(string) $shell->name] = (string) $shell->path;\n        }\n\n        return $shells;\n    }\n\n    public function getNetworkInterfaces(): array\n    {\n        $interfacesXml = $this->getInfo('interfaces');\n\n        return (array) $interfacesXml->interface;\n    }\n\n    public function getStatistics(): Struct\\Statistics\n    {\n        return new Struct\\Statistics($this->getInfo('stat'));\n    }\n\n    public function getSiteIsolationConfig(): array\n    {\n        $config = [];\n        $configXml = $this->getInfo('site-isolation-config');\n\n        foreach ($configXml->property ?? [] as $property) {\n            $config[(string) $property->name] = (string) $property->value;\n        }\n\n        return $config;\n    }\n\n    public function getUpdatesInfo(): Struct\\UpdatesInfo\n    {\n        return new Struct\\UpdatesInfo($this->getInfo('updates'));\n    }\n\n    public function createSession(string $login, string $clientIp): string\n    {\n        $packet = $this->client->getPacket();\n        $sessionNode = $packet->addChild($this->wrapperTag)->addChild('create_session');\n        $sessionNode->addChild('login', $login);\n        $dataNode = $sessionNode->addChild('data');\n        $dataNode->addChild('user_ip', base64_encode($clientIp));\n        $dataNode->addChild('source_server');\n        $response = $this->client->request($packet);\n\n        return (string) $response->id;\n    }\n\n    private function getInfo(string $operation): XmlResponse\n    {\n        $packet = $this->client->getPacket();\n        $packet->addChild($this->wrapperTag)->addChild('get')->addChild($operation);\n        $response = $this->client->request($packet);\n\n        return $response->$operation;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/ServicePlan.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\ServicePlan as Struct;\n\nclass ServicePlan extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $response = $this->request(['add' => $properties]);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getBy($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\Info[]\n     */\n    public function getAll(): array\n    {\n        return $this->getBy();\n    }\n\n    /**\n     * @param string|null $field\n     * @param int|string|null $value\n     *\n     * @return Struct\\Info[]\n     */\n    private function getBy($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            $items[] = new Struct\\Info($xmlResult);\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/ServicePlanAddon.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\ServicePlanAddon as Struct;\n\nclass ServicePlanAddon extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $response = $this->request(['add' => $properties]);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getBy($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\Info[]\n     */\n    public function getAll(): array\n    {\n        return $this->getBy();\n    }\n\n    /**\n     * @param string|null $field\n     * @param int|string|null $value\n     *\n     * @return Struct\\Info[]\n     */\n    private function getBy($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            $items[] = new Struct\\Info($xmlResult);\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Session.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Session as Struct;\n\nclass Session extends \\PleskX\\Api\\Operator\n{\n    public function create(string $username, string $userIp): string\n    {\n        $packet = $this->client->getPacket();\n        $creator = $packet->addChild('server')->addChild('create_session');\n\n        $creator->addChild('login', $username);\n        $loginData = $creator->addChild('data');\n\n        $loginData->addChild('user_ip', base64_encode($userIp));\n        $loginData->addChild('source_server', '');\n\n        $response = $this->client->request($packet);\n\n        return (string) $response->id;\n    }\n\n    /**\n     * @return Struct\\Info[]\n     */\n    public function get(): array\n    {\n        $sessions = [];\n        $response = $this->request('get');\n\n        foreach ($response->session ?? [] as $sessionInfo) {\n            $sessions[(string) $sessionInfo->id] = new Struct\\Info($sessionInfo);\n        }\n\n        return $sessions;\n    }\n\n    public function terminate(string $sessionId): bool\n    {\n        $response = $this->request(\"terminate.session-id=$sessionId\");\n\n        return 'ok' === (string) $response->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Site.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Site as Struct;\n\nclass Site extends \\PleskX\\Api\\Operator\n{\n    public const PROPERTIES_HOSTING = 'hosting';\n\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add');\n\n        $infoGeneral = $info->addChild('gen_setup');\n        foreach ($properties as $name => $value) {\n            if (!is_scalar($value)) {\n                continue;\n            }\n            $infoGeneral->{$name} = (string) $value;\n        }\n\n        // set hosting properties\n        if (isset($properties[static::PROPERTIES_HOSTING]) && is_array($properties[static::PROPERTIES_HOSTING])) {\n            $hostingNode = $info->addChild('hosting')->addChild('vrt_hst');\n            foreach ($properties[static::PROPERTIES_HOSTING] as $name => $value) {\n                $propertyNode = $hostingNode->addChild('property');\n                /** @psalm-suppress UndefinedPropertyAssignment */\n                $propertyNode->name = $name;\n                /** @psalm-suppress UndefinedPropertyAssignment */\n                $propertyNode->value = $value;\n            }\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return ?Struct\\GeneralInfo\n     */\n    public function get(string $field, $value): ?Struct\\GeneralInfo\n    {\n        $items = $this->getItems(Struct\\GeneralInfo::class, 'gen_info', $field, $value);\n\n        return reset($items) ?: null;\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\HostingInfo|null\n     */\n    public function getHosting(string $field, $value): ?Struct\\HostingInfo\n    {\n        $items = $this->getItems(\n            Struct\\HostingInfo::class,\n            'hosting',\n            $field,\n            $value,\n            function (\\SimpleXMLElement $node) {\n                return isset($node->vrt_hst);\n            }\n        );\n\n        return empty($items) ? null : reset($items);\n    }\n\n    /**\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll(): array\n    {\n        return $this->getItems(Struct\\GeneralInfo::class, 'gen_info');\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/SiteAlias.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\SiteAlias as Struct;\n\nclass SiteAlias extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties, array $preferences = []): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('create');\n\n        if (count($preferences) > 0) {\n            $prefs = $info->addChild('pref');\n\n            foreach ($preferences as $key => $value) {\n                $prefs->addChild($key, is_bool($value) ? ($value ? '1' : '0') : $value);\n            }\n        }\n\n        $info->addChild('site-id', $properties['site-id']);\n        $info->addChild('name', $properties['name']);\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value, 'delete');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo\n     */\n    public function get(string $field, $value): Struct\\GeneralInfo\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->{$field} = (string) $value;\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult) {\n                continue;\n            }\n            if (!is_null($xmlResult->info)) {\n                $item = new Struct\\GeneralInfo($xmlResult->info);\n                $items[] = $item;\n            }\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Subdomain.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Subdomain as Struct;\n\nclass Subdomain extends \\PleskX\\Api\\Operator\n{\n    public function create(array $properties): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add');\n\n        foreach ($properties as $name => $value) {\n            if (is_array($value)) {\n                foreach ($value as $propertyName => $propertyValue) {\n                    $property = $info->addChild($name);\n                    /** @psalm-suppress UndefinedPropertyAssignment */\n                    $property->name = $propertyName;\n                    /** @psalm-suppress UndefinedPropertyAssignment */\n                    $property->value = $propertyValue;\n                }\n                continue;\n            }\n            $info->{$name} = $value;\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info\n     */\n    public function get(string $field, $value): Struct\\Info\n    {\n        $items = $this->getAll($field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Info[]\n     */\n    public function getAll($field = null, $value = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->addChild($field, (string) $value);\n        }\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult || empty($xmlResult->data)) {\n                continue;\n            }\n            $item = new Struct\\Info($xmlResult->data);\n            $item->id = (int) $xmlResult->id;\n            $items[] = $item;\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/Ui.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Struct\\Ui as Struct;\n\nclass Ui extends \\PleskX\\Api\\Operator\n{\n    public function getNavigation(): array\n    {\n        $response = $this->request('get-navigation');\n\n        /** @psalm-suppress ImplicitToStringCast, PossiblyNullArgument */\n        return unserialize(base64_decode($response->navigation));\n    }\n\n    public function createCustomButton(string $owner, array $properties): int\n    {\n        $packet = $this->client->getPacket();\n        $buttonNode = $packet->addChild($this->wrapperTag)->addChild('create-custombutton');\n        $buttonNode->addChild('owner')->addChild($owner);\n        $propertiesNode = $buttonNode->addChild('properties');\n\n        foreach ($properties as $name => $value) {\n            $propertiesNode->{$name} = $value;\n        }\n\n        $response = $this->client->request($packet);\n\n        return (int) $response->id;\n    }\n\n    public function getCustomButton(int $id): Struct\\CustomButton\n    {\n        $response = $this->request(\"get-custombutton.filter.custombutton-id=$id\");\n\n        return new Struct\\CustomButton($response);\n    }\n\n    public function deleteCustomButton(int $id): bool\n    {\n        return $this->deleteBy('custombutton-id', $id, 'delete-custombutton');\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator/VirtualDirectory.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nclass VirtualDirectory extends \\PleskX\\Api\\Operator\n{\n    protected string $wrapperTag = 'virtdir';\n}\n"
  },
  {
    "path": "src/Api/Operator/Webspace.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Operator;\n\nuse PleskX\\Api\\Operator;\nuse PleskX\\Api\\Struct\\Webspace as Struct;\n\nclass Webspace extends Operator\n{\n    public function getPermissionDescriptor(): Struct\\PermissionDescriptor\n    {\n        $response = $this->request('get-permission-descriptor.filter');\n\n        return new Struct\\PermissionDescriptor($response);\n    }\n\n    public function getLimitDescriptor(): Struct\\LimitDescriptor\n    {\n        $response = $this->request('get-limit-descriptor.filter');\n\n        return new Struct\\LimitDescriptor($response);\n    }\n\n    public function getPhysicalHostingDescriptor(): Struct\\PhysicalHostingDescriptor\n    {\n        $response = $this->request('get-physical-hosting-descriptor.filter');\n\n        return new Struct\\PhysicalHostingDescriptor($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\PhpSettings\n     */\n    public function getPhpSettings(string $field, $value): Struct\\PhpSettings\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $getTag->addChild('filter')->addChild($field, (string) $value);\n        $getTag->addChild('dataset')->addChild('php-settings');\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        return new Struct\\PhpSettings($response);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\Limits\n     */\n    public function getLimits(string $field, $value): Struct\\Limits\n    {\n        $items = $this->getItems(Struct\\Limits::class, 'limits', $field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param array $properties\n     * @param array|null $hostingProperties\n     * @param string $planName\n     *\n     * @return Struct\\Info\n     */\n    public function create(array $properties, ?array $hostingProperties = null, string $planName = ''): Struct\\Info\n    {\n        $packet = $this->client->getPacket();\n        $info = $packet->addChild($this->wrapperTag)->addChild('add');\n\n        $infoGeneral = $info->addChild('gen_setup');\n        foreach ($properties as $name => $value) {\n            if (is_array($value)) {\n                continue;\n            } else {\n                $infoGeneral->addChild($name, (string) $value);\n            }\n        }\n\n        if ($hostingProperties) {\n            $infoHosting = $info->addChild('hosting')->addChild('vrt_hst');\n            foreach ($hostingProperties as $name => $value) {\n                $property = $infoHosting->addChild('property');\n                /** @psalm-suppress UndefinedPropertyAssignment */\n                $property->name = $name;\n                /** @psalm-suppress UndefinedPropertyAssignment */\n                $property->value = $value;\n            }\n\n            if (isset($properties['ip_address'])) {\n                foreach ((array) $properties['ip_address'] as $ipAddress) {\n                    $infoHosting->addChild('ip_address', $ipAddress);\n                }\n            }\n        }\n\n        if ('' !== $planName) {\n            $info->addChild('plan-name', $planName);\n        }\n\n        $response = $this->client->request($packet);\n\n        return new Struct\\Info($response, $properties['name'] ?? '');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function delete(string $field, $value): bool\n    {\n        return $this->deleteBy($field, $value);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\GeneralInfo\n     */\n    public function get(string $field, $value): Struct\\GeneralInfo\n    {\n        $items = $this->getItems(Struct\\GeneralInfo::class, 'gen_info', $field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @return Struct\\GeneralInfo[]\n     */\n    public function getAll(): array\n    {\n        return $this->getItems(Struct\\GeneralInfo::class, 'gen_info');\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return Struct\\DiskUsage\n     */\n    public function getDiskUsage(string $field, $value): Struct\\DiskUsage\n    {\n        $items = $this->getItems(Struct\\DiskUsage::class, 'disk_usage', $field, $value);\n\n        return reset($items);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function enable(string $field, $value): bool\n    {\n        return $this->setProperties($field, $value, ['status' => 0]);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     *\n     * @return bool\n     */\n    public function disable(string $field, $value): bool\n    {\n        return $this->setProperties($field, $value, ['status' => 16]);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     * @param array $properties\n     *\n     * @return bool\n     */\n    public function setProperties(string $field, $value, array $properties): bool\n    {\n        $packet = $this->client->getPacket();\n        $setTag = $packet->addChild($this->wrapperTag)->addChild('set');\n        $setTag->addChild('filter')->addChild($field, (string) $value);\n        $genInfoTag = $setTag->addChild('values')->addChild('gen_setup');\n        foreach ($properties as $property => $propertyValue) {\n            $genInfoTag->addChild($property, (string) $propertyValue);\n        }\n\n        $response = $this->client->request($packet);\n\n        return 'ok' === (string) $response->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Operator.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\nclass Operator\n{\n    protected string $wrapperTag = '';\n    protected Client $client;\n\n    public function __construct(Client $client)\n    {\n        $this->client = $client;\n\n        if ('' === $this->wrapperTag) {\n            $classNameParts = explode('\\\\', get_class($this));\n            $this->wrapperTag = end($classNameParts);\n            $this->wrapperTag = strtolower(preg_replace('/([a-z])([A-Z])/', '\\1-\\2', $this->wrapperTag));\n        }\n    }\n\n    /**\n     * Perform plain API request.\n     *\n     * @param string|array $request\n     * @param int $mode\n     *\n     * @return XmlResponse\n     */\n    public function request($request, $mode = Client::RESPONSE_SHORT): XmlResponse\n    {\n        $wrapperTag = $this->wrapperTag;\n\n        if (is_array($request)) {\n            $request = [$wrapperTag => $request];\n        } elseif (preg_match('/^[a-z]/', $request)) {\n            $request = \"$wrapperTag.$request\";\n        } else {\n            $request = \"<$wrapperTag>$request</$wrapperTag>\";\n        }\n\n        return $this->client->request($request, $mode);\n    }\n\n    /**\n     * @param string $field\n     * @param int|string $value\n     * @param string $deleteMethodName\n     *\n     * @return bool\n     */\n    protected function deleteBy(string $field, $value, string $deleteMethodName = 'del'): bool\n    {\n        $response = $this->request([\n            $deleteMethodName => [\n                'filter' => [\n                    $field => $value,\n                ],\n            ],\n        ]);\n\n        return 'ok' === (string) $response->status;\n    }\n\n    /**\n     * @param string $structClass\n     * @param string $infoTag\n     * @param string|null $field\n     * @param int|string|null $value\n     * @param callable|null $filter\n     *\n     * @return array\n     */\n    protected function getItems($structClass, $infoTag, $field = null, $value = null, ?callable $filter = null): array\n    {\n        $packet = $this->client->getPacket();\n        $getTag = $packet->addChild($this->wrapperTag)->addChild('get');\n\n        $filterTag = $getTag->addChild('filter');\n        if (!is_null($field)) {\n            $filterTag->{$field} = (string) $value;\n        }\n\n        $getTag->addChild('dataset')->addChild($infoTag);\n\n        $response = $this->client->request($packet, \\PleskX\\Api\\Client::RESPONSE_FULL);\n\n        $items = [];\n        foreach ((array) $response->xpath('//result') as $xmlResult) {\n            if (!$xmlResult || !isset($xmlResult->data) || !isset($xmlResult->data->$infoTag)) {\n                continue;\n            }\n            if (!is_null($filter) && !$filter($xmlResult->data->$infoTag)) {\n                continue;\n            }\n            /** @psalm-suppress InvalidStringClass */\n            $item = new $structClass($xmlResult->data->$infoTag);\n            if (isset($xmlResult->id) && property_exists($item, 'id')) {\n                $item->id = (int) $xmlResult->id;\n            }\n            $items[] = $item;\n        }\n\n        return $items;\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Certificate/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Certificate;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public ?string $request = null;\n    public ?string $privateKey = null;\n    public ?string $publicKey = null;\n    public ?string $publicKeyCA = null;\n\n    public function __construct($input)\n    {\n        if ($input instanceof \\SimpleXMLElement) {\n            $this->initScalarProperties($input, [\n                ['csr' => 'request'],\n                ['pvt' => 'privateKey'],\n            ]);\n        } else {\n            foreach ($input as $name => $value) {\n                $this->$name = $value;\n            }\n        }\n    }\n\n    public function getMapping(): array\n    {\n        return array_filter([\n            'csr' => $this->request,\n            'pvt' => $this->privateKey,\n            'cert' => $this->publicKey,\n            'ca' => $this->publicKeyCA,\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Customer/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Customer;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public int $id;\n    public string $company;\n    public string $personalName;\n    public string $login;\n    public string $guid;\n    public string $email;\n    public string $phone;\n    public string $fax;\n    public string $address;\n    public string $postalCode;\n    public string $city;\n    public string $state;\n    public string $country;\n    public string $description;\n    public string $externalId;\n    public bool $enabled;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            ['cname' => 'company'],\n            ['pname' => 'personalName'],\n            'login',\n            'guid',\n            'email',\n            'phone',\n            'fax',\n            'address',\n            ['pcode' => 'postalCode'],\n            'city',\n            'state',\n            'country',\n            'external-id',\n            'description',\n        ]);\n\n        $this->enabled = '0' === (string) $apiResponse->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Customer/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Customer;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $guid;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'guid',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Database/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Database;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $name;\n    public string $type;\n    public int $webspaceId;\n    public int $dbServerId;\n    public int $defaultUserId;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'name',\n            'type',\n            'webspace-id',\n            'db-server-id',\n            'default-user-id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Database/UserInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Database;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass UserInfo extends AbstractStruct\n{\n    public int $id;\n    public string $login;\n    public int $dbId;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'login',\n            'db-id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/DatabaseServer/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\DatabaseServer;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $host;\n    public int $port;\n    public string $type;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'host',\n            'port',\n            'type',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Dns/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Dns;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public int $siteId;\n    public int $siteAliasId;\n    public string $type;\n    public string $host;\n    public string $value;\n    public string $opt;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'site-id',\n            'site-alias-id',\n            'type',\n            'host',\n            'value',\n            'opt',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/EventLog/DetailedEvent.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\EventLog;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass DetailedEvent extends AbstractStruct\n{\n    public int $id;\n    public string $type;\n    public int $time;\n    public string $class;\n    public string $objectId;\n    public string $user;\n    public string $host;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'type',\n            'time',\n            'class',\n            ['obj_id' => 'objectId'],\n            'user',\n            'host',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/EventLog/Event.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\EventLog;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Event extends AbstractStruct\n{\n    public string $type;\n    public int $time;\n    public string $class;\n    public string $id;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'type',\n            'time',\n            'class',\n            'id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Ip/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Ip;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $ipAddress;\n    public string $netmask;\n    public string $type;\n    public string $interface;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'ip_address',\n            'netmask',\n            'type',\n            'interface',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Locale/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Locale;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $id;\n    public string $language;\n    public string $country;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            ['lang' => 'language'],\n            'country',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Mail/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Mail;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public int $id;\n    public string $name;\n    public string $description;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'name',\n            'description',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Mail/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Mail;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $name;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'name',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/PhpHandler/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\PhpHandler;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $id;\n    public string $displayName;\n    public string $fullVersion;\n    public string $version;\n    public string $type;\n    public string $path;\n    public string $clipath;\n    public string $phpini;\n    public string $custom;\n    public string $handlerStatus;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'display-name',\n            'full-version',\n            'version',\n            'type',\n            'path',\n            'clipath',\n            'phpini',\n            'custom',\n            'handler-status',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/ProtectedDirectory/DataInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\ProtectedDirectory;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass DataInfo extends AbstractStruct\n{\n    public string $name;\n    public string $header;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'header',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/ProtectedDirectory/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\ProtectedDirectory;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/ProtectedDirectory/UserInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\ProtectedDirectory;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass UserInfo extends AbstractStruct\n{\n    public int $id;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Reseller/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Reseller;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public int $id;\n    public string $personalName;\n    public string $login;\n    public array $permissions;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        if (!is_null($apiResponse->{'gen-info'})) {\n            $this->initScalarProperties($apiResponse->{'gen-info'}, [\n                ['pname' => 'personalName'],\n                'login',\n            ]);\n        }\n\n        $this->permissions = [];\n        foreach ($apiResponse->permissions->permission ?? [] as $permissionInfo) {\n            $this->permissions[(string) $permissionInfo->name] = (string) $permissionInfo->value;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Reseller/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Reseller;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $guid;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'guid',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/SecretKey/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\SecretKey;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $key;\n    public string $ipAddress;\n    public string $description;\n    public string $login;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'key',\n            'ip_address',\n            'description',\n            'login',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Admin.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Admin extends AbstractStruct\n{\n    public string $companyName;\n    public string $name;\n    public string $email;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            ['admin_cname' => 'companyName'],\n            ['admin_pname' => 'name'],\n            ['admin_email' => 'email'],\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public string $serverName;\n    public string $serverGuid;\n    public string $mode;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'server_name',\n            'server_guid',\n            'mode',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Preferences.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Preferences extends AbstractStruct\n{\n    public int $statTtl;\n    public int $trafficAccounting;\n    public int $restartApacheInterval;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'stat_ttl',\n            'traffic_accounting',\n            'restart_apache_interval',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/SessionPreferences.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass SessionPreferences extends AbstractStruct\n{\n    public int $loginTimeout;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'login_timeout',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/DiskSpace.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass DiskSpace extends AbstractStruct\n{\n    public int $total;\n    public int $used;\n    public int $free;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'total',\n            'used',\n            'free',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/LoadAverage.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass LoadAverage extends AbstractStruct\n{\n    public float $load1min;\n    public float $load5min;\n    public float $load15min;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->load1min = (float) $apiResponse->l1 / 100.0;\n        $this->load5min = (float) $apiResponse->l5 / 100.0;\n        $this->load15min = (float) $apiResponse->l15 / 100.0;\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/Memory.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Memory extends AbstractStruct\n{\n    public int $total;\n    public int $used;\n    public int $free;\n    public int $shared;\n    public int $buffer;\n    public int $cached;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'total',\n            'used',\n            'free',\n            'shared',\n            'buffer',\n            'cached',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/Objects.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Objects extends AbstractStruct\n{\n    public int $clients;\n    public int $domains;\n    public int $databases;\n    public int $activeDomains;\n    public int $mailBoxes;\n    public int $mailRedirects;\n    public int $mailGroups;\n    public int $mailResponders;\n    public int $databaseUsers;\n    public int $problemClients;\n    public int $problemDomains;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'clients',\n            'domains',\n            'databases',\n            ['active_domains' => 'activeDomains'],\n            ['mail_boxes' => 'mailBoxes'],\n            ['mail_redirects' => 'mailRedirects'],\n            ['mail_groups' => 'mailGroups'],\n            ['mail_responders' => 'mailResponders'],\n            ['database_users' => 'databaseUsers'],\n            ['problem_clients' => 'problemClients'],\n            ['problem_domains' => 'problemDomains'],\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/Other.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Other extends AbstractStruct\n{\n    public string $cpu;\n    public int $uptime;\n    public bool $insideVz;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'cpu',\n            'uptime',\n            ['inside_vz' => 'insideVz'],\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/Swap.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Swap extends AbstractStruct\n{\n    public int $total;\n    public int $used;\n    public int $free;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'total',\n            'used',\n            'free',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics/Version.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server\\Statistics;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Version extends AbstractStruct\n{\n    public string $internalName;\n    public string $version;\n    public string $build;\n    public string $osName;\n    public string $osVersion;\n    public string $osRelease;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            ['plesk_name' => 'internalName'],\n            ['plesk_version' => 'version'],\n            ['plesk_build' => 'build'],\n            ['plesk_os' => 'osName'],\n            ['plesk_os_version' => 'osVersion'],\n            ['os_release' => 'osRelease'],\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/Statistics.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Statistics extends AbstractStruct\n{\n    /** @var Statistics\\Objects */\n    public $objects;\n\n    /** @var Statistics\\Version */\n    public $version;\n\n    /** @var Statistics\\Other */\n    public $other;\n\n    /** @var Statistics\\LoadAverage */\n    public $loadAverage;\n\n    /** @var Statistics\\Memory */\n    public $memory;\n\n    /** @var Statistics\\Swap */\n    public $swap;\n\n    /** @var Statistics\\DiskSpace[] */\n    public $diskSpace;\n\n    /**\n     * @param \\SimpleXMLElement $apiResponse\n     * @psalm-suppress PossiblyNullArgument\n     */\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->objects = new Statistics\\Objects($apiResponse->objects);\n        $this->version = new Statistics\\Version($apiResponse->version);\n        $this->other = new Statistics\\Other($apiResponse->other);\n        $this->loadAverage = new Statistics\\LoadAverage($apiResponse->load_avg);\n        $this->memory = new Statistics\\Memory($apiResponse->mem);\n        $this->swap = new Statistics\\Swap($apiResponse->swap);\n\n        $this->diskSpace = [];\n        foreach ($apiResponse->diskspace ?? [] as $disk) {\n            $this->diskSpace[(string) $disk->device->name] = new Statistics\\DiskSpace($disk->device);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Server/UpdatesInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Server;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass UpdatesInfo extends AbstractStruct\n{\n    public string $lastInstalledUpdate;\n    public bool $installUpdatesAutomatically;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'last_installed_update',\n            'install_updates_automatically',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/ServicePlan/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\ServicePlan;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $name;\n    public string $guid;\n    public string $externalId;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'name',\n            'guid',\n            'external-id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/ServicePlanAddon/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\ServicePlanAddon;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $name;\n    public string $guid;\n    public string $externalId;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'name',\n            'guid',\n            'external-id',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Session/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Session;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $id;\n    public string $type;\n    public string $ipAddress;\n    public string $login;\n    public string $loginTime;\n    public string $idle;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'type',\n            'ip-address',\n            'login',\n            'login-time',\n            'idle',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Site/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Site;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public int $id;\n    public string $creationDate;\n    public string $name;\n    public string $asciiName;\n    public string $guid;\n    public string $status;\n    public int $realSize;\n    public array $ipAddresses = [];\n    public string $description;\n    public string $webspaceGuid;\n    public int $webspaceId;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            ['cr_date' => 'creationDate'],\n            'name',\n            'ascii-name',\n            'status',\n            'real_size',\n            'guid',\n            'description',\n            'webspace-guid',\n            'webspace-id',\n        ]);\n\n        foreach ($apiResponse->dns_ip_address ?? [] as $ip) {\n            $this->ipAddresses[] = (string) $ip;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Site/HostingInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Site;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass HostingInfo extends AbstractStruct\n{\n    public array $properties = [];\n    public string $ipAddress;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        foreach ($apiResponse->vrt_hst->property ?? [] as $property) {\n            $this->properties[(string) $property->name] = (string) $property->value;\n        }\n\n        if (!is_null($apiResponse->vrt_hst)) {\n            $this->initScalarProperties($apiResponse->vrt_hst, [\n                'ip_address',\n            ]);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Site/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Site;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $guid;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'guid',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/SiteAlias/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\SiteAlias;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public string $name;\n    public string $asciiName;\n    public string $status;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'ascii-name',\n            'status',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/SiteAlias/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\SiteAlias;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public string $status;\n    public int $id;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'status',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Subdomain/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Subdomain;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $parent;\n    public string $name;\n    public array $properties;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->properties = [];\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'parent',\n            'name',\n        ]);\n        foreach ($apiResponse->property ?? [] as $propertyInfo) {\n            $this->properties[(string) $propertyInfo->name] = (string) $propertyInfo->value;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Ui/CustomButton.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Ui;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass CustomButton extends AbstractStruct\n{\n    public int $id;\n    public int $sortKey;\n    public bool $public;\n    public bool $internal;\n    public bool $noFrame;\n    public string $place;\n    public string $url;\n    public string $text;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, ['id']);\n\n        if (!is_null($apiResponse->properties)) {\n            $this->initScalarProperties($apiResponse->properties, [\n                'sort_key',\n                'public',\n                'internal',\n                ['noframe' => 'noFrame'],\n                'place',\n                'url',\n                'text',\n            ]);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/DiskUsage.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass DiskUsage extends AbstractStruct\n{\n    public int $httpdocs;\n    public int $httpsdocs;\n    public int $subdomains;\n    public int $anonftp;\n    public int $logs;\n    public int $dbases;\n    public int $mailboxes;\n    public int $maillists;\n    public int $domaindumps;\n    public int $configs;\n    public int $chroot;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'httpdocs',\n            'httpsdocs',\n            'subdomains',\n            'anonftp',\n            'logs',\n            'dbases',\n            'mailboxes',\n            'maillists',\n            'domaindumps',\n            'configs',\n            'chroot',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/GeneralInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass GeneralInfo extends AbstractStruct\n{\n    public int $id;\n    public string $creationDate;\n    public string $name;\n    public string $asciiName;\n    public string $status;\n    public int $realSize;\n    public int $ownerId;\n    public array $ipAddresses = [];\n    public string $guid;\n    public string $vendorGuid;\n    public string $description;\n    public string $adminDescription;\n    public bool $enabled;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            ['cr_date' => 'creationDate'],\n            'name',\n            'ascii-name',\n            'status',\n            'real_size',\n            'owner-id',\n            'guid',\n            'vendor-guid',\n            'description',\n            'admin-description',\n        ]);\n\n        foreach ($apiResponse->dns_ip_address ?? [] as $ip) {\n            $this->ipAddresses[] = (string) $ip;\n        }\n\n        $this->enabled = '0' === (string) $apiResponse->status;\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/HostingPropertyInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass HostingPropertyInfo extends AbstractStruct\n{\n    public string $name;\n    public string $type;\n    public string $label;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'type',\n            'label',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/Info.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Info extends AbstractStruct\n{\n    public int $id;\n    public string $guid;\n    public string $name;\n\n    public function __construct(\\SimpleXMLElement $apiResponse, string $name = '')\n    {\n        $this->initScalarProperties($apiResponse, [\n            'id',\n            'guid',\n        ]);\n        $this->name = $name;\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/Limit.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Limit extends AbstractStruct\n{\n    public string $name;\n    public string $value;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'value',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/LimitDescriptor.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass LimitDescriptor extends AbstractStruct\n{\n    public array $limits;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->limits = [];\n\n        foreach ($apiResponse->descriptor->property ?? [] as $propertyInfo) {\n            $this->limits[(string) $propertyInfo->name] = new LimitInfo($propertyInfo);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/LimitInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass LimitInfo extends AbstractStruct\n{\n    public string $name;\n    public string $type;\n    public string $label;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'type',\n            'label',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/Limits.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass Limits extends AbstractStruct\n{\n    public string $overuse;\n    public array $limits;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, ['overuse']);\n        $this->limits = [];\n\n        foreach ($apiResponse->limit ?? [] as $limit) {\n            $this->limits[(string) $limit->name] = new Limit($limit);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/PermissionDescriptor.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass PermissionDescriptor extends AbstractStruct\n{\n    public array $permissions;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->permissions = [];\n\n        foreach ($apiResponse->descriptor->property ?? [] as $propertyInfo) {\n            $this->permissions[(string) $propertyInfo->name] = new PermissionInfo($propertyInfo);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/PermissionInfo.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass PermissionInfo extends AbstractStruct\n{\n    public string $name;\n    public string $type;\n    public string $label;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->initScalarProperties($apiResponse, [\n            'name',\n            'type',\n            'label',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/PhpSettings.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass PhpSettings extends AbstractStruct\n{\n    public array $properties;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->properties = [];\n\n        foreach ($apiResponse->webspace->get->result->data->{'php-settings'}->setting ?? [] as $setting) {\n            $this->properties[(string) $setting->name] = (string) $setting->value;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/Struct/Webspace/PhysicalHostingDescriptor.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api\\Struct\\Webspace;\n\nuse PleskX\\Api\\AbstractStruct;\n\nclass PhysicalHostingDescriptor extends AbstractStruct\n{\n    public array $properties;\n\n    public function __construct(\\SimpleXMLElement $apiResponse)\n    {\n        $this->properties = [];\n\n        foreach ($apiResponse->descriptor->property ?? [] as $propertyInfo) {\n            $this->properties[(string) $propertyInfo->name] = new HostingPropertyInfo($propertyInfo);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Api/XmlResponse.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskX\\Api;\n\n/**\n * XML wrapper for responses.\n */\nclass XmlResponse extends \\SimpleXMLElement\n{\n    /**\n     * Retrieve value by node name.\n     *\n     * @param string $node\n     *\n     * @return string\n     */\n    public function getValue(string $node): string\n    {\n        $result = $this->xpath('//' . $node);\n        if (is_array($result) && isset($result[0])) {\n            return (string) $result[0];\n        }\n\n        return '';\n    }\n}\n"
  },
  {
    "path": "tests/AbstractTestCase.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PHPUnit\\Framework\\TestCase;\nuse PleskX\\Api\\Client;\nuse PleskXTest\\Utility\\PasswordProvider;\n\nabstract class AbstractTestCase extends TestCase\n{\n    protected static Client $client;\n\n    private static array $webspaces = [];\n    private static array $servicePlans = [];\n    private static array $servicePlanAddons = [];\n\n    public static function setUpBeforeClass(): void\n    {\n        $login = getenv('REMOTE_LOGIN') ?: 'admin';\n        $password = getenv('REMOTE_PASSWORD') ?: 'changeme1Q**';\n        $host = getenv('REMOTE_HOST') ?: 'localhost';\n        $port = 8443;\n        $scheme = 'https';\n\n        $url = getenv('REMOTE_URL');\n        if ($url) {\n            $parsedUrl = parse_url($url);\n            list($host, $port, $scheme) = [$parsedUrl['host'], $parsedUrl['port'], $parsedUrl['scheme']];\n        }\n\n        static::$client = new Client($host, $port, $scheme);\n        static::$client->setCredentials($login, $password);\n\n        $proxy = getenv('REMOTE_PROXY');\n        if ($proxy) {\n            static::$client->setProxy($proxy);\n        }\n    }\n\n    public static function tearDownAfterClass(): void\n    {\n        foreach (self::$webspaces as $webspace) {\n            try {\n                static::$client->webspace()->delete('id', $webspace->id);\n                // phpcs:ignore\n            } catch (\\Exception $e) {\n            }\n        }\n\n        foreach (self::$servicePlans as $servicePlan) {\n            try {\n                static::$client->servicePlan()->delete('id', $servicePlan->id);\n                // phpcs:ignore\n            } catch (\\Exception $e) {\n            }\n        }\n\n        foreach (self::$servicePlanAddons as $servicePlanAddon) {\n            try {\n                static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);\n                // phpcs:ignore\n            } catch (\\Exception $e) {\n            }\n        }\n    }\n\n    protected static function getIpAddress(): string\n    {\n        $ips = static::$client->ip()->get();\n        $ipInfo = reset($ips);\n\n        return $ipInfo->ipAddress;\n    }\n\n    protected static function createWebspace(): \\PleskX\\Api\\Struct\\Webspace\\Info\n    {\n        $id = uniqid();\n        $webspace = static::$client->webspace()->create(\n            [\n                'name' => \"test{$id}.test\",\n                'ip_address' => static::getIpAddress(),\n            ],\n            [\n                'ftp_login' => \"u{$id}\",\n                'ftp_password' => PasswordProvider::STRONG_PASSWORD,\n            ]\n        );\n        self::$webspaces[] = $webspace;\n\n        return $webspace;\n    }\n\n    protected static function createServicePlan(): \\PleskX\\Api\\Struct\\ServicePlan\\Info\n    {\n        $id = uniqid();\n        $servicePlan = static::$client->servicePlan()->create(['name' => \"test{$id}plan\"]);\n\n        self::$servicePlans[] = $servicePlan;\n\n        return $servicePlan;\n    }\n\n    protected static function createServicePlanAddon(): \\PleskX\\Api\\Struct\\ServicePlanAddon\\Info\n    {\n        $id = uniqid();\n        $servicePlanAddon = static::$client->servicePlanAddon()->create(['name' => \"test{$id}planaddon\"]);\n\n        self::$servicePlanAddons[] = $servicePlanAddon;\n\n        return $servicePlanAddon;\n    }\n}\n"
  },
  {
    "path": "tests/ApiClientTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskX\\Api\\Client\\Exception;\n\nclass ApiClientTest extends AbstractTestCase\n{\n    public function testWrongProtocol()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1005);\n\n        $packet = static::$client->getPacket('100.0.0');\n        $packet->addChild('server')->addChild('get_protos');\n        static::$client->request($packet);\n    }\n\n    public function testUnknownOperator()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1014);\n\n        $packet = static::$client->getPacket();\n        $packet->addChild('unknown');\n        static::$client->request($packet);\n    }\n\n    public function testInvalidXmlRequest()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1014);\n\n        static::$client->request('<packet><wrongly formatted xml</packet>');\n    }\n\n    public function testInvalidCredentials()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1001);\n\n        $host = static::$client->getHost();\n        $port = static::$client->getPort();\n        $protocol = static::$client->getProtocol();\n        $client = new \\PleskX\\Api\\Client($host, $port, $protocol);\n        $client->setCredentials('bad-login', 'bad-password');\n        $packet = static::$client->getPacket();\n        $packet->addChild('server')->addChild('get_protos');\n        $client->request($packet);\n    }\n\n    public function testInvalidSecretKey()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(11003);\n\n        $host = static::$client->getHost();\n        $port = static::$client->getPort();\n        $protocol = static::$client->getProtocol();\n        $client = new \\PleskX\\Api\\Client($host, $port, $protocol);\n        $client->setSecretKey('bad-key');\n        $packet = static::$client->getPacket();\n        $packet->addChild('server')->addChild('get_protos');\n        $client->request($packet);\n    }\n\n    public function testLatestMajorProtocol()\n    {\n        $packet = static::$client->getPacket('1.6');\n        $packet->addChild('server')->addChild('get_protos');\n        $result = static::$client->request($packet);\n        $this->assertEquals('ok', $result->status);\n    }\n\n    public function testLatestMinorProtocol()\n    {\n        $packet = static::$client->getPacket('1.6.5');\n        $packet->addChild('server')->addChild('get_protos');\n        $result = static::$client->request($packet);\n        $this->assertEquals('ok', $result->status);\n    }\n\n    public function testRequestShortSyntax()\n    {\n        $response = static::$client->request('server.get.gen_info');\n        $this->assertGreaterThan(0, strlen($response->gen_info->server_name));\n    }\n\n    public function testOperatorPlainRequest()\n    {\n        $response = static::$client->server()->request('get.gen_info');\n        $this->assertGreaterThan(0, strlen($response->gen_info->server_name));\n        $this->assertEquals(36, strlen($response->getValue('server_guid')));\n    }\n\n    public function testRequestArraySyntax()\n    {\n        $response = static::$client->request([\n            'server' => [\n                'get' => [\n                    'gen_info' => '',\n                ],\n            ],\n        ]);\n        $this->assertGreaterThan(0, strlen($response->gen_info->server_name));\n    }\n\n    public function testOperatorArraySyntax()\n    {\n        $response = static::$client->server()->request(['get' => ['gen_info' => '']]);\n        $this->assertGreaterThan(0, strlen($response->gen_info->server_name));\n    }\n\n    public function testMultiRequest()\n    {\n        $responses = static::$client->multiRequest([\n            'server.get_protos',\n            'server.get.gen_info',\n        ]);\n\n        $this->assertCount(2, $responses);\n\n        $protos = (array) $responses[0]->protos->proto;\n        $generalInfo = $responses[1];\n\n        $this->assertContains('1.6.6.0', $protos);\n        $this->assertGreaterThan(0, strlen($generalInfo->gen_info->server_name));\n    }\n\n    public function testConnectionError()\n    {\n        $this->expectException(\\PleskX\\Api\\Client\\Exception::class);\n\n        $client = new \\PleskX\\Api\\Client('invalid-host.dom');\n        $client->server()->getProtos();\n    }\n\n    public function testGetHost()\n    {\n        $client = new \\PleskX\\Api\\Client('example.dom');\n        $this->assertEquals('example.dom', $client->getHost());\n    }\n\n    public function testGetPort()\n    {\n        $client = new \\PleskX\\Api\\Client('example.dom', 12345);\n        $this->assertEquals(12345, $client->getPort());\n    }\n\n    public function testGetProtocol()\n    {\n        $client = new \\PleskX\\Api\\Client('example.dom', 8880, 'http');\n        $this->assertEquals('http', $client->getProtocol());\n    }\n\n    public function testSetVerifyResponse()\n    {\n        static::$client->setVerifyResponse(function ($xml) {\n            if ($xml->xpath('//proto')) {\n                throw new Exception('proto');\n            }\n        });\n\n        try {\n            static::$client->server()->getProtos();\n        } catch (Exception $e) {\n            $this->assertEquals('proto', $e->getMessage());\n        } finally {\n            static::$client->setVerifyResponse();\n        }\n    }\n}\n"
  },
  {
    "path": "tests/CertificateTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskX\\Api\\Struct\\Certificate as Struct;\n\nclass CertificateTest extends AbstractTestCase\n{\n    private array $certificateProperties = [\n        'bits' => 2048,\n        'country' => 'CH',\n        'state' => 'Schaffhausen',\n        'location' => 'Schaffhausen',\n        'company' => 'Plesk',\n        'email' => 'info@plesk.com',\n        'name' => 'plesk.com',\n    ];\n    private array $distinguishedNames = [\n        \"countryName\" => \"CH\",\n        \"stateOrProvinceName\" => \"Schaffhausen\",\n        \"localityName\" => \"Schaffhausen\",\n        \"organizationName\" => \"Plesk\",\n        \"emailAddress\" => \"info@plesk.com\"\n    ];\n\n    public function testGenerate()\n    {\n        $certificate = static::$client->certificate()->generate($this->certificateProperties);\n        $this->assertGreaterThan(0, strlen($certificate->request));\n        $this->assertStringStartsWith('-----BEGIN CERTIFICATE REQUEST-----', $certificate->request);\n        $this->assertGreaterThan(0, strlen($certificate->privateKey));\n        $this->assertStringStartsWith('-----BEGIN PRIVATE KEY-----', $certificate->privateKey);\n    }\n\n    public function testInstall()\n    {\n        $certificate = static::$client->certificate()->generate($this->certificateProperties);\n\n        $result = static::$client->certificate()->install([\n            'name' => 'test',\n            'admin' => true,\n        ], $certificate->request, $certificate->privateKey);\n        $this->assertTrue($result);\n\n        static::$client->certificate()->delete('test', ['admin' => true]);\n    }\n\n    public function testUpdate()\n    {\n        $payLoad = [\n            'name' => 'test',\n            'admin' => true,\n        ];\n        $certificate = static::$client->certificate()->generate($this->certificateProperties);\n        static::$client->certificate()->install($payLoad, $certificate);\n\n        $certificate = $this->generateCertificateOpenSsl($this->distinguishedNames);\n        $result = static::$client->certificate()->update($payLoad, $certificate);\n        $this->assertTrue($result);\n\n        static::$client->certificate()->delete('test', ['admin' => true]);\n    }\n\n    public function testDelete()\n    {\n        $certificate = static::$client->certificate()->generate($this->certificateProperties);\n\n        static::$client->certificate()->install([\n            'name' => 'test',\n            'admin' => true,\n        ], $certificate);\n\n        $result = static::$client->certificate()->delete('test', ['admin' => true]);\n        $this->assertTrue($result);\n    }\n\n    private function generateCertificateOpenSsl(array $dn): Struct\\Info\n    {\n        $privkey = openssl_pkey_new([\n            \"private_key_bits\" => 2048,\n            \"private_key_type\" => OPENSSL_KEYTYPE_RSA,\n        ]);\n        $csr = openssl_csr_new($dn, $privkey, ['digest_alg' => 'sha256']);\n        $x509 = openssl_csr_sign($csr, null, $privkey, $days = 365, ['digest_alg' => 'sha256']);\n\n        openssl_csr_export($csr, $csrout);\n        openssl_x509_export($x509, $certout);\n        openssl_pkey_export($privkey, $pkeyout);\n\n        return new Struct\\Info([\n            'publicKey' => $certout,\n            'request' => $csrout,\n            'privateKey' => $pkeyout\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/CustomerTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\KeyLimitChecker;\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass CustomerTest extends AbstractTestCase\n{\n    private array $customerProperties;\n\n    public function setUp(): void\n    {\n        $this->customerProperties = [\n            'cname' => 'Plesk',\n            'pname' => 'John Smith',\n            'login' => 'john-unit-test',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n            'email' => 'john@smith.com',\n            'external-id' => 'link:12345',\n            'description' => 'Good guy',\n        ];\n    }\n\n    public function testCreate()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        $this->assertIsInt($customer->id);\n        $this->assertGreaterThan(0, $customer->id);\n\n        static::$client->customer()->delete('id', $customer->id);\n    }\n\n    public function testDelete()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        $result = static::$client->customer()->delete('id', $customer->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        $customerInfo = static::$client->customer()->get('id', $customer->id);\n        $this->assertEquals('Plesk', $customerInfo->company);\n        $this->assertEquals('John Smith', $customerInfo->personalName);\n        $this->assertEquals('john-unit-test', $customerInfo->login);\n        $this->assertEquals('john@smith.com', $customerInfo->email);\n        $this->assertEquals('Good guy', $customerInfo->description);\n        $this->assertEquals('link:12345', $customerInfo->externalId);\n        $this->assertEquals($customer->id, $customerInfo->id);\n\n        static::$client->customer()->delete('id', $customer->id);\n    }\n\n    public function testGetAll()\n    {\n        $keyInfo = static::$client->server()->getKeyInfo();\n\n        if (!KeyLimitChecker::checkByType($keyInfo, KeyLimitChecker::LIMIT_CLIENTS, 2)) {\n            $this->markTestSkipped('License does not allow to create more than 1 customer.');\n        }\n\n        static::$client->customer()->create([\n            'pname' => 'John Smith',\n            'login' => 'customer-a',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n        static::$client->customer()->create([\n            'pname' => 'Mike Black',\n            'login' => 'customer-b',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $customersInfo = static::$client->customer()->getAll();\n        $this->assertIsArray($customersInfo);\n\n        $customersCheck = array_filter($customersInfo, function ($value) {\n            return $value->personalName === 'John Smith' || $value->personalName === 'Mike Black';\n        });\n        $this->assertCount(2, $customersCheck);\n\n        static::$client->customer()->delete('login', 'customer-a');\n        static::$client->customer()->delete('login', 'customer-b');\n    }\n\n    public function testGetAllEmpty()\n    {\n        $customersInfo = static::$client->customer()->getAll();\n        $this->assertCount(0, $customersInfo);\n    }\n\n    public function testEnable()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        static::$client->customer()->disable('id', $customer->id);\n        static::$client->customer()->enable('id', $customer->id);\n        $customerInfo = static::$client->customer()->get('id', $customer->id);\n        $this->assertTrue($customerInfo->enabled);\n\n        static::$client->customer()->delete('id', $customer->id);\n    }\n\n    public function testDisable()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        static::$client->customer()->disable('id', $customer->id);\n        $customerInfo = static::$client->customer()->get('id', $customer->id);\n        $this->assertFalse($customerInfo->enabled);\n\n        static::$client->customer()->delete('id', $customer->id);\n    }\n\n    public function testSetProperties()\n    {\n        $customer = static::$client->customer()->create($this->customerProperties);\n        static::$client->customer()->setProperties('id', $customer->id, [\n            'pname' => 'Mike Black',\n            'email' => 'mike@black.com',\n        ]);\n        $customerInfo = static::$client->customer()->get('id', $customer->id);\n        $this->assertEquals('Mike Black', $customerInfo->personalName);\n        $this->assertEquals('mike@black.com', $customerInfo->email);\n\n        static::$client->customer()->delete('id', $customer->id);\n    }\n}\n"
  },
  {
    "path": "tests/DatabaseServerTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass DatabaseServerTest extends AbstractTestCase\n{\n    public function testGetSupportedTypes()\n    {\n        $types = static::$client->databaseServer()->getSupportedTypes();\n        $this->assertGreaterThan(0, count($types));\n        $this->assertContains('mysql', $types);\n    }\n\n    public function testGet()\n    {\n        $dbServer = static::$client->databaseServer()->get('id', 1);\n        $this->assertEquals('localhost', $dbServer->host);\n        $this->assertGreaterThan(0, $dbServer->port);\n    }\n\n    public function testGetAll()\n    {\n        $dbServers = static::$client->databaseServer()->getAll();\n        $this->assertIsArray($dbServers);\n        $this->assertGreaterThan(0, count($dbServers));\n        $this->assertEquals('localhost', $dbServers[0]->host);\n    }\n\n    public function testGetDefault()\n    {\n        $dbServer = static::$client->databaseServer()->getDefault('mysql');\n        $this->assertEquals('mysql', $dbServer->type);\n        $this->assertGreaterThan(0, $dbServer->id);\n    }\n}\n"
  },
  {
    "path": "tests/DatabaseTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass DatabaseTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n    private static \\PleskX\\Api\\Struct\\DatabaseServer\\Info $databaseServer;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n        static::$webspace = static::createWebspace();\n        static::$databaseServer = static::$client->databaseServer()->getDefault('mysql');\n    }\n\n    public function testCreate()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    public function testCreateUser()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $user = $this->createUser([\n            'db-id' => $database->id,\n            'login' => 'test_user1',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n        static::$client->database()->deleteUser('id', $user->id);\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    public function testUpdateUser()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $user = $this->createUser([\n            'db-id' => $database->id,\n            'login' => 'test_user1',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n        $updatedUser = static::$client->database()->updateUser([\n            'id' => $user->id,\n            'login' => 'test_user2',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n        $this->assertEquals(true, $updatedUser);\n        static::$client->database()->deleteUser('id', $user->id);\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    public function testGetById()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n\n        $db = static::$client->database()->get('id', $database->id);\n        $this->assertEquals('test1', $db->name);\n        $this->assertEquals(static::$databaseServer->type, $db->type);\n        $this->assertEquals(static::$webspace->id, $db->webspaceId);\n        $this->assertEquals(static::$databaseServer->id, $db->dbServerId);\n\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    public function testGetAllByWebspaceId()\n    {\n        $db1 = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $db2 = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test2',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $databases = static::$client->database()->getAll('webspace-id', static::$webspace->id);\n        $this->assertEquals('test1', $databases[0]->name);\n        $this->assertEquals('test2', $databases[1]->name);\n        $this->assertEquals(static::$webspace->id, $databases[0]->webspaceId);\n        $this->assertEquals(static::$databaseServer->id, $databases[1]->dbServerId);\n\n        static::$client->database()->delete('id', $db1->id);\n        static::$client->database()->delete('id', $db2->id);\n    }\n\n    public function testGetUserById()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n\n        $user = $this->createUser([\n            'db-id' => $database->id,\n            'login' => 'test_user1',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $dbUser = static::$client->database()->getUser('id', $user->id);\n        $this->assertEquals('test_user1', $dbUser->login);\n        $this->assertEquals($database->id, $dbUser->dbId);\n\n        static::$client->database()->deleteUser('id', $user->id);\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    public function testGetAllUsersByDbId()\n    {\n        $db1 = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $db2 = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test2',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $user1 = $this->createUser([\n            'db-id' => $db1->id,\n            'login' => 'test_user1',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $user2 = $this->createUser([\n            'db-id' => $db1->id,\n            'login' => 'test_user2',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $user3 = $this->createUser([\n            'db-id' => $db2->id,\n            'login' => 'test_user3',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $dbUsers = static::$client->database()->getAllUsers('db-id', $db1->id);\n        $this->assertEquals(2, count($dbUsers));\n        $this->assertEquals('test_user1', $dbUsers[0]->login);\n        $this->assertEquals('test_user2', $dbUsers[1]->login);\n\n        static::$client->database()->deleteUser('id', $user1->id);\n        static::$client->database()->deleteUser('id', $user2->id);\n        static::$client->database()->deleteUser('id', $user3->id);\n        static::$client->database()->delete('id', $db1->id);\n        static::$client->database()->delete('id', $db2->id);\n    }\n\n    public function testDelete()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $result = static::$client->database()->delete('id', $database->id);\n        $this->assertTrue($result);\n    }\n\n    public function testDeleteUser()\n    {\n        $database = $this->createDatabase([\n            'webspace-id' => static::$webspace->id,\n            'name' => 'test1',\n            'type' => static::$databaseServer->type,\n            'db-server-id' => static::$databaseServer->id,\n        ]);\n        $user = $this->createUser([\n            'db-id' => $database->id,\n            'login' => 'test_user1',\n            'password' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $result = static::$client->database()->deleteUser('id', $user->id);\n        $this->assertTrue($result);\n        static::$client->database()->delete('id', $database->id);\n    }\n\n    private function createDatabase(array $params): \\PleskX\\Api\\Struct\\Database\\Info\n    {\n        $database = static::$client->database()->create($params);\n        $this->assertIsInt($database->id);\n        $this->assertGreaterThan(0, $database->id);\n\n        return $database;\n    }\n\n    private function createUser(array $params): \\PleskX\\Api\\Struct\\Database\\UserInfo\n    {\n        $user = static::$client->database()->createUser($params);\n        $this->assertIsInt($user->id);\n        $this->assertGreaterThan(0, $user->id);\n\n        return $user;\n    }\n\n    public function testGetAllForWebspaceWithNoDatabases()\n    {\n        $databases = static::$client->database()->getAll('webspace-id', static::$webspace->id);\n\n        $this->assertIsArray($databases);\n        $this->assertEmpty($databases);\n    }\n}\n"
  },
  {
    "path": "tests/DnsTemplateTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass DnsTemplateTest extends AbstractTestCase\n{\n    private static bool $isDnsSupported;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n\n        $serviceStates = static::$client->server()->getServiceStates();\n        static::$isDnsSupported = $serviceStates['dns'] && ('running' == $serviceStates['dns']['state']);\n    }\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        if (!static::$isDnsSupported) {\n            $this->markTestSkipped('DNS system is not supported.');\n        }\n    }\n\n    public function testCreate()\n    {\n        $dns = static::$client->dnsTemplate()->create([\n            'type' => 'TXT',\n            'host' => 'test.create',\n            'value' => 'value',\n        ]);\n        $this->assertIsInt($dns->id);\n        $this->assertGreaterThan(0, $dns->id);\n        $this->assertEquals(0, $dns->siteId);\n        $this->assertEquals(0, $dns->siteAliasId);\n        static::$client->dnsTemplate()->delete('id', $dns->id);\n    }\n\n    public function testGetById()\n    {\n        $dns = static::$client->dnsTemplate()->create([\n            'type' => 'TXT',\n            'host' => 'test.get.by.id',\n            'value' => 'value',\n        ]);\n\n        $dnsInfo = static::$client->dnsTemplate()->get('id', $dns->id);\n        $this->assertEquals('TXT', $dnsInfo->type);\n        $this->assertEquals('value', $dnsInfo->value);\n\n        static::$client->dnsTemplate()->delete('id', $dns->id);\n    }\n\n    public function testGetAll()\n    {\n        $dns = static::$client->dnsTemplate()->create([\n            'type' => 'TXT',\n            'host' => 'test.get.all',\n            'value' => 'value',\n        ]);\n        $dns2 = static::$client->dnsTemplate()->create([\n            'type' => 'TXT',\n            'host' => 'test.get.all',\n            'value' => 'value2',\n        ]);\n        $dnsInfo = static::$client->dnsTemplate()->getAll();\n        $dsRecords = [];\n        foreach ($dnsInfo as $dnsRec) {\n            if ('TXT' === $dnsRec->type && 0 === strpos($dnsRec->host, 'test.get.all')) {\n                $dsRecords[] = $dnsRec;\n            }\n        }\n        $this->assertCount(2, $dsRecords);\n\n        static::$client->dnsTemplate()->delete('id', $dns->id);\n        static::$client->dnsTemplate()->delete('id', $dns2->id);\n    }\n\n    public function testDelete()\n    {\n        $dns = static::$client->dnsTemplate()->create([\n            'type' => 'TXT',\n            'host' => 'test.delete',\n            'value' => 'value',\n        ]);\n        $result = static::$client->dnsTemplate()->delete('id', $dns->id);\n        $this->assertTrue($result);\n    }\n}\n"
  },
  {
    "path": "tests/DnsTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass DnsTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n    private static bool $isDnsSupported;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n\n        $serviceStates = static::$client->server()->getServiceStates();\n        static::$isDnsSupported = isset($serviceStates['dns']) && ('running' == $serviceStates['dns']['state']);\n\n        if (static::$isDnsSupported) {\n            static::$webspace = static::createWebspace();\n        }\n    }\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        if (!static::$isDnsSupported) {\n            $this->markTestSkipped('DNS system is not supported.');\n        }\n    }\n\n    public function testCreate()\n    {\n        $dns = static::$client->dns()->create([\n            'site-id' => static::$webspace->id,\n            'type' => 'TXT',\n            'host' => 'host',\n            'value' => 'value',\n        ]);\n        $this->assertIsInt($dns->id);\n        $this->assertGreaterThan(0, $dns->id);\n        static::$client->dns()->delete('id', $dns->id);\n    }\n\n    /**\n     * @return \\SimpleXMLElement[]\n     */\n    public function testBulkCreate(): array\n    {\n        $response = static::$client->dns()->bulkCreate([\n            [\n                'site-id' => static::$webspace->id,\n                'type' => 'TXT',\n                'host' => 'host',\n                'value' => 'value',\n            ],\n            [\n                'site-id' => static::$webspace->id,\n                'type' => 'A',\n                'host' => 'host',\n                'value' => '1.1.1.1',\n            ],\n            [\n                'site-id' => static::$webspace->id,\n                'type' => 'MX',\n                'host' => 'custom-mail',\n                'value' => '1.1.1.1',\n                'opt' => '10',\n            ],\n        ]);\n\n        $this->assertCount(3, $response);\n\n        foreach ($response as $xml) {\n            $this->assertEquals('ok', (string) $xml->status);\n            $this->assertGreaterThan(0, (int) $xml->id);\n        }\n\n        return $response;\n    }\n\n    /**\n     * @depends testBulkCreate\n     *\n     * @param \\SimpleXMLElement[] $createdRecords\n     */\n    public function testBulkDelete(array $createdRecords)\n    {\n        $createdRecordIds = array_map(function ($record) {\n            return (int) $record->id;\n        }, $createdRecords);\n\n        $response = static::$client->dns()->bulkDelete($createdRecordIds);\n\n        $this->assertCount(3, $response);\n\n        foreach ($response as $xml) {\n            $this->assertEquals('ok', (string) $xml->status);\n            $this->assertGreaterThan(0, (int) $xml->id);\n        }\n    }\n\n    public function testGetById()\n    {\n        $dns = static::$client->dns()->create([\n            'site-id' => static::$webspace->id,\n            'type' => 'TXT',\n            'host' => '',\n            'value' => 'value',\n        ]);\n\n        $dnsInfo = static::$client->dns()->get('id', $dns->id);\n        $this->assertEquals('TXT', $dnsInfo->type);\n        $this->assertEquals(static::$webspace->id, $dnsInfo->siteId);\n        $this->assertEquals('value', $dnsInfo->value);\n\n        static::$client->dns()->delete('id', $dns->id);\n    }\n\n    public function testGetAllByWebspaceId()\n    {\n        $dns = static::$client->dns()->create([\n            'site-id' => static::$webspace->id,\n            'type' => 'DS',\n            'host' => 'host',\n            'value' => '60485 5 1 2BB183AF5F22588179A53B0A98631FAD1A292118',\n        ]);\n        $dns2 = static::$client->dns()->create([\n            'site-id' => static::$webspace->id,\n            'type' => 'DS',\n            'host' => 'host',\n            'value' => '60485 5 1 2BB183AF5F22588179A53B0A98631FAD1A292119',\n        ]);\n        $dnsInfo = static::$client->dns()->getAll('site-id', static::$webspace->id);\n        $dsRecords = [];\n        foreach ($dnsInfo as $dnsRec) {\n            if ('DS' == $dnsRec->type) {\n                $dsRecords[] = $dnsRec;\n            }\n        }\n        $this->assertEquals(2, count($dsRecords));\n        foreach ($dsRecords as $dsRecord) {\n            $this->assertEquals(static::$webspace->id, $dsRecord->siteId);\n        }\n\n        static::$client->dns()->delete('id', $dns->id);\n        static::$client->dns()->delete('id', $dns2->id);\n    }\n\n    public function testDelete()\n    {\n        $dns = static::$client->dns()->create([\n            'site-id' => static::$webspace->id,\n            'type' => 'TXT',\n            'host' => 'host',\n            'value' => 'value',\n        ]);\n        $result = static::$client->dns()->delete('id', $dns->id);\n        $this->assertTrue($result);\n    }\n}\n"
  },
  {
    "path": "tests/EventLogTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass EventLogTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $events = static::$client->eventLog()->get();\n        $this->assertGreaterThan(0, $events);\n\n        $event = reset($events);\n        $this->assertGreaterThan(0, $event->time);\n    }\n\n    public function testGetDetailedLog()\n    {\n        $events = static::$client->eventLog()->getDetailedLog();\n        $this->assertGreaterThan(0, $events);\n\n        $event = reset($events);\n        $this->assertGreaterThan(0, $event->time);\n    }\n\n    public function testGetLastId()\n    {\n        $lastId = static::$client->eventLog()->getLastId();\n        $this->assertGreaterThan(0, $lastId);\n    }\n}\n"
  },
  {
    "path": "tests/IpTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass IpTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $ips = static::$client->ip()->get();\n        $this->assertGreaterThan(0, count($ips));\n\n        $ip = reset($ips);\n        $this->assertMatchesRegularExpression('/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$/', $ip->ipAddress);\n    }\n}\n"
  },
  {
    "path": "tests/LocaleTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass LocaleTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $locales = static::$client->locale()->get();\n        $this->assertGreaterThan(0, count($locales));\n\n        $locale = $locales['en-US'];\n        $this->assertEquals('en-US', $locale->id);\n    }\n\n    public function testGetById()\n    {\n        $locale = static::$client->locale()->get('en-US');\n        $this->assertEquals('en-US', $locale->id);\n    }\n}\n"
  },
  {
    "path": "tests/MailTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass MailTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n    private static bool $isMailSupported;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n\n        $serviceStates = static::$client->server()->getServiceStates();\n        static::$isMailSupported = isset($serviceStates['smtp']) && ('running' == $serviceStates['smtp']['state']);\n\n        if (static::$isMailSupported) {\n            static::$webspace = static::createWebspace();\n        }\n    }\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        if (!static::$isMailSupported) {\n            $this->markTestSkipped('Mail system is not supported.');\n        }\n    }\n\n    public function testCreate()\n    {\n        $mailname = static::$client->mail()->create(\n            'test',\n            static::$webspace->id,\n            true,\n            PasswordProvider::STRONG_PASSWORD\n        );\n\n        $this->assertIsInt($mailname->id);\n        $this->assertGreaterThan(0, $mailname->id);\n        $this->assertEquals('test', $mailname->name);\n\n        static::$client->mail()->delete('name', $mailname->name, static::$webspace->id);\n    }\n\n    public function testCreateMultiForwarding()\n    {\n        $mailname = static::$client->request([\n            'mail' => [\n                'create' => [\n                    'filter' => [\n                        'site-id' => static::$webspace->id,\n                        'mailname' => [\n                            'name' => 'test',\n                            'mailbox' => [\n                                'enabled' => true,\n                            ],\n                            'forwarding' => [\n                                'enabled' => true,\n                                'address' => [\n                                    'user1@example.com',\n                                    'user2@example.com',\n                                ],\n                            ],\n                            'alias' => [\n                                'test1',\n                                'test2',\n                            ],\n                            'password' => [\n                                'value' => PasswordProvider::STRONG_PASSWORD,\n                            ],\n                        ],\n                    ],\n                ],\n            ],\n        ]);\n\n        $mailnameInfo = static::$client->request([\n            'mail' => [\n                'get_info' => [\n                    'filter' => [\n                        'site-id' => static::$webspace->id,\n                        'name' => 'test',\n                    ],\n                    'forwarding' => null,\n                    'aliases' => null,\n                ],\n            ],\n        ]);\n\n        $this->assertSame(2, count($mailnameInfo->mailname->forwarding->address));\n        $this->assertSame(2, count($mailnameInfo->mailname->alias));\n\n        static::$client->mail()->delete('name', 'test', static::$webspace->id);\n    }\n\n    public function testDelete()\n    {\n        $mailname = static::$client->mail()->create('test', static::$webspace->id);\n\n        $result = static::$client->mail()->delete('name', $mailname->name, static::$webspace->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $mailname = static::$client->mail()->create('test', static::$webspace->id);\n\n        $mailnameInfo = static::$client->mail()->get('test', static::$webspace->id);\n        $this->assertEquals('test', $mailnameInfo->name);\n        $this->assertEquals($mailname->id, $mailnameInfo->id);\n\n        static::$client->mail()->delete('name', $mailname->name, static::$webspace->id);\n    }\n\n    public function testGetAll()\n    {\n        $mailname = static::$client->mail()->create('test', static::$webspace->id);\n\n        $mailnamesInfo = static::$client->mail()->getAll(static::$webspace->id);\n        $this->assertCount(1, $mailnamesInfo);\n        $this->assertEquals('test', $mailnamesInfo[0]->name);\n\n        static::$client->mail()->delete('name', $mailname->name, static::$webspace->id);\n    }\n\n    public function testGetAllWithoutMailnames()\n    {\n        $mailnamesInfo = static::$client->mail()->getAll(static::$webspace->id);\n        $this->assertCount(0, $mailnamesInfo);\n    }\n}\n"
  },
  {
    "path": "tests/PhpHandlerTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass PhpHandlerTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $handler = static::$client->phpHandler()->get();\n\n        $this->assertTrue(property_exists($handler, 'type'));\n    }\n\n    public function testGetAll()\n    {\n        $handlers = static::$client->phpHandler()->getAll();\n\n        $this->assertIsArray($handlers);\n        $this->assertNotEmpty($handlers);\n\n        $handler = current($handlers);\n\n        $this->assertIsObject($handler);\n        $this->assertTrue(property_exists($handler, 'type'));\n    }\n\n    public function testGetUnknownHandlerThrowsException()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionMessage('Php handler does not exists');\n\n        static::$client->phpHandler()->get('id', 'this-handler-does-not-exist');\n    }\n}\n"
  },
  {
    "path": "tests/ProtectedDirectoryTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass ProtectedDirectoryTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n        static::$webspace = static::createWebspace();\n    }\n\n    public function testAdd()\n    {\n        $protectedDirectory = static::$client->protectedDirectory()->add('/', static::$webspace->id);\n\n        $this->assertIsObject($protectedDirectory);\n        $this->assertGreaterThan(0, $protectedDirectory->id);\n\n        static::$client->protectedDirectory()->delete('id', $protectedDirectory->id);\n    }\n\n    public function testAddInvalidDirectory()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1019);\n\n        static::$client->protectedDirectory()->add('', static::$webspace->id);\n    }\n\n    public function testDelete()\n    {\n        $protectedDirectory = static::$client->protectedDirectory()->add('/', static::$webspace->id);\n\n        $result = static::$client->protectedDirectory()->delete('id', $protectedDirectory->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGetById()\n    {\n        $protectedDirectory = static::$client->protectedDirectory()->add('test', static::$webspace->id);\n\n        $foundDirectory = static::$client->protectedDirectory()->get('id', $protectedDirectory->id);\n        $this->assertEquals('test', $foundDirectory->name);\n\n        static::$client->protectedDirectory()->delete('id', $protectedDirectory->id);\n    }\n\n    public function testGetUnknownDirectory()\n    {\n        $this->expectException(\\PleskX\\Api\\Exception::class);\n        $this->expectExceptionCode(1013);\n\n        $nonExistentDirectoryId = 99999999;\n        static::$client->protectedDirectory()->get('id', $nonExistentDirectoryId);\n    }\n\n    public function testAddUser()\n    {\n        $protectedDirectory = static::$client->protectedDirectory()->add('/', static::$webspace->id);\n\n        $user = static::$client->protectedDirectory()->addUser(\n            $protectedDirectory,\n            'john',\n            PasswordProvider::STRONG_PASSWORD\n        );\n        $this->assertGreaterThan(0, $user->id);\n\n        static::$client->protectedDirectory()->delete('id', $protectedDirectory->id);\n    }\n\n    public function testDeleteUser()\n    {\n        $protectedDirectory = static::$client->protectedDirectory()->add('/', static::$webspace->id);\n\n        $user = static::$client->protectedDirectory()->addUser(\n            $protectedDirectory,\n            'john',\n            PasswordProvider::STRONG_PASSWORD\n        );\n        $result = static::$client->protectedDirectory()->deleteUser('id', $user->id);\n        $this->assertTrue($result);\n\n        static::$client->protectedDirectory()->delete('id', $protectedDirectory->id);\n    }\n}\n"
  },
  {
    "path": "tests/ResellerTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\KeyLimitChecker;\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass ResellerTest extends AbstractTestCase\n{\n    private array $resellerProperties;\n\n    public function setUp(): void\n    {\n        $this->resellerProperties = [\n            'pname' => 'John Reseller',\n            'login' => 'reseller-unit-test',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n        ];\n    }\n\n    public function testCreate()\n    {\n        $reseller = static::$client->reseller()->create($this->resellerProperties);\n        $this->assertIsInt($reseller->id);\n        $this->assertGreaterThan(0, $reseller->id);\n\n        static::$client->reseller()->delete('id', $reseller->id);\n    }\n\n    public function testDelete()\n    {\n        $reseller = static::$client->reseller()->create($this->resellerProperties);\n        $result = static::$client->reseller()->delete('id', $reseller->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $reseller = static::$client->reseller()->create($this->resellerProperties);\n        $resellerInfo = static::$client->reseller()->get('id', $reseller->id);\n        $this->assertEquals('John Reseller', $resellerInfo->personalName);\n        $this->assertEquals('reseller-unit-test', $resellerInfo->login);\n        $this->assertGreaterThan(0, count($resellerInfo->permissions));\n        $this->assertEquals($reseller->id, $resellerInfo->id);\n\n        static::$client->reseller()->delete('id', $reseller->id);\n    }\n\n    public function testGetAll()\n    {\n        $keyInfo = static::$client->server()->getKeyInfo();\n\n        if (!KeyLimitChecker::checkByType($keyInfo, KeyLimitChecker::LIMIT_RESELLERS, 2)) {\n            $this->markTestSkipped('License does not allow to create more than 1 reseller.');\n        }\n\n        static::$client->reseller()->create([\n            'pname' => 'John Reseller',\n            'login' => 'reseller-a',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n        static::$client->reseller()->create([\n            'pname' => 'Mike Reseller',\n            'login' => 'reseller-b',\n            'passwd' => PasswordProvider::STRONG_PASSWORD,\n        ]);\n\n        $resellersInfo = static::$client->reseller()->getAll();\n        $this->assertCount(2, $resellersInfo);\n        $this->assertEquals('John Reseller', $resellersInfo[0]->personalName);\n        $this->assertEquals('reseller-a', $resellersInfo[0]->login);\n\n        static::$client->reseller()->delete('login', 'reseller-a');\n        static::$client->reseller()->delete('login', 'reseller-b');\n    }\n\n    public function testGetAllEmpty()\n    {\n        $resellersInfo = static::$client->reseller()->getAll();\n        $this->assertCount(0, $resellersInfo);\n    }\n}\n"
  },
  {
    "path": "tests/SecretKeyTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskX\\Api\\Exception;\n\nclass SecretKeyTest extends AbstractTestCase\n{\n    public function testCreate()\n    {\n        $keyId = static::$client->secretKey()->create('192.168.0.1');\n        $this->assertMatchesRegularExpression(\n            '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',\n            $keyId\n        );\n        static::$client->secretKey()->delete($keyId);\n    }\n\n    public function testCreateAutoIp()\n    {\n        $keyId = static::$client->secretKey()->create();\n        $this->assertNotEmpty($keyId);\n        static::$client->secretKey()->delete($keyId);\n    }\n\n    public function testCreateMultiIps()\n    {\n        $keyId = static::$client->secretKey()->create(join(',', ['192.168.0.1', '192.168.0.2']));\n        $this->assertMatchesRegularExpression(\n            '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',\n            $keyId\n        );\n        static::$client->secretKey()->delete($keyId);\n    }\n\n    public function testCreateWithDescription()\n    {\n        $keyId = static::$client->secretKey()->create('192.168.0.1', 'test key');\n        $keyInfo = static::$client->secretKey()->get($keyId);\n\n        $this->assertEquals('test key', $keyInfo->description);\n\n        static::$client->secretKey()->delete($keyId);\n    }\n\n    public function testGet()\n    {\n        $keyId = static::$client->secretKey()->create('192.168.0.1');\n        $keyInfo = static::$client->secretKey()->get($keyId);\n\n        $this->assertNotEmpty($keyInfo->key);\n        $this->assertEquals('192.168.0.1', $keyInfo->ipAddress);\n        $this->assertEquals('admin', $keyInfo->login);\n\n        static::$client->secretKey()->delete($keyId);\n    }\n\n    public function testGetAll()\n    {\n        $keyIds = [];\n        $keyIds[] = static::$client->secretKey()->create('192.168.0.1');\n        $keyIds[] = static::$client->secretKey()->create('192.168.0.2');\n\n        $keys = static::$client->secretKey()->getAll();\n        $this->assertGreaterThanOrEqual(2, count($keys));\n\n        $keyIpAddresses = array_map(function ($key) {\n            return $key->ipAddress;\n        }, $keys);\n        $this->assertContains('192.168.0.1', $keyIpAddresses);\n        $this->assertContains('192.168.0.2', $keyIpAddresses);\n\n        foreach ($keyIds as $keyId) {\n            static::$client->secretKey()->delete($keyId);\n        }\n    }\n\n    public function testDelete()\n    {\n        $keyId = static::$client->secretKey()->create('192.168.0.1');\n        static::$client->secretKey()->delete($keyId);\n\n        try {\n            static::$client->secretKey()->get($keyId);\n            $this->fail(\"Secret key $keyId was not deleted.\");\n        } catch (Exception $exception) {\n            $this->assertEquals(1013, $exception->getCode());\n        }\n    }\n\n    public function testListEmpty()\n    {\n        $keys = static::$client->secretKey()->getAll();\n        foreach ($keys as $key) {\n            static::$client->secretKey()->delete($key->key);\n        }\n\n        $keys = static::$client->secretKey()->getAll();\n        $this->assertEquals(0, count($keys));\n    }\n}\n"
  },
  {
    "path": "tests/ServerTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass ServerTest extends AbstractTestCase\n{\n    public function testGetProtos()\n    {\n        $protos = static::$client->server()->getProtos();\n        $this->assertIsArray($protos);\n        $this->assertContains('1.6.3.0', $protos);\n    }\n\n    public function testGetGenInfo()\n    {\n        $generalInfo = static::$client->server()->getGeneralInfo();\n        $this->assertGreaterThan(0, strlen($generalInfo->serverName));\n        $this->assertMatchesRegularExpression(\n            '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',\n            strtolower($generalInfo->serverGuid)\n        );\n        $this->assertEquals('standard', $generalInfo->mode);\n    }\n\n    public function testGetPreferences()\n    {\n        $preferences = static::$client->server()->getPreferences();\n        $this->assertIsNumeric($preferences->statTtl);\n        $this->assertGreaterThan(0, $preferences->statTtl);\n        $this->assertEquals(0, $preferences->restartApacheInterval);\n    }\n\n    public function testGetAdmin()\n    {\n        $admin = static::$client->server()->getAdmin();\n        $this->assertGreaterThan(0, strlen($admin->name));\n        $this->assertStringContainsString('@', $admin->email);\n    }\n\n    public function testGetKeyInfo()\n    {\n        $keyInfo = static::$client->server()->getKeyInfo();\n        $this->assertIsArray($keyInfo);\n        $this->assertGreaterThan(0, count($keyInfo));\n        $this->assertArrayHasKey('plesk_key_id', $keyInfo);\n        $this->assertArrayHasKey('lim_date', $keyInfo);\n    }\n\n    public function testGetComponents()\n    {\n        $components = static::$client->server()->getComponents();\n        $this->assertIsArray($components);\n        $this->assertGreaterThan(0, count($components));\n        $this->assertArrayHasKey('psa', $components);\n    }\n\n    public function testGetServiceStates()\n    {\n        $serviceStates = static::$client->server()->getServiceStates();\n\n        $this->assertIsArray($serviceStates);\n        $this->assertGreaterThan(0, count($serviceStates));\n\n        $service = current($serviceStates);\n        $this->assertIsArray($service);\n        $this->assertArrayHasKey('id', $service);\n        $this->assertArrayHasKey('title', $service);\n        $this->assertArrayHasKey('state', $service);\n    }\n\n    public function testGetSessionPreferences()\n    {\n        $preferences = static::$client->server()->getSessionPreferences();\n        $this->assertIsNumeric($preferences->loginTimeout);\n        $this->assertGreaterThan(0, $preferences->loginTimeout);\n    }\n\n    public function testGetShells()\n    {\n        $shells = static::$client->server()->getShells();\n\n        $this->assertIsArray($shells);\n        $this->assertGreaterThan(0, count($shells));\n    }\n\n    public function testGetNetworkInterfaces()\n    {\n        $netInterfaces = static::$client->server()->getNetworkInterfaces();\n        $this->assertIsArray($netInterfaces);\n        $this->assertGreaterThan(0, count($netInterfaces));\n    }\n\n    public function testGetStatistics()\n    {\n        $stats = static::$client->server()->getStatistics();\n        $this->assertIsNumeric($stats->objects->clients);\n        $this->assertIsNumeric($stats->objects->domains);\n        $this->assertIsNumeric($stats->objects->databases);\n        $this->assertEquals('psa', $stats->version->internalName);\n        $this->assertNotEmpty($stats->version->osName);\n        $this->assertNotEmpty($stats->version->osVersion);\n        $this->assertGreaterThan(0, $stats->other->uptime);\n        $this->assertGreaterThan(0, strlen($stats->other->cpu));\n        $this->assertIsFloat($stats->loadAverage->load1min);\n        $this->assertGreaterThan(0, $stats->memory->total);\n        $this->assertGreaterThan($stats->memory->free, $stats->memory->total);\n        $this->assertIsNumeric($stats->swap->total);\n        $this->assertIsArray($stats->diskSpace);\n    }\n\n    public function testGetSiteIsolationConfig()\n    {\n        $config = static::$client->server()->getSiteIsolationConfig();\n        $this->assertIsArray($config);\n        $this->assertGreaterThan(0, count($config));\n        $this->assertArrayHasKey('php', $config);\n    }\n\n    public function testGetUpdatesInfo()\n    {\n        $updatesInfo = static::$client->server()->getUpdatesInfo();\n        $this->assertIsBool($updatesInfo->installUpdatesAutomatically);\n    }\n}\n"
  },
  {
    "path": "tests/ServicePlanAddonTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass ServicePlanAddonTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $servicePlanAddon = static::createServicePlanAddon();\n        $servicePlanAddonInfo = static::$client->servicePlanAddon()->get('id', $servicePlanAddon->id);\n\n        $this->assertNotEmpty($servicePlanAddonInfo->name);\n        $this->assertSame($servicePlanAddon->id, $servicePlanAddonInfo->id);\n    }\n\n    public function testGetAll()\n    {\n        static::createServicePlanAddon();\n        static::createServicePlanAddon();\n        static::createServicePlanAddon();\n\n        $servicePlanAddons = static::$client->servicePlanAddon()->getAll();\n        $this->assertIsArray($servicePlanAddons);\n        $this->assertGreaterThan(2, count($servicePlanAddons));\n        $this->assertNotEmpty($servicePlanAddons[0]->name);\n    }\n\n    public function testCreate()\n    {\n        $servicePlanAddon = static::createServicePlanAddon();\n        $this->assertGreaterThan(0, $servicePlanAddon->id);\n\n        static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);\n    }\n\n    public function testDelete()\n    {\n        $servicePlanAddon = static::createServicePlanAddon();\n        $result = static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);\n\n        $this->assertTrue($result);\n    }\n\n    public function testCreateComplex()\n    {\n        $properties = [\n            'name' => 'Complex Service Plan Addon',\n            'limits' => [\n                'limit' => [\n                    'name' => 'disk_space',\n                    'value' => 1024 * 1024 * 1024, // 1 GB\n                ],\n            ],\n        ];\n\n        $servicePlanAddon = static::$client->servicePlanAddon()->create($properties);\n        $this->assertGreaterThan(0, $servicePlanAddon->id);\n\n        static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);\n    }\n}\n"
  },
  {
    "path": "tests/ServicePlanTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass ServicePlanTest extends AbstractTestCase\n{\n    public function testGet()\n    {\n        $servicePlan = static::createServicePlan();\n        $servicePlanInfo = static::$client->servicePlan()->get('id', $servicePlan->id);\n        $this->assertNotEmpty($servicePlanInfo->name);\n        $this->assertSame($servicePlan->id, $servicePlanInfo->id);\n\n        static::$client->servicePlan()->delete('id', $servicePlan->id);\n    }\n\n    public function testGetAll()\n    {\n        static::createServicePlan();\n        static::createServicePlan();\n        static::createServicePlan();\n\n        $servicePlans = static::$client->servicePlan()->getAll();\n        $this->assertIsArray($servicePlans);\n        $this->assertGreaterThan(2, count($servicePlans));\n        $this->assertNotEmpty($servicePlans[0]->name);\n    }\n\n    public function testCreateServicePlan()\n    {\n        $servicePlan = static::createServicePlan();\n        $this->assertGreaterThan(0, $servicePlan->id);\n\n        static::$client->servicePlan()->delete('id', $servicePlan->id);\n    }\n\n    public function testDelete()\n    {\n        $servicePlan = static::createServicePlan();\n        $result = static::$client->servicePlan()->delete('id', $servicePlan->id);\n\n        $this->assertTrue($result);\n    }\n\n    public function testCreateComplexServicePlan()\n    {\n        $properties = [\n            'name' => 'Complex Service Plan',\n            'limits' => [\n                'overuse' => 'block',\n                'limit' => [\n                    'name' => 'disk_space',\n                    'value' => 1024 * 1024 * 1024, // 1 GB\n                ],\n            ],\n            'preferences' => [\n                'stat' => 6,\n                'maillists' => 'true',\n            ],\n            'hosting' => [\n                'property' => [\n                    [\n                        'name' => 'ftp_quota',\n                        'value' => '-1',\n                    ],\n                    [\n                        'name' => 'ssl',\n                        'value' => 'true',\n                    ],\n                ],\n            ],\n        ];\n\n        $servicePlan = static::$client->servicePlan()->create($properties);\n        $this->assertGreaterThan(0, $servicePlan->id);\n\n        static::$client->servicePlan()->delete('id', $servicePlan->id);\n    }\n}\n"
  },
  {
    "path": "tests/SessionTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass SessionTest extends AbstractTestCase\n{\n    public function testCreate()\n    {\n        $sessionToken = static::$client->session()->create('admin', '127.0.0.1');\n\n        $this->assertIsString($sessionToken);\n        $this->assertGreaterThan(10, strlen($sessionToken));\n    }\n\n    public function testGet()\n    {\n        $sessionId = static::$client->server()->createSession('admin', '127.0.0.1');\n        $sessions = static::$client->session()->get();\n        $this->assertArrayHasKey($sessionId, $sessions);\n\n        $sessionInfo = $sessions[$sessionId];\n        $this->assertEquals('admin', $sessionInfo->login);\n        $this->assertEquals('127.0.0.1', $sessionInfo->ipAddress);\n        $this->assertEquals($sessionId, $sessionInfo->id);\n    }\n\n    public function testTerminate()\n    {\n        $sessionId = static::$client->server()->createSession('admin', '127.0.0.1');\n        static::$client->session()->terminate($sessionId);\n        $sessions = static::$client->session()->get();\n        $this->assertArrayNotHasKey($sessionId, $sessions);\n    }\n}\n"
  },
  {
    "path": "tests/SiteAliasTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass SiteAliasTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n        static::$webspace = static::createWebspace();\n    }\n\n    private function createSiteAlias($name, array $properties = []): \\PleskX\\Api\\Struct\\SiteAlias\\Info\n    {\n        $properties = array_merge([\n            'name' => $name,\n            'site-id' => static::$webspace->id,\n        ], $properties);\n\n        return static::$client->siteAlias()->create($properties);\n    }\n\n    public function testCreate()\n    {\n        $siteAlias = $this->createSiteAlias('alias.dom');\n\n        $this->assertIsNumeric($siteAlias->id);\n        $this->assertGreaterThan(0, $siteAlias->id);\n\n        static::$client->siteAlias()->delete('id', $siteAlias->id);\n    }\n\n    public function testDelete()\n    {\n        $siteAlias = $this->createSiteAlias('alias.dom');\n\n        $result = static::$client->siteAlias()->delete('id', $siteAlias->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $siteAlias = $this->createSiteAlias('alias.dom');\n\n        $siteAliasInfo = static::$client->siteAlias()->get('id', $siteAlias->id);\n        $this->assertEquals('alias.dom', $siteAliasInfo->name);\n\n        static::$client->siteAlias()->delete('id', $siteAlias->id);\n    }\n\n    public function testGetAll()\n    {\n        $siteAlias = $this->createSiteAlias('alias.dom');\n        $siteAlias2 = $this->createSiteAlias('alias2.dom');\n\n        $siteAliasInfo = static::$client->siteAlias()->get('id', $siteAlias->id);\n        $this->assertEquals('alias.dom', $siteAliasInfo->name);\n\n        $siteAliasesInfo = static::$client->siteAlias()->getAll('site-id', self::$webspace->id);\n        $this->assertCount(2, $siteAliasesInfo);\n        $this->assertEquals('alias.dom', $siteAliasesInfo[0]->name);\n        $this->assertEquals('alias.dom', $siteAliasesInfo[0]->asciiName);\n\n        static::$client->siteAlias()->delete('id', $siteAlias->id);\n        static::$client->siteAlias()->delete('id', $siteAlias2->id);\n    }\n}\n"
  },
  {
    "path": "tests/SiteTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\KeyLimitChecker;\n\nclass SiteTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n        static::$webspace = static::createWebspace();\n    }\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $keyInfo = static::$client->server()->getKeyInfo();\n\n        if (!KeyLimitChecker::checkByType($keyInfo, KeyLimitChecker::LIMIT_DOMAINS, 2)) {\n            $this->markTestSkipped('License does not allow to create more than 1 domain.');\n        }\n    }\n\n    private function createSite($name, array $properties = []): \\PleskX\\Api\\Struct\\Site\\Info\n    {\n        $properties = array_merge([\n            'name' => $name,\n            'webspace-id' => static::$webspace->id,\n        ], $properties);\n\n        return static::$client->site()->create($properties);\n    }\n\n    public function testCreate()\n    {\n        $site = $this->createSite('addon.dom');\n\n        $this->assertIsNumeric($site->id);\n        $this->assertGreaterThan(0, $site->id);\n\n        static::$client->site()->delete('id', $site->id);\n    }\n\n    public function testDelete()\n    {\n        $site = $this->createSite('addon.dom');\n\n        $result = static::$client->site()->delete('id', $site->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $site = $this->createSite('addon.dom');\n\n        $siteInfo = static::$client->site()->get('id', $site->id);\n        $this->assertEquals('addon.dom', $siteInfo->name);\n        $this->assertMatchesRegularExpression(\"/^\\d{4}-\\d{2}-\\d{2}$/\", $siteInfo->creationDate);\n        $this->assertEquals(36, strlen($siteInfo->guid));\n\n        $siteGuid = $siteInfo->guid;\n        $siteInfo = static::$client->site()->get('guid', $siteGuid);\n        $this->assertEquals($site->id, $siteInfo->id);\n\n        static::$client->site()->delete('id', $site->id);\n\n        $siteInfo = static::$client->site()->get('parent-id', static::$webspace->id);\n        $this->assertNull($siteInfo);\n    }\n\n    public function testGetHostingWoHosting()\n    {\n        $site = $this->createSite('addon.dom');\n\n        $siteHosting = static::$client->site()->getHosting('id', $site->id);\n        $this->assertNull($siteHosting);\n\n        static::$client->site()->delete('id', $site->id);\n    }\n\n    public function testGetHostingWithHosting()\n    {\n        $properties = [\n            'hosting' => [\n                'www_root' => 'addon.dom',\n            ],\n        ];\n        $site = $this->createSite('addon.dom', $properties);\n\n        $siteHosting = static::$client->site()->getHosting('id', $site->id);\n        $this->assertArrayHasKey('www_root', $siteHosting->properties);\n        $this->assertStringEndsWith('addon.dom', $siteHosting->properties['www_root']);\n\n        static::$client->site()->delete('id', $site->id);\n    }\n\n    public function testGetAll()\n    {\n        $site = $this->createSite('addon.dom');\n        $site2 = $this->createSite('addon2.dom');\n\n        $sitesInfo = static::$client->site()->getAll();\n        $this->assertCount(2, $sitesInfo);\n        $this->assertEquals('addon.dom', $sitesInfo[0]->name);\n        $this->assertEquals('addon.dom', $sitesInfo[0]->asciiName);\n        $this->assertEquals($site->id, $sitesInfo[0]->id);\n\n        static::$client->site()->delete('id', $site->id);\n        static::$client->site()->delete('id', $site2->id);\n    }\n\n    public function testGetAllWithoutSites()\n    {\n        $sitesInfo = static::$client->site()->getAll();\n        $this->assertEmpty($sitesInfo);\n    }\n}\n"
  },
  {
    "path": "tests/SubdomainTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass SubdomainTest extends AbstractTestCase\n{\n    private static \\PleskX\\Api\\Struct\\Webspace\\Info $webspace;\n    private static string $webspaceName;\n\n    public static function setUpBeforeClass(): void\n    {\n        parent::setUpBeforeClass();\n        static::$webspace = static::createWebspace();\n        $webspaceInfo = static::$client->webspace()->get('id', static::$webspace->id);\n        static::$webspaceName = $webspaceInfo->name;\n    }\n\n    private function createSubdomain(string $name): \\PleskX\\Api\\Struct\\Subdomain\\Info\n    {\n        return static::$client->subdomain()->create([\n            'parent' => static::$webspaceName,\n            'name' => $name,\n            'property' => [\n                'www_root' => $name,\n            ],\n        ]);\n    }\n\n    public function testCreate()\n    {\n        $subdomain = $this->createSubdomain('sub');\n\n        $this->assertIsInt($subdomain->id);\n        $this->assertGreaterThan(0, $subdomain->id);\n\n        static::$client->subdomain()->delete('id', $subdomain->id);\n    }\n\n    public function testDelete()\n    {\n        $subdomain = $this->createSubdomain('sub');\n\n        $result = static::$client->subdomain()->delete('id', $subdomain->id);\n        $this->assertTrue($result);\n    }\n\n    public function testGet()\n    {\n        $name = 'sub';\n        $subdomain = $this->createSubdomain($name);\n\n        $subdomainInfo = static::$client->subdomain()->get('id', $subdomain->id);\n        $this->assertEquals($name . '.' . $subdomainInfo->parent, $subdomainInfo->name);\n        $this->assertTrue(false !== strpos($subdomainInfo->properties['www_root'], $name));\n        $this->assertEquals($subdomain->id, $subdomainInfo->id);\n\n        static::$client->subdomain()->delete('id', $subdomain->id);\n    }\n\n    public function testGetAll()\n    {\n        $name = 'sub';\n        $name2 = 'sub2';\n        $subdomain = $this->createSubdomain($name);\n        $subdomain2 = $this->createSubdomain($name2);\n\n        $subdomainsInfo = static::$client->subdomain()->getAll();\n        $this->assertCount(2, $subdomainsInfo);\n        $this->assertEquals($name . '.' . $subdomainsInfo[0]->parent, $subdomainsInfo[0]->name);\n        $this->assertTrue(false !== strpos($subdomainsInfo[0]->properties['www_root'], $name));\n        $this->assertEquals($name2 . '.' . $subdomainsInfo[1]->parent, $subdomainsInfo[1]->name);\n        $this->assertTrue(false !== strpos($subdomainsInfo[1]->properties['www_root'], $name2));\n\n        static::$client->subdomain()->delete('id', $subdomain->id);\n        static::$client->subdomain()->delete('id', $subdomain2->id);\n\n        $subdomainsInfo = static::$client->subdomain()->getAll();\n        $this->assertEmpty($subdomainsInfo);\n    }\n}\n"
  },
  {
    "path": "tests/UiTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nclass UiTest extends AbstractTestCase\n{\n    private array $customButtonProperties = [\n        'place' => 'admin',\n        'url' => 'http://example.com',\n        'text' => 'Example site',\n    ];\n\n    public function testGetNavigation()\n    {\n        $navigation = static::$client->ui()->getNavigation();\n        $this->assertIsArray($navigation);\n        $this->assertGreaterThan(0, count($navigation));\n        $this->assertArrayHasKey('general', $navigation);\n        $this->assertArrayHasKey('hosting', $navigation);\n\n        $hostingSection = $navigation['hosting'];\n        $this->assertArrayHasKey('name', $hostingSection);\n        $this->assertArrayHasKey('nodes', $hostingSection);\n        $this->assertGreaterThan(0, count($hostingSection['nodes']));\n    }\n\n    public function testCreateCustomButton()\n    {\n        $buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);\n        $this->assertGreaterThan(0, $buttonId);\n\n        static::$client->ui()->deleteCustomButton($buttonId);\n    }\n\n    public function testGetCustomButton()\n    {\n        $buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);\n        $customButtonInfo = static::$client->ui()->getCustomButton($buttonId);\n        $this->assertEquals('http://example.com', $customButtonInfo->url);\n        $this->assertEquals('Example site', $customButtonInfo->text);\n\n        static::$client->ui()->deleteCustomButton($buttonId);\n    }\n\n    public function testDeleteCustomButton()\n    {\n        $buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);\n        $result = static::$client->ui()->deleteCustomButton($buttonId);\n        $this->assertTrue($result);\n    }\n}\n"
  },
  {
    "path": "tests/Utility/KeyLimitChecker.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest\\Utility;\n\nclass KeyLimitChecker\n{\n    public const LIMIT_CLIENTS = 'limit_clients';\n    public const LIMIT_RESELLERS = 'limit_resellers';\n    public const LIMIT_DOMAINS = 'limit_domains';\n\n    /**\n     * Checks whether limit is within the required constraint.\n     *\n     * @param (string|int)[] $keyInfo  Structure returned by the getKeyInfo call\n     * @param string $type             Type of the object that should be checked\n     * @param int $minimalRequirement  Minimal value that should satisfy the limit\n     *\n     * @return bool  if license satisfies set limits\n     */\n    public static function checkByType(array $keyInfo, $type, $minimalRequirement)\n    {\n        $field = null;\n        switch ($type) {\n            case self::LIMIT_CLIENTS:\n                if (intval($keyInfo['can-manage-customers']) === 0) {\n                    return false;\n                }\n                $field = 'lim_cl';\n                break;\n            case self::LIMIT_RESELLERS:\n                if (intval($keyInfo['can-manage-resellers']) === 0) {\n                    return false;\n                }\n                $field = 'lim_cl';\n                break;\n            case self::LIMIT_DOMAINS:\n                $field = 'lim_dom';\n                break;\n            default:\n                return false;\n        }\n\n        return intval($keyInfo[$field]) === -1 || intval($keyInfo[$field]) > $minimalRequirement;\n    }\n}\n"
  },
  {
    "path": "tests/Utility/PasswordProvider.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest\\Utility;\n\nclass PasswordProvider\n{\n    public const STRONG_PASSWORD = 'test-&PWD*1@42!13#';\n}\n"
  },
  {
    "path": "tests/WebspaceTest.php",
    "content": "<?php\n// Copyright 1999-2025. WebPros International GmbH.\n\nnamespace PleskXTest;\n\nuse PleskXTest\\Utility\\PasswordProvider;\n\nclass WebspaceTest extends AbstractTestCase\n{\n    public function testGetPermissionDescriptor()\n    {\n        $descriptor = static::$client->webspace()->getPermissionDescriptor();\n        $this->assertIsArray($descriptor->permissions);\n        $this->assertNotEmpty($descriptor->permissions);\n    }\n\n    public function testGetLimitDescriptor()\n    {\n        $descriptor = static::$client->webspace()->getLimitDescriptor();\n        $this->assertIsArray($descriptor->limits);\n        $this->assertNotEmpty($descriptor->limits);\n    }\n\n    public function testGetDiskUsage()\n    {\n        $webspace = static::createWebspace();\n        $diskusage = static::$client->webspace()->getDiskUsage('id', $webspace->id);\n\n        $this->assertTrue(property_exists($diskusage, 'httpdocs'));\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testGetPhysicalHostingDescriptor()\n    {\n        $descriptor = static::$client->webspace()->getPhysicalHostingDescriptor();\n        $this->assertIsArray($descriptor->properties);\n        $this->assertNotEmpty($descriptor->properties);\n\n        $ftpLoginProperty = $descriptor->properties['ftp_login'];\n        $this->assertEquals('ftp_login', $ftpLoginProperty->name);\n        $this->assertEquals('string', $ftpLoginProperty->type);\n    }\n\n    public function testGetPhpSettings()\n    {\n        $webspace = static::createWebspace();\n        $info = static::$client->webspace()->getPhpSettings('id', $webspace->id);\n\n        $this->assertArrayHasKey('open_basedir', $info->properties);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testGetLimits()\n    {\n        $webspace = static::createWebspace();\n        $limits = static::$client->webspace()->getLimits('id', $webspace->id);\n\n        $this->assertIsArray($limits->limits);\n        $this->assertNotEmpty($limits->limits);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testCreateWebspace()\n    {\n        $webspace = static::createWebspace();\n\n        $this->assertGreaterThan(0, $webspace->id);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testDelete()\n    {\n        $webspace = static::createWebspace();\n        $result = static::$client->webspace()->delete('id', $webspace->id);\n\n        $this->assertTrue($result);\n    }\n\n    public function testDeleteByName()\n    {\n        $webspace = static::createWebspace();\n        $result = static::$client->webspace()->delete('name', $webspace->name);\n\n        $this->assertTrue($result);\n    }\n\n    public function testRequestCreateWebspace()\n    {\n        $handlers = static::$client->phpHandler()->getAll();\n        $enabledHandlers = array_filter($handlers, function ($handler) {\n            return $handler->handlerStatus !== 'disabled';\n        });\n        $this->assertGreaterThan(0, count($enabledHandlers));\n        $handler = current($enabledHandlers);\n\n        $request = [\n            'add' => [\n                'gen_setup' => [\n                    'name' => 'webspace-test-full.test',\n                    'htype' => 'vrt_hst',\n                    'status' => '0',\n                    'ip_address' => [static::getIpAddress()],\n                ],\n                'hosting' => [\n                    'vrt_hst' => [\n                        'property' => [\n                            [\n                                'name' => 'php_handler_id',\n                                'value' => $handler->id,\n                            ],\n                            [\n                                'name' => 'ftp_login',\n                                'value' => 'testuser',\n                            ],\n                            [\n                                'name' => 'ftp_password',\n                                'value' => PasswordProvider::STRONG_PASSWORD,\n                            ],\n                        ],\n                        'ip_address' => static::getIpAddress(),\n                    ],\n                ],\n                'limits' => [\n                    'overuse' => 'block',\n                    'limit' => [\n                        [\n                            'name' => 'mbox_quota',\n                            'value' => 100,\n                        ],\n                    ],\n                ],\n                'prefs' => [\n                    'www' => 'false',\n                    'stat_ttl' => 6,\n                ],\n                'performance' => [\n                    'bandwidth' => 120,\n                    'max_connections' => 10000,\n                ],\n                'permissions' => [\n                    'permission' => [\n                        [\n                            'name' => 'manage_sh_access',\n                            'value' => 'true',\n                        ],\n                    ],\n                ],\n                'php-settings' => [\n                    'setting' => [\n                        [\n                            'name' => 'memory_limit',\n                            'value' => '128M',\n                        ],\n                        [\n                            'name' => 'safe_mode',\n                            'value' => 'false',\n                        ],\n                    ],\n                ],\n                'plan-name' => 'Unlimited',\n            ],\n        ];\n\n        $webspace = static::$client->webspace()->request($request);\n\n        $this->assertGreaterThan(0, $webspace->id);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testGet()\n    {\n        $webspace = static::createWebspace();\n        $webspaceInfo = static::$client->webspace()->get('id', $webspace->id);\n\n        $this->assertNotEmpty($webspaceInfo->name);\n        $this->assertEquals(0, $webspaceInfo->realSize);\n        $this->assertEquals($webspaceInfo->name, $webspaceInfo->asciiName);\n        $this->assertIsArray($webspaceInfo->ipAddresses);\n        $this->assertEquals(36, strlen($webspaceInfo->guid));\n        $this->assertMatchesRegularExpression(\"/^\\d{4}-\\d{2}-\\d{2}$/\", $webspaceInfo->creationDate);\n        $this->assertEquals($webspace->id, $webspaceInfo->id);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testEnable()\n    {\n        $webspace = static::createWebspace();\n\n        static::$client->webspace()->disable('id', $webspace->id);\n        static::$client->webspace()->enable('id', $webspace->id);\n        $webspaceInfo = static::$client->webspace()->get('id', $webspace->id);\n        $this->assertTrue($webspaceInfo->enabled);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testDisable()\n    {\n        $webspace = static::createWebspace();\n\n        static::$client->webspace()->disable('id', $webspace->id);\n        $webspaceInfo = static::$client->webspace()->get('id', $webspace->id);\n        $this->assertFalse($webspaceInfo->enabled);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testSetProperties()\n    {\n        $webspace = static::createWebspace();\n        static::$client->webspace()->setProperties('id', $webspace->id, [\n            'description' => 'Test Description',\n        ]);\n        $webspaceInfo = static::$client->webspace()->get('id', $webspace->id);\n        $this->assertEquals('Test Description', $webspaceInfo->description);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n\n    public function testIpsAsArray()\n    {\n        $webspace = static::$client->webspace()->create(\n            [\n                'name' => \"test-ips.test\",\n                'ip_address' => [static::getIpAddress()],\n            ],\n            [\n                'ftp_login' => \"u-ips\",\n                'ftp_password' => PasswordProvider::STRONG_PASSWORD,\n            ]\n        );\n\n        $this->assertGreaterThan(0, $webspace->id);\n\n        static::$client->webspace()->delete('id', $webspace->id);\n    }\n}\n"
  },
  {
    "path": "wait-for-plesk.sh",
    "content": "#!/bin/bash\n### Copyright 1999-2025. WebPros International GmbH.\n\nCOUNTER=1\n\nwhile : ; do\n    curl -ksL https://plesk:8443/ | grep \"<title>Plesk\" > /dev/null\n    [ $? -eq 0 ] && break\n    echo \"($COUNTER) Waiting for the Plesk initialization...\"\n    sleep 5\n    COUNTER=$((COUNTER + 1))\n    if [ $COUNTER -eq 60 ]; then\n        echo \"Too long, interrupting...\"\n        break\n    fi\ndone\n"
  }
]