Completed
Push — master ( c76259...7eb777 )
by Dmitry
01:52
created
src/Provider31/Response.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
          *      @param string $name
42 42
          *      @param string $value (optional)
43 43
          */
44
-        public function createElement($name, $value=NULL)
44
+        public function createElement($name, $value = NULL)
45 45
         {
46 46
                 return parent::createElement($name, $value);
47 47
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
          */
114 114
         protected function sign($options)
115 115
         {
116
-                if (isset($this->Sign)) return;
116
+                if (isset($this->Sign)) {
117
+                        return;
118
+                }
117 119
                 
118 120
                 if (isset($options['UseSign']) && ($options['UseSign'] === true))
119 121
                 {
Please login to merge, or discard this patch.
src/Provider31/Request/General.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         /**
40 40
          *      @var array list of possible operations
41 41
          */
42
-        protected $operations = array('Check','Payment','Confirm','Cancel');
42
+        protected $operations = array('Check', 'Payment', 'Confirm', 'Cancel');
43 43
         
44 44
         /**
45 45
          *      General constructor
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
          */
223 223
         public function verify_sign($options)
224 224
         {
225
-                if (!isset($options['UseSign']) || ($options['UseSign'] === false))
225
+                if ( ! isset($options['UseSign']) || ($options['UseSign'] === false))
226 226
                 {
227 227
                         return null;
228 228
                 }
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
          *
277 277
          *      @return array nodes with the name 
278 278
          */
279
-        protected function getNodes($dom, $name, $ret=array())
279
+        protected function getNodes($dom, $name, $ret = array())
280 280
         {
281
-                foreach($dom->childNodes as $child)
281
+                foreach ($dom->childNodes as $child)
282 282
                 {
283 283
                         if ($child->nodeName == $name)
284 284
                         {
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -118,8 +118,7 @@  discard block
 block discarded – undo
118 118
                 if (count($r) > 1)
119 119
                 {
120 120
                         throw new Exception\Structure('There is more than one Request element in the xml-query!', -52);
121
-                }
122
-                elseif (count($r) < 1)
121
+                } elseif (count($r) < 1)
123 122
                 {
124 123
                         throw new Exception\Structure('The xml-query does not contain any element Request!', -52);
125 124
                 }
@@ -129,18 +128,15 @@  discard block
 block discarded – undo
129 128
                         if ($child->nodeName == 'DateTime')
130 129
                         {
131 130
                                 $this->parse_request_node($child, 'DateTime');
132
-                        }
133
-                        elseif ($child->nodeName == 'Sign')
131
+                        } elseif ($child->nodeName == 'Sign')
134 132
                         {
135 133
                                 $this->parse_request_node($child, 'Sign');
136
-                        }
137
-                        elseif (in_array($child->nodeName, $this->operations))
134
+                        } elseif (in_array($child->nodeName, $this->operations))
138 135
                         {
139 136
                                 if ( ! isset($this->Operation))
140 137
                                 {
141 138
                                         $this->Operation = $child->nodeName;
142
-                                }
143
-                                else
139
+                                } else
144 140
                                 {
145 141
                                         throw new Exception\Structure('There is more than one Operation type element in the xml-query!', -53);
146 142
                                 }
@@ -177,8 +173,7 @@  discard block
 block discarded – undo
177 173
                 if ( ! isset($this->$name))
178 174
                 {
179 175
                         $this->$name = $n->nodeValue;
180
-                }
181
-                else
176
+                } else
182 177
                 {
183 178
                         throw new Exception\Structure('There is more than one '.$name.' element in the xml-query!', -56);
184 179
                 }
@@ -260,8 +255,7 @@  discard block
 block discarded – undo
260 255
                 if ($check == -1)
261 256
                 {
262 257
                         throw new Exception\Sign('Error verify signature of request!', -96);
263
-                }
264
-                elseif ($check == 0)
258
+                } elseif ($check == 0)
265 259
                 {
266 260
                         throw new Exception\Sign('Signature of request is incorrect!', -95);
267 261
                 }
@@ -283,8 +277,7 @@  discard block
 block discarded – undo
283 277
                         if ($child->nodeName == $name)
284 278
                         {
285 279
                                 array_push($ret, $child);
286
-                        }   
287
-                        else
280
+                        } else
288 281
                         {
289 282
                                 if (count($child->childNodes) > 0)
290 283
                                 {
Please login to merge, or discard this patch.
src/Provider31/Response/Check.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,35 +16,35 @@
 block discarded – undo
16 16
 
17 17
 final class Check extends Response
18 18
 {
19
-	/**
19
+        /**
20 20
          *      Check constructor
21 21
          *
22 22
          *      @param AccountInfo $accountinfo account information set
23 23
          */
24
-	function __construct(AccountInfo $accountinfo) {
25
-		parent::__construct();
24
+        function __construct(AccountInfo $accountinfo) {
25
+                parent::__construct();
26 26
 		
27
-		$this->setElementValue('StatusCode', 0);
28
-		$this->setElementValue('StatusDetail', 'checked');
27
+                $this->setElementValue('StatusCode', 0);
28
+                $this->setElementValue('StatusDetail', 'checked');
29 29
 		
30
-		$this->create_AccountInfo($accountinfo);
31
-	}
30
+                $this->create_AccountInfo($accountinfo);
31
+        }
32 32
 	
33
-	/**
33
+        /**
34 34
          *      Create AccountInfo node with child nodes
35 35
          *
36 36
          *      @param AccountInfo $accountinfo account information set
37 37
          */
38
-	public function create_AccountInfo($accountinfo)
39
-	{
40
-		if (isset($this->AccountInfo)) return;
38
+        public function create_AccountInfo($accountinfo)
39
+        {
40
+                if (isset($this->AccountInfo)) return;
41 41
 		
42
-		$this->AccountInfo = self::createElement('AccountInfo');
43
-		$this->Response->appendChild($this->AccountInfo);
42
+                $this->AccountInfo = self::createElement('AccountInfo');
43
+                $this->Response->appendChild($this->AccountInfo);
44 44
 		
45
-		foreach($accountinfo as $parameter=>$value)
46
-		{
47
-			$this->AccountInfo->appendChild(self::createElement($parameter, $value));
48
-		}
49
-	}
45
+                foreach($accountinfo as $parameter=>$value)
46
+                {
47
+                        $this->AccountInfo->appendChild(self::createElement($parameter, $value));
48
+                }
49
+        }
50 50
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		$this->AccountInfo = self::createElement('AccountInfo');
43 43
 		$this->Response->appendChild($this->AccountInfo);
44 44
 		
45
-		foreach($accountinfo as $parameter=>$value)
45
+		foreach ($accountinfo as $parameter=>$value)
46 46
 		{
47 47
 			$this->AccountInfo->appendChild(self::createElement($parameter, $value));
48 48
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
          */
38 38
 	public function create_AccountInfo($accountinfo)
39 39
 	{
40
-		if (isset($this->AccountInfo)) return;
40
+		if (isset($this->AccountInfo)) {
41
+		        return;
42
+		}
41 43
 		
42 44
 		$this->AccountInfo = self::createElement('AccountInfo');
43 45
 		$this->Response->appendChild($this->AccountInfo);
Please login to merge, or discard this patch.
src/Provider31/Response/Confirm.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@
 block discarded – undo
15 15
 
16 16
 final class Confirm extends Response
17 17
 {
18
-	/**
18
+        /**
19 19
          *      Confirm constructor
20 20
          *
21 21
          *      @param string $orderdate
22 22
          */
23
-	function __construct($orderdate) {
24
-		parent::__construct();
23
+        function __construct($orderdate) {
24
+                parent::__construct();
25 25
 		
26
-		$this->setElementValue('StatusCode', 0);
27
-		$this->setElementValue('StatusDetail', 'checked');
26
+                $this->setElementValue('StatusCode', 0);
27
+                $this->setElementValue('StatusDetail', 'checked');
28 28
 		
29
-		$this->create_OrderDate($orderdate);
30
-	}
29
+                $this->create_OrderDate($orderdate);
30
+        }
31 31
 	
32
-	/**
32
+        /**
33 33
          *      Create OrderDate node
34 34
          *
35 35
          *      @param string $orderdate
36 36
          */
37
-	public function create_OrderDate($orderdate)
38
-	{
39
-		if (isset($this->OrderDate)) return;
37
+        public function create_OrderDate($orderdate)
38
+        {
39
+                if (isset($this->OrderDate)) return;
40 40
 		
41
-		$this->OrderDate = self::createElement('OrderDate', $orderdate);
42
-		$this->Response->appendChild($this->OrderDate);
43
-	}
41
+                $this->OrderDate = self::createElement('OrderDate', $orderdate);
42
+                $this->Response->appendChild($this->OrderDate);
43
+        }
44 44
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
          */
37 37
 	public function create_OrderDate($orderdate)
38 38
 	{
39
-		if (isset($this->OrderDate)) return;
39
+		if (isset($this->OrderDate)) {
40
+		        return;
41
+		}
40 42
 		
41 43
 		$this->OrderDate = self::createElement('OrderDate', $orderdate);
42 44
 		$this->Response->appendChild($this->OrderDate);
Please login to merge, or discard this patch.
src/Provider31/Response/Cancel.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@
 block discarded – undo
15 15
 
16 16
 final class Cancel extends Response
17 17
 {
18
-	/**
18
+        /**
19 19
          *      Cancel constructor
20 20
          *
21 21
          *      @param string $orderdate
22 22
          */
23
-	function __construct($canceldate) {
24
-		parent::__construct();
23
+        function __construct($canceldate) {
24
+                parent::__construct();
25 25
 		
26
-		$this->setElementValue('StatusCode', 0);
27
-		$this->setElementValue('StatusDetail', 'checked');
26
+                $this->setElementValue('StatusCode', 0);
27
+                $this->setElementValue('StatusDetail', 'checked');
28 28
 		
29
-		$this->create_CancelDate($canceldate);
30
-	}
29
+                $this->create_CancelDate($canceldate);
30
+        }
31 31
 	
32
-	/**
32
+        /**
33 33
          *      Create CancelDate node
34 34
          *
35 35
          *      @param string $canceldate
36 36
          */
37
-	public function create_CancelDate($canceldate)
38
-	{
39
-		if (isset($this->CancelDate)) return;
37
+        public function create_CancelDate($canceldate)
38
+        {
39
+                if (isset($this->CancelDate)) return;
40 40
 		
41
-		$this->CancelDate = self::createElement('CancelDate', $canceldate);
42
-		$this->Response->appendChild($this->CancelDate);
43
-	}
41
+                $this->CancelDate = self::createElement('CancelDate', $canceldate);
42
+                $this->Response->appendChild($this->CancelDate);
43
+        }
44 44
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
          */
37 37
 	public function create_CancelDate($canceldate)
38 38
 	{
39
-		if (isset($this->CancelDate)) return;
39
+		if (isset($this->CancelDate)) {
40
+		        return;
41
+		}
40 42
 		
41 43
 		$this->CancelDate = self::createElement('CancelDate', $canceldate);
42 44
 		$this->Response->appendChild($this->CancelDate);
Please login to merge, or discard this patch.
src/Provider31/Response/Payment.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@
 block discarded – undo
15 15
 
16 16
 final class Payment extends Response
17 17
 {
18
-	/**
18
+        /**
19 19
          *      Payment constructor
20 20
          *
21 21
          *      @param string $paymentid
22 22
          */
23
-	function __construct($paymentid) {
24
-		parent::__construct();
23
+        function __construct($paymentid) {
24
+                parent::__construct();
25 25
 		
26
-		$this->setElementValue('StatusCode', 0);
27
-		$this->setElementValue('StatusDetail', 'checked');
26
+                $this->setElementValue('StatusCode', 0);
27
+                $this->setElementValue('StatusDetail', 'checked');
28 28
 		
29
-		$this->create_PaymentId($paymentid);
30
-	}
29
+                $this->create_PaymentId($paymentid);
30
+        }
31 31
 	
32
-	/**
32
+        /**
33 33
          *      Create PaymentId node
34 34
          *
35 35
          *      @param string $paymentid
36 36
          */
37
-	public function create_PaymentId($paymentid)
38
-	{
39
-		if (isset($this->PaymentId)) return;
37
+        public function create_PaymentId($paymentid)
38
+        {
39
+                if (isset($this->PaymentId)) return;
40 40
 		
41
-		$this->PaymentId = self::createElement('PaymentId', $paymentid);
42
-		$this->Response->appendChild($this->PaymentId);
43
-	}
41
+                $this->PaymentId = self::createElement('PaymentId', $paymentid);
42
+                $this->Response->appendChild($this->PaymentId);
43
+        }
44 44
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
          */
37 37
 	public function create_PaymentId($paymentid)
38 38
 	{
39
-		if (isset($this->PaymentId)) return;
39
+		if (isset($this->PaymentId)) {
40
+		        return;
41
+		}
40 42
 		
41 43
 		$this->PaymentId = self::createElement('PaymentId', $paymentid);
42 44
 		$this->Response->appendChild($this->PaymentId);
Please login to merge, or discard this patch.
src/Provider31/Response/ErrorInfo.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@
 block discarded – undo
15 15
 
16 16
 final class ErrorInfo extends Response
17 17
 {
18
-	/**
18
+        /**
19 19
          *      ErrorInfo constructor
20 20
          *
21 21
          *      @param integer $code Error code
22 22
          *      @param string $message Error message text
23 23
          */
24
-	function __construct($code, $message) {
25
-		parent::__construct();
24
+        function __construct($code, $message) {
25
+                parent::__construct();
26 26
 		
27
-		$this->setElementValue('StatusCode', $code);
28
-		$this->setElementValue('StatusDetail', $message);
29
-	}
27
+                $this->setElementValue('StatusCode', $code);
28
+                $this->setElementValue('StatusDetail', $message);
29
+        }
30 30
 }
Please login to merge, or discard this patch.
src/Provider31/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
          */
72 72
         private static function get_http_raw_post_data()
73 73
         {
74
-                Log::instance()->add('request from ' . $_SERVER['REMOTE_ADDR']);
74
+                Log::instance()->add('request from '.$_SERVER['REMOTE_ADDR']);
75 75
                 
76 76
                 $raw_request = file_get_contents('php://input');
77 77
                 
Please login to merge, or discard this patch.
src/Provider31.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,20 +70,16 @@
 block discarded – undo
70 70
                         $this->response = $this->get_response();
71 71
                         
72 72
                         Log::instance()->add('the request was processed successfully');
73
-                }
74
-                catch (Exception\Structure $e)
73
+                } catch (Exception\Structure $e)
75 74
                 {
76 75
                         $this->response = $this->get_error_response($e->getCode(), 'Error in request');
77
-                }
78
-                catch (Exception\Sign $e)
76
+                } catch (Exception\Sign $e)
79 77
                 {
80 78
                         $this->response = $this->get_error_response($e->getCode(), 'Signature error!');
81
-                }
82
-                catch (Exception\Runtime $e)
79
+                } catch (Exception\Runtime $e)
83 80
                 {
84 81
                         $this->response = $this->get_error_response($e->getCode(), 'Error while processing request');
85
-                }
86
-                catch (\Exception $e)
82
+                } catch (\Exception $e)
87 83
                 {
88 84
                         $this->response = $this->get_error_response($e->getCode(), $e->getMessage());
89 85
                 }
Please login to merge, or discard this patch.