<commit_before><?php

namespace denbora\R_T_G_Services\services\SOAP;

use denbora\R_T_G_Services\R_T_G_ServiceException;

class MessageCenterService extends ServiceBase implements ServiceInterface
{

    /**
     * @param $serviceMethod string
     * @param $data
     * @param bool $rawResponse
     * @return mixed
     * @throws R_T_G_ServiceException
     */
    public function call(string $serviceMethod, $data, bool $rawResponse = false)
    {
        if (in_array($serviceMethod, $this->classMethods)) {
            try {
                $serviceResponse = $this->$serviceMethod($data, $rawResponse);

                return $serviceResponse;
            } catch (\SoapFault $e) {
                $errorPrefix = 'Error in ' . __FUNCTION__ . ' - ';
                throw new R_T_G_ServiceException($errorPrefix . $e->getMessage());
            }
        } else {
            $errorPrefix = 'Error in ' . __FUNCTION__ . ' - ';
            throw new R_T_G_ServiceException($errorPrefix . $serviceMethod .' does not exist');
        }
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @param $validatorName
     * @param $service
     * @return object
     */
    private function run($data, bool $rawResponse, $validatorName, $service)
    {
        $this->validator->call($validatorName, $data);

        return $this->service($service, $data, $rawResponse);
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return mixed
     */
    protected function getMessageList($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'getMessageList', 'GetMessageList');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getUnreadMessagesCount($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'getUnreadMessagesCount', 'GetUnreadMessagesCount');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function generateMessageForPlayer($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'generateMessageForPlayer', 'GenerateMessageForPlayer');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function deleteMessage($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'deleteMessage', 'DeleteMessage');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getForceOnEntrance($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'getForceOnEntrance', 'GetForceOnEntrance');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getForceOnExit($data, bool $rawResponse)
    {
        return $this->run($data, $rawResponse, 'getForceOnExit', 'GetForceOnExit');
    }
}<commit_msg>RTGS-29 Message Center API fixed unusual types for Service inputs<commit_after><?php

namespace denbora\R_T_G_Services\services\SOAP;

use denbora\R_T_G_Services\R_T_G_ServiceException;

class MessageCenterService extends ServiceBase implements ServiceInterface
{

    /**
     * @param $serviceMethod string
     * @param $data
     * @param bool $rawResponse
     * @return mixed
     * @throws R_T_G_ServiceException
     */
    public function call(string $serviceMethod, $data, bool $rawResponse = false)
    {
        if (in_array($serviceMethod, $this->classMethods)) {
            try {
                $serviceResponse = $this->$serviceMethod($data, $rawResponse);

                return $serviceResponse;
            } catch (\SoapFault $e) {
                $errorPrefix = 'Error in ' . __FUNCTION__ . ' - ';
                throw new R_T_G_ServiceException($errorPrefix . $e->getMessage());
            }
        } else {
            $errorPrefix = 'Error in ' . __FUNCTION__ . ' - ';
            throw new R_T_G_ServiceException($errorPrefix . $serviceMethod .' does not exist');
        }
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @param $validatorName
     * @param $service
     * @return object
     */
    private function run($data, bool $rawResponse, $validatorName, $service)
    {
        $this->validator->call($validatorName, $data);

        return $this->service($service, $data, $rawResponse);
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return mixed
     */
    protected function getMessageList($data, bool $rawResponse)
    {
        $normal = array(
            'PID' => (string) $data['PID'],
            'MoneyType' => (string) $data['MoneyType'],
            'SkinID' => (int) $data['SkinID'],
            'ClientType' => (string) $data['ClientType']
        );
        return $this->run($normal, $rawResponse, 'getMessageList', 'GetMessageList');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getUnreadMessagesCount($data, bool $rawResponse)
    {
        $normal = array(
            'PID' => (string) $data['PID'],
            'MoneyType' => (string) $data['MoneyType'],
            'SkinID' => (int) $data['SkinID'],
            'ClientType' => (string) $data['ClientType']
        );
        return $this->run($normal, $rawResponse, 'getUnreadMessagesCount', 'GetUnreadMessagesCount');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function generateMessageForPlayer($data, bool $rawResponse)
    {
        $normal = array(
            'MessageID' => (int) $data['MessageID'],
            'PID' => (int) $data['PID'],
            'CasinoID' => (int) $data['CasinoID'],
            'Scheme' => (string) $data['Scheme'],
            'CashierURL' => (string) $data['CashierURL'],
            'TournamentURL' => (string) $data['TournamentURL'],
            'MpRouletteURL' => (string) $data['MpRouletteURL'],
            'PlayMode' => (string) $data['PlayMode'],
            'ClientType' => (string) $data['ClientType']
        );
        return $this->run($normal, $rawResponse, 'generateMessageForPlayer', 'GenerateMessageForPlayer');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function deleteMessage($data, bool $rawResponse)
    {
        $normal = array(
            'MessageID' => (int) $data['MessageID'],
            'PID' => (string) $data['PID']
        );
        return $this->run($normal, $rawResponse, 'deleteMessage', 'DeleteMessage');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getForceOnEntrance($data, bool $rawResponse)
    {
        $normal = array(
            'MoneyType' => (int) $data['MoneyType'],
            'PID' => (string) $data['PID'],
            'SkinID' => (int) $data['SkinID']
        );
        return $this->run($normal, $rawResponse, 'getForceOnEntrance', 'GetForceOnEntrance');
    }

    /**
     * @param $data
     * @param bool $rawResponse
     * @return object
     */
    protected function getForceOnExit($data, bool $rawResponse)
    {
        $normal = array(
            'moneyType' => (bool) $data['moneyType'],
            'PID' => (string) $data['moneyType'],
            'skinID' => (int) $data['moneyType'],
            'clientType' => (bool) $data['clientType']
        );
        return $this->run($normal, $rawResponse, 'getForceOnExit', 'GetForceOnExit');
    }
}
{'fraction_non_alphanumeric': 0.14415721445528884, 'fraction_numerical': 0.0002637826431020839, 'mean_word_length': 2.365734576120728, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5384573', 'n_tokens_mistral': 2268, 'n_tokens_neox': 2226, 'n_words': 477}