<?php
 namespace Modules\Utils\ExportData; class Ws_ExportFile { private $authenticated=false; public function AuthHeader(Ws_AuthHeader $auth) { if (!$auth->securityCode) { throw new \SoapFault('102', 'The security code is not set.'); } $this->authenticated = $auth->isValid(); if (!$this->authenticated) { throw new \SoapFault('103', 'The security code is not valid.'); } } public function GetFile() { $this->avoidDos(); if (!$this->authenticated) { throw new \SoapFault('101', 'The soap header which should contain the security code was not set.'); } $getFileRs = new Ws_GetFile_Response(); return $getFileRs; } public function ConfirmFile(Ws_ConfirmFile_Request $rq) { $this->avoidDos(); if (!$this->authenticated) { throw new \SoapFault('101', 'The soap header which should contain the security code was not set.'); } $confirmFileRs = new Ws_ConfirmFile_Response(); $confirmFileRs->setRequest($rq); $confirmFileRs->confirm(); return $confirmFileRs; } private function avoidDos() { $sleepPeriod=rand(0, 1000); usleep($sleepPeriod*1000); } }