Passed
Push — master ( 80c89b...178b52 )
by Dmitry
02:12
created
src/Exception/Runtime.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
          *      @param string $message
21 21
          *      @param \Throwable $previous
22 22
          */
23
-        public function __construct($message, $code=0, \Exception $previous=null)
23
+        public function __construct($message, $code = 0, \Exception $previous = null)
24 24
         {
25 25
                 parent::__construct($message, $code, $previous, true);
26 26
         }
Please login to merge, or discard this patch.
src/Exception/General.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
          *      @param string $message
22 22
          *      @param \Throwable $previous
23 23
          */
24
-        public function __construct($message, $code=0, \Exception $previous=null, $tracelog=false)
24
+        public function __construct($message, $code = 0, \Exception $previous = null, $tracelog = false)
25 25
         {
26
-                Log::instance()->error($message.(($tracelog)?PHP_EOL.$this->getTraceAsString():null));
26
+                Log::instance()->error($message.(($tracelog) ?PHP_EOL.$this->getTraceAsString() : null));
27 27
                 parent::__construct($message, $code, $previous);
28 28
         }
29 29
 }
Please login to merge, or discard this patch.
src/Key.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -4,60 +4,60 @@
 block discarded – undo
4 4
 
5 5
 class Key
6 6
 {
7
-    public function __construct() {}
8
-
9
-    /**
10
-     *      Get content of key file
11
-     *      @param string $fname
12
-     *      @param string $type
13
-     *      @return string
14
-     *      @throws Exception\Runtime
15
-     */
16
-    public function get($fname, $type)
17
-    {
7
+        public function __construct() {}
8
+
9
+        /**
10
+         *      Get content of key file
11
+         *      @param string $fname
12
+         *      @param string $type
13
+         *      @return string
14
+         *      @throws Exception\Runtime
15
+         */
16
+        public function get($fname, $type)
17
+        {
18 18
         try
19 19
         {
20
-            $this->check_exists($fname);
20
+                $this->check_exists($fname);
21 21
 
22
-            $key = $this->load($fname);
22
+                $key = $this->load($fname);
23 23
         }
24 24
         catch (\Exception $e)
25 25
         {
26
-            throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!', -98);
26
+                throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!', -98);
27 27
         }
28 28
 
29 29
         return $key;
30
-    }
31
-
32
-    /**
33
-     *      Check if exist key file
34
-     *
35
-     *      @param string $fname
36
-     *      @throws Exception\Runtime
37
-     */
38
-    protected function check_exists($fname)
39
-    {
30
+        }
31
+
32
+        /**
33
+         *      Check if exist key file
34
+         *
35
+         *      @param string $fname
36
+         *      @throws Exception\Runtime
37
+         */
38
+        protected function check_exists($fname)
39
+        {
40 40
         if ( ! file_exists($fname))
41 41
         {
42
-            throw new Exception\Runtime('not exists');
42
+                throw new Exception\Runtime('not exists');
43 43
         }
44
-    }
45
-
46
-    /**
47
-     *      Load key file
48
-     *
49
-     *      @param string $fname
50
-     *      @return string
51
-     *      @throws Exception\Runtime
52
-     */
53
-    protected function load($fname)
54
-    {
44
+        }
45
+
46
+        /**
47
+         *      Load key file
48
+         *
49
+         *      @param string $fname
50
+         *      @return string
51
+         *      @throws Exception\Runtime
52
+         */
53
+        protected function load($fname)
54
+        {
55 55
         $key = @file_get_contents($fname);
56 56
         if ($key === FALSE)
57 57
         {
58
-            throw new Exception\Runtime('not read');
58
+                throw new Exception\Runtime('not read');
59 59
         }
60 60
 
61 61
         return $key;
62
-    }
62
+        }
63 63
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@
 block discarded – undo
20 20
             $this->check_exists($fname);
21 21
 
22 22
             $key = $this->load($fname);
23
-        }
24
-        catch (\Exception $e)
23
+        } catch (\Exception $e)
25 24
         {
26 25
             throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!', -98);
27 26
         }
Please login to merge, or discard this patch.
src/Provider31/Response/ErrorInfo.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
 
16 16
 final class ErrorInfo extends Response
17 17
 {
18
-	/**
19
-     *      ErrorInfo constructor
20
-     *
21
-     *      @param integer $code Error code
22
-     *      @param string $message Error message text
23
-     */
24
-    public function __construct($code, $message)
25
-    {
26
-		parent::__construct();
18
+        /**
19
+         *      ErrorInfo constructor
20
+         *
21
+         *      @param integer $code Error code
22
+         *      @param string $message Error message text
23
+         */
24
+        public function __construct($code, $message)
25
+        {
26
+                parent::__construct();
27 27
 
28
-		$this->setElementValue('StatusCode', $code);
29
-		$this->setElementValue('StatusDetail', $message);
30
-	}
28
+                $this->setElementValue('StatusCode', $code);
29
+                $this->setElementValue('StatusDetail', $message);
30
+        }
31 31
 }
Please login to merge, or discard this patch.
src/Provider31/Response.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      *      @param string $name
53 53
      *      @param string $value (optional)
54 54
      */
55
-    public function createElement($name, $value=NULL)
55
+    public function createElement($name, $value = NULL)
56 56
     {
57 57
         return parent::createElement($name, $value);
58 58
     }
Please login to merge, or discard this patch.
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -16,134 +16,134 @@
 block discarded – undo
16 16
 
17 17
 abstract class Response extends \DomDocument
18 18
 {
19
-    /**
20
-     *      @var string
21
-     *
22
-     */
23
-    const TEMPLATE = '<Response><StatusCode></StatusCode><StatusDetail></StatusDetail><DateTime></DateTime></Response>';
24
-
25
-    /**
26
-     *      @var \DOMNode
27
-     */
28
-    protected $Response;
29
-
30
-    /**
31
-     *      @var \DOMElement
32
-     */
33
-    protected $Sign;
34
-
35
-    /**
36
-     *      Response constructor
37
-     *
38
-     */
39
-    public function __construct()
40
-    {
19
+        /**
20
+         *      @var string
21
+         *
22
+         */
23
+        const TEMPLATE = '<Response><StatusCode></StatusCode><StatusDetail></StatusDetail><DateTime></DateTime></Response>';
24
+
25
+        /**
26
+         *      @var \DOMNode
27
+         */
28
+        protected $Response;
29
+
30
+        /**
31
+         *      @var \DOMElement
32
+         */
33
+        protected $Sign;
34
+
35
+        /**
36
+         *      Response constructor
37
+         *
38
+         */
39
+        public function __construct()
40
+        {
41 41
         parent::__construct('1.0', 'UTF-8');
42 42
 
43 43
         $this->loadXML(self::TEMPLATE);
44 44
 
45 45
         $this->Response = $this->firstChild;
46 46
         $this->set_DateTime();
47
-    }
47
+        }
48 48
 
49
-    /**
50
-     *      Set DateTime element value by current time
51
-     */
52
-    public function set_DateTime()
53
-    {
49
+        /**
50
+         *      Set DateTime element value by current time
51
+         */
52
+        public function set_DateTime()
53
+        {
54 54
         $this->setElementValue('DateTime', date('Y-m-d\TH:i:s', time()));
55
-    }
56
-
57
-    /**
58
-     *      Create new element node
59
-     *
60
-     *      @param string $name
61
-     *      @param string $value (optional)
62
-     */
63
-    public function createElement($name, $value=NULL)
64
-    {
55
+        }
56
+
57
+        /**
58
+         *      Create new element node
59
+         *
60
+         *      @param string $name
61
+         *      @param string $value (optional)
62
+         */
63
+        public function createElement($name, $value=NULL)
64
+        {
65 65
         return parent::createElement($name, $value);
66
-    }
67
-
68
-    /**
69
-     *      Set node value
70
-     *
71
-     *      @param string $name
72
-     *      @param string $value
73
-     */
74
-    public function setElementValue($name, $value)
75
-    {
66
+        }
67
+
68
+        /**
69
+         *      Set node value
70
+         *
71
+         *      @param string $name
72
+         *      @param string $value
73
+         */
74
+        public function setElementValue($name, $value)
75
+        {
76 76
         foreach ($this->Response->childNodes as $child)
77 77
         {
78
-            if ($child->nodeName == $name)
79
-            {
78
+                if ($child->nodeName == $name)
79
+                {
80 80
                 $child->nodeValue = $value;
81
-            }
81
+                }
82 82
         }
83
-    }
84
-
85
-    /**
86
-     *      Dumps response into a string
87
-     *
88
-     *      @return string XML
89
-     */
90
-    public function friendly()
91
-    {
83
+        }
84
+
85
+        /**
86
+         *      Dumps response into a string
87
+         *
88
+         *      @return string XML
89
+         */
90
+        public function friendly()
91
+        {
92 92
         $this->encoding = 'UTF-8';
93 93
         $this->formatOutput = true;
94 94
 
95 95
         return $this->saveXML(NULL, LIBXML_NOEMPTYTAG);
96
-    }
97
-
98
-    /**
99
-     *      Sign and send response
100
-     *
101
-     *      @param array $options
102
-     */
103
-    public function sign_and_out($options)
104
-    {
96
+        }
97
+
98
+        /**
99
+         *      Sign and send response
100
+         *
101
+         *      @param array $options
102
+         */
103
+        public function sign_and_out($options)
104
+        {
105 105
         $this->sign($options);
106 106
         $this->out_header();
107 107
         $this->out_body($this->friendly());
108
-    }
108
+        }
109 109
 
110
-    /**
111
-     *      Send header
112
-     */
113
-    protected function out_header()
114
-    {
110
+        /**
111
+         *      Send header
112
+         */
113
+        protected function out_header()
114
+        {
115 115
         ob_clean();
116 116
         @header("Content-Type: text/xml; charset=utf-8");
117
-    }
118
-
119
-    /**
120
-     *      Send body
121
-     *
122
-     *      @param string $body
123
-     */
124
-    protected function out_body($body)
125
-    {
117
+        }
118
+
119
+        /**
120
+         *      Send body
121
+         *
122
+         *      @param string $body
123
+         */
124
+        protected function out_body($body)
125
+        {
126 126
         Log::instance()->debug('response sends: ');
127 127
         Log::instance()->debug($body);
128 128
 
129 129
         echo $body;
130
-    }
131
-
132
-    /**
133
-     *      Add Sign (if hasn't yet done)
134
-     *
135
-     *      @param array $options
136
-     */
137
-    protected function sign($options)
138
-    {
130
+        }
131
+
132
+        /**
133
+         *      Add Sign (if hasn't yet done)
134
+         *
135
+         *      @param array $options
136
+         */
137
+        protected function sign($options)
138
+        {
139 139
         if (isset($this->Sign)) return;
140 140
 
141 141
         if (isset($options['UseSign']) && ($options['UseSign'] === true))
142 142
         {
143
-            $this->Sign = $this->createElement('Sign');
144
-            $this->Response->appendChild($this->Sign);
143
+                $this->Sign = $this->createElement('Sign');
144
+                $this->Response->appendChild($this->Sign);
145 145
 
146
-            $this->Sign->nodeValue = (new Sign())->generate($this->friendly(), $options);
146
+                $this->Sign->nodeValue = (new Sign())->generate($this->friendly(), $options);
147
+        }
147 148
         }
148
-    }
149 149
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,9 @@
 block discarded – undo
136 136
      */
137 137
     protected function sign($options)
138 138
     {
139
-        if (isset($this->Sign)) return;
139
+        if (isset($this->Sign)) {
140
+                return;
141
+        }
140 142
 
141 143
         if (isset($options['UseSign']) && ($options['UseSign'] === true))
142 144
         {
Please login to merge, or discard this patch.
src/Provider31/Response/Check.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -16,41 +16,41 @@
 block discarded – undo
16 16
 
17 17
 final class Check extends Response
18 18
 {
19
-    /**
20
-     *      @var \DOMElement
21
-     */
22
-    protected $AccountInfo;
23
-
24
-	/**
25
-     *      Check constructor
26
-     *
27
-     *      @param AccountInfo $accountinfo account information set
28
-     */
29
-    public function __construct(AccountInfo $accountinfo)
30
-    {
31
-		parent::__construct();
32
-
33
-		$this->setElementValue('StatusCode', 0);
34
-		$this->setElementValue('StatusDetail', 'checked');
35
-
36
-		$this->create_AccountInfo($accountinfo);
37
-	}
38
-
39
-	/**
40
-     *      Create AccountInfo node with child nodes
41
-     *
42
-     *      @param AccountInfo $accountinfo account information set
43
-     */
44
-	public function create_AccountInfo($accountinfo)
45
-	{
46
-		if (isset($this->AccountInfo)) return;
47
-
48
-		$this->AccountInfo = $this->createElement('AccountInfo');
49
-		$this->Response->appendChild($this->AccountInfo);
50
-
51
-		foreach($accountinfo as $parameter=>$value)
52
-		{
53
-			$this->AccountInfo->appendChild($this->createElement($parameter, $value));
54
-		}
55
-	}
19
+        /**
20
+         *      @var \DOMElement
21
+         */
22
+        protected $AccountInfo;
23
+
24
+        /**
25
+         *      Check constructor
26
+         *
27
+         *      @param AccountInfo $accountinfo account information set
28
+         */
29
+        public function __construct(AccountInfo $accountinfo)
30
+        {
31
+                parent::__construct();
32
+
33
+                $this->setElementValue('StatusCode', 0);
34
+                $this->setElementValue('StatusDetail', 'checked');
35
+
36
+                $this->create_AccountInfo($accountinfo);
37
+        }
38
+
39
+        /**
40
+         *      Create AccountInfo node with child nodes
41
+         *
42
+         *      @param AccountInfo $accountinfo account information set
43
+         */
44
+        public function create_AccountInfo($accountinfo)
45
+        {
46
+                if (isset($this->AccountInfo)) return;
47
+
48
+                $this->AccountInfo = $this->createElement('AccountInfo');
49
+                $this->Response->appendChild($this->AccountInfo);
50
+
51
+                foreach($accountinfo as $parameter=>$value)
52
+                {
53
+                        $this->AccountInfo->appendChild($this->createElement($parameter, $value));
54
+                }
55
+        }
56 56
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 		$this->AccountInfo = $this->createElement('AccountInfo');
49 49
 		$this->Response->appendChild($this->AccountInfo);
50 50
 
51
-		foreach($accountinfo as $parameter=>$value)
51
+		foreach ($accountinfo as $parameter=>$value)
52 52
 		{
53 53
 			$this->AccountInfo->appendChild($this->createElement($parameter, $value));
54 54
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@
 block discarded – undo
43 43
      */
44 44
 	public function create_AccountInfo($accountinfo)
45 45
 	{
46
-		if (isset($this->AccountInfo)) return;
46
+		if (isset($this->AccountInfo)) {
47
+		        return;
48
+		}
47 49
 
48 50
 		$this->AccountInfo = $this->createElement('AccountInfo');
49 51
 		$this->Response->appendChild($this->AccountInfo);
Please login to merge, or discard this patch.
src/Provider31/Response/Cancel.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@
 block discarded – undo
15 15
 
16 16
 final class Cancel extends Response
17 17
 {
18
-    /**
19
-     *      @var \DOMElement
20
-     */
21
-    protected $CancelDate;
22
-
23
-	/**
24
-     *      Cancel constructor
25
-     *
26
-     *      @param string $orderdate
27
-     */
28
-	public function __construct($canceldate) {
29
-		parent::__construct();
30
-
31
-		$this->setElementValue('StatusCode', 0);
32
-		$this->setElementValue('StatusDetail', 'checked');
33
-
34
-		$this->create_CancelDate($canceldate);
35
-	}
36
-
37
-	/**
38
-     *      Create CancelDate node
39
-     *
40
-     *      @param string $canceldate
41
-     */
42
-	public function create_CancelDate($canceldate)
43
-	{
44
-		if (isset($this->CancelDate)) return;
45
-
46
-		$this->CancelDate = $this->createElement('CancelDate', $canceldate);
47
-		$this->Response->appendChild($this->CancelDate);
48
-	}
18
+        /**
19
+         *      @var \DOMElement
20
+         */
21
+        protected $CancelDate;
22
+
23
+        /**
24
+         *      Cancel constructor
25
+         *
26
+         *      @param string $orderdate
27
+         */
28
+        public function __construct($canceldate) {
29
+                parent::__construct();
30
+
31
+                $this->setElementValue('StatusCode', 0);
32
+                $this->setElementValue('StatusDetail', 'checked');
33
+
34
+                $this->create_CancelDate($canceldate);
35
+        }
36
+
37
+        /**
38
+         *      Create CancelDate node
39
+         *
40
+         *      @param string $canceldate
41
+         */
42
+        public function create_CancelDate($canceldate)
43
+        {
44
+                if (isset($this->CancelDate)) return;
45
+
46
+                $this->CancelDate = $this->createElement('CancelDate', $canceldate);
47
+                $this->Response->appendChild($this->CancelDate);
48
+        }
49 49
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
41 41
      */
42 42
 	public function create_CancelDate($canceldate)
43 43
 	{
44
-		if (isset($this->CancelDate)) return;
44
+		if (isset($this->CancelDate)) {
45
+		        return;
46
+		}
45 47
 
46 48
 		$this->CancelDate = $this->createElement('CancelDate', $canceldate);
47 49
 		$this->Response->appendChild($this->CancelDate);
Please login to merge, or discard this patch.
src/Provider31/Response/Confirm.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@
 block discarded – undo
15 15
 
16 16
 final class Confirm extends Response
17 17
 {
18
-    /**
19
-     *      @var \DOMElement
20
-     */
21
-    protected $OrderDate;
22
-
23
-	/**
24
-     *      Confirm constructor
25
-     *
26
-     *      @param string $orderdate
27
-     */
28
-    public function __construct($orderdate)
29
-    {
30
-		parent::__construct();
31
-
32
-		$this->setElementValue('StatusCode', 0);
33
-		$this->setElementValue('StatusDetail', 'checked');
34
-
35
-		$this->create_OrderDate($orderdate);
36
-	}
37
-
38
-	/**
39
-     *      Create OrderDate node
40
-     *
41
-     *      @param string $orderdate
42
-     */
43
-	public function create_OrderDate($orderdate)
44
-	{
45
-		if (isset($this->OrderDate)) return;
46
-
47
-		$this->OrderDate = $this->createElement('OrderDate', $orderdate);
48
-		$this->Response->appendChild($this->OrderDate);
49
-	}
18
+        /**
19
+         *      @var \DOMElement
20
+         */
21
+        protected $OrderDate;
22
+
23
+        /**
24
+         *      Confirm constructor
25
+         *
26
+         *      @param string $orderdate
27
+         */
28
+        public function __construct($orderdate)
29
+        {
30
+                parent::__construct();
31
+
32
+                $this->setElementValue('StatusCode', 0);
33
+                $this->setElementValue('StatusDetail', 'checked');
34
+
35
+                $this->create_OrderDate($orderdate);
36
+        }
37
+
38
+        /**
39
+         *      Create OrderDate node
40
+         *
41
+         *      @param string $orderdate
42
+         */
43
+        public function create_OrderDate($orderdate)
44
+        {
45
+                if (isset($this->OrderDate)) return;
46
+
47
+                $this->OrderDate = $this->createElement('OrderDate', $orderdate);
48
+                $this->Response->appendChild($this->OrderDate);
49
+        }
50 50
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@
 block discarded – undo
42 42
      */
43 43
 	public function create_OrderDate($orderdate)
44 44
 	{
45
-		if (isset($this->OrderDate)) return;
45
+		if (isset($this->OrderDate)) {
46
+		        return;
47
+		}
46 48
 
47 49
 		$this->OrderDate = $this->createElement('OrderDate', $orderdate);
48 50
 		$this->Response->appendChild($this->OrderDate);
Please login to merge, or discard this patch.
src/Provider31/Response/Payment.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@
 block discarded – undo
15 15
 
16 16
 final class Payment extends Response
17 17
 {
18
-    /**
19
-     *      @var \DOMElement
20
-     */
21
-    protected $PaymentId;
22
-
23
-	/**
24
-     *      Payment constructor
25
-     *
26
-     *      @param string $paymentid
27
-     */
28
-    public function __construct($paymentid)
29
-    {
30
-		parent::__construct();
31
-
32
-		$this->setElementValue('StatusCode', 0);
33
-		$this->setElementValue('StatusDetail', 'checked');
34
-
35
-		$this->create_PaymentId($paymentid);
36
-	}
37
-
38
-	/**
39
-     *      Create PaymentId node
40
-     *
41
-     *      @param string $paymentid
42
-     */
43
-	public function create_PaymentId($paymentid)
44
-	{
45
-		if (isset($this->PaymentId)) return;
46
-
47
-		$this->PaymentId = $this->createElement('PaymentId', $paymentid);
48
-		$this->Response->appendChild($this->PaymentId);
49
-	}
18
+        /**
19
+         *      @var \DOMElement
20
+         */
21
+        protected $PaymentId;
22
+
23
+        /**
24
+         *      Payment constructor
25
+         *
26
+         *      @param string $paymentid
27
+         */
28
+        public function __construct($paymentid)
29
+        {
30
+                parent::__construct();
31
+
32
+                $this->setElementValue('StatusCode', 0);
33
+                $this->setElementValue('StatusDetail', 'checked');
34
+
35
+                $this->create_PaymentId($paymentid);
36
+        }
37
+
38
+        /**
39
+         *      Create PaymentId node
40
+         *
41
+         *      @param string $paymentid
42
+         */
43
+        public function create_PaymentId($paymentid)
44
+        {
45
+                if (isset($this->PaymentId)) return;
46
+
47
+                $this->PaymentId = $this->createElement('PaymentId', $paymentid);
48
+                $this->Response->appendChild($this->PaymentId);
49
+        }
50 50
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@
 block discarded – undo
42 42
      */
43 43
 	public function create_PaymentId($paymentid)
44 44
 	{
45
-		if (isset($this->PaymentId)) return;
45
+		if (isset($this->PaymentId)) {
46
+		        return;
47
+		}
46 48
 
47 49
 		$this->PaymentId = $this->createElement('PaymentId', $paymentid);
48 50
 		$this->Response->appendChild($this->PaymentId);
Please login to merge, or discard this patch.