<?php

namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap;


use SoapClient;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * Date: 27.08.19
 * Time: 15:47
 * Class MySoapClient
 */
class MySoapClient extends SoapClient
{

    /**
     * @param string $request
     * @param string $location
     * @param string $action
     * @param int $version
     * @return string
     */
    public function __doRequest($request, $location, $action, $version)
    {

        if(stripos($request, 'DistributionListActionRequest') !== false)
        {
            $request = str_replace(array('ns1:DistributionListActionRequest', 'xmlns:ns2="urn:kerio"'), array('ns2:DistributionListActionRequest', 'xmlns:ns2="urn:kerioAccount"'), $request);
        }

        return parent::__doRequest($request, $location, $action, $version);
    }

    /**
     * @param string $function_name
     * @param array $arguments
     * @param array|null $options
     * @param null $input_headers
     * @param array|null $output_headers
     * @return mixed|void
     */
    public function __soapCall($function_name, array $arguments, array $options = null, $input_headers = null, array &$output_headers = null)
    {
        //todo logg
        return parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers); // TODO: Change the autogenerated stub
    }


}