@@ -48,7 +48,7 @@ public function setKey($key)
4848            throw  new  \Exception ('$key must be a string. ' );
4949        }
5050        if (!preg_match ("/^[\w-]{6,32}$/ " , $ key
51-             throw  new  \Exception ('$ key don \' t match with pattern . );
51+             throw  new  \Exception ('Invalid  key provided: wrong format . );
5252        }
5353        $ this key  = $ key
5454    }
@@ -64,7 +64,7 @@ public function setSecret($secret)
6464            throw  new  \Exception ('$secret must be a string. ' );
6565        }
6666        if (!preg_match ("/^[\w-]{6,32}$/ " , $ secret
67-             throw  new  \Exception ('$ secret don \' t match with pattern . );
67+             throw  new  \Exception ('Invalid  secret provided: wrong format . );
6868        }
6969        $ this secret  = $ secret
7070    }
@@ -80,7 +80,7 @@ public function setResource($resource)
8080            throw  new  \Exception ('$resource must be a string. ' );
8181        }
8282        if (!preg_match ("/^[\w-]{6,32}$/ " , $ resource
83-             throw  new  \Exception ('$ resource don \' t match with pattern . );
83+             throw  new  \Exception ('Invalid  resource provided: wrong format . );
8484        }
8585        $ this resource  = $ resource
8686    }
@@ -145,7 +145,7 @@ public function setTimeout($timeout)
145145        }
146146        $ timeoutintval ($ timeout
147147        if ($ timeout0 ) {
148-             throw  new  \Exception ('$timeout must be geater  than 0. ' );
148+             throw  new  \Exception ('$timeout must be greater  than 0. ' );
149149        }
150150        $ this timeout  = $ timeout
151151    }
@@ -159,26 +159,27 @@ private function send($payload, $endpoint)
159159
160160        $ url'https:// ' .$ this environment .'.sipay.es/mdwr/ ' .$ this version .'/ ' .$ endpoint
161161        $ dataarray (
162-         'key '  => $ this key ,
163-         'nonce '  => "" .time (),
164-         'mode '  => $ this mode ,
165-         'resource '  => $ this resource ,
166-         'payload '  => $ payload
162+              'key '  => $ this key ,
163+              'nonce '  => "" .time (),
164+              'mode '  => $ this mode ,
165+              'resource '  => $ this resource ,
166+              'payload '  => $ payload
167167        );
168168
169169        $ bodyjson_encode ($ data
170170        $ signaturehash_hmac ($ this mode , $ body$ this secret );
171171
172172        $ optionsarray (
173-         'http '  => array (
174-         'header '   => "Content-type: application/json \r\nContent-Signature:  " .$ signature"\r\n" ,
175-         'method '   => 'POST ' ,
176-         'content '  => $ body
177-         'timeout '  => $ this timeout ,
178-         'ignore_errors '  => true 
179-         ),
173+              'http '  => array (
174+                  'header '   => "Content-type: application/json \r\nContent-Signature:  " .$ signature"\r\n" ,
175+                  'method '   => 'POST ' ,
176+                  'content '  => $ body
177+                  'timeout '  => $ this timeout ,
178+                  'ignore_errors '  => true 
179+              ),
180180        );
181-         $ contextstream_context_create ($ options
181+ 
182+         $ contextstream_context_create ($ options
182183        try  {
183184            $ response_bodyfile_get_contents ($ urlfalse , $ context
184185        } catch  (Exception $ e
@@ -223,12 +224,13 @@ private function send($payload, $endpoint)
223224        $ this logger ->info (
224225            'sipay.request ' , 'request.response ' , 'I-0002 ' , 'Request Response ' ,
225226            array (
226-                            'payload '  => $ payload
227-                            'endpoint '  => $ endpoint
228-             'response '  => $ response_body
227+                'payload '  => $ payload
228+                'endpoint '  => $ endpoint
229+                'response '  => $ response_body
230+             )
229231        );
230232
231-                           return  array ($ body$ response
233+         return  array ($ body$ response
232234    }
233235
234236    private  function  clean_parameters (array  $ array_optionsarray  $ array_schema
@@ -243,7 +245,7 @@ private function clean_parameters(array $array_options, array $array_schema)
243245                }
244246
245247                if (is_string ($ optionisset ($ schema'pattern ' ]) && !preg_match ($ schema'pattern ' ], $ option
246-                     throw  new  \Exception (" $ name  don't match with pattern. " 
248+                     throw  new  \Exception (' Invalid name provided: wrong format. ' 
247249                }
248250
249251                $ options$ name$ option
@@ -299,7 +301,7 @@ public function refund($identificator, Amount $amount, array $array_options = ar
299301        $ is_tx_idgettype ($ identificator"string "  && preg_match ('/^[0-9]{6,22}$/ ' , $ identificator
300302
301303        if  (!$ is_paymethod$ is_tx_id
302-             throw  new  \Exception ('incorrect  $identificator. );
304+             throw  new  \Exception ('Incorrect  $identificator. );
303305        }
304306
305307        $ array_schemaarray (
@@ -347,11 +349,11 @@ public function register(Paymethods\Paymethod $card, string $token)
347349    {
348350
349351        if  ($ cardinstanceof  Paymethods \StoredCard) {
350-             throw  new  \Exception ('$card can \'t be StoredCard. ' );
352+             throw  new  \Exception ('$card can \'t be a  StoredCard instance . ' );
351353        }
352354
353355        if (!preg_match ('/^[\w-]{6,128}$/ ' , $ token
354-             throw  new  \Exception ('$ token don \' t match with pattern . );
356+             throw  new  \Exception ('Invalid  token provided: wrong format . );
355357        }
356358
357359        $ payloadarray (
@@ -368,7 +370,7 @@ public function register(Paymethods\Paymethod $card, string $token)
368370    public  function  card (string  $ token
369371    {
370372        if (!preg_match ('/^[\w-]{6,128}$/ ' , $ token
371-             throw  new  \Exception ('$ token don \' t match with pattern . );
373+             throw  new  \Exception ('Invalid  token provided: wrong format . );
372374        }
373375
374376        $ payloadarray (
@@ -383,7 +385,7 @@ public function card(string $token)
383385    public  function  unregister (string  $ token
384386    {
385387        if (!preg_match ('/^[\w-]{6,128}$/ ' , $ token
386-             throw  new  \Exception ('$ token don \' t match with pattern . );
388+             throw  new  \Exception ('Invalid  token provided: wrong format . );
387389        }
388390
389391        $ payloadarray (
@@ -399,7 +401,7 @@ public function cancellation(string $transaction_id)
399401    {
400402
401403        if (!preg_match ('/^[0-9]{6,22}$/ ' , $ transaction_id
402-                throw  new  \Exception ('$ transaction_id don \' t match with pattern . );
404+             throw  new  \Exception ('Invalid  transaction_id provided: wrong format . );
403405        }
404406
405407        $ payloadarray (
0 commit comments