Completed
Push — 23 ( 09d773...16ee8e )
by Harald
11s
created

braintree_hook_admin_orders_action::execute()   C

Complexity

Conditions 14
Paths 35

Size

Total Lines 49
Code Lines 30

Duplication

Lines 24
Ratio 48.98 %

Importance

Changes 0
Metric Value
cc 14
eloc 30
nc 35
nop 0
dl 24
loc 49
rs 5.1329
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/*
3
  $Id$
4
5
  osCommerce, Open Source E-Commerce Solutions
6
  http://www.oscommerce.com
7
8
  Copyright (c) 2016 osCommerce
9
10
  Released under the GNU General Public License
11
*/
12
13
  if ( !class_exists('OSCOM_Braintree') ) {
14
    include(DIR_FS_CATALOG . 'includes/apps/braintree/OSCOM_Braintree.php');
15
  }
16
17
  class braintree_hook_admin_orders_action {
18
    var $server = 1;
19
20 View Code Duplication
    function braintree_hook_admin_orders_action() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
      global $OSCOM_Braintree;
22
23
      if ( !isset($OSCOM_Braintree) || !is_object($OSCOM_Braintree) || (get_class($OSCOM_Braintree) != 'OSCOM_Braintree') ) {
24
        $OSCOM_Braintree = new OSCOM_Braintree();
25
      }
26
27
      $this->_app = $OSCOM_Braintree;
0 ignored issues
show
Bug introduced by
The property _app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
29
      $this->_app->loadLanguageFile('hooks/admin/orders/action.php');
30
    }
31
32
    function execute() {
33
      global $HTTP_GET_VARS, $HTTP_POST_VARS;
34
35
      if ( isset($HTTP_GET_VARS['tabaction']) ) {
36
        $btstatus_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$HTTP_GET_VARS['oID'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID . "' and comments like 'Transaction ID:%' order by date_added limit 1");
37
        if ( tep_db_num_rows($btstatus_query) ) {
38
          $btstatus = tep_db_fetch_array($btstatus_query);
39
40
          $bt = array();
41
42 View Code Duplication
          foreach ( explode("\n", $btstatus['comments']) as $s ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
            if ( !empty($s) && (strpos($s, ':') !== false) ) {
44
              $entry = explode(':', $s, 2);
45
46
              $bt[trim($entry[0])] = trim($entry[1]);
47
            }
48
          }
49
50
          if ( isset($bt['Transaction ID']) ) {
51
            $o_query = tep_db_query("select o.orders_id, o.payment_method, o.currency, o.currency_value, ot.value as total from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot where o.orders_id = '" . (int)$HTTP_GET_VARS['oID'] . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total'");
52
            $o = tep_db_fetch_array($o_query);
53
54
            if ((isset($bt['Server']) && ($bt['Server'] !== 'production')) || (strpos($o['payment_method'], 'Sandbox') !== false)) {
55
              $this->server = 0;
56
            }
57
58 View Code Duplication
            switch ( $HTTP_GET_VARS['tabaction'] ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
              case 'getTransactionDetails':
60
                $this->getTransactionDetails($bt, $o);
61
                break;
62
63
              case 'doCapture':
64
                $this->doCapture($bt, $o);
65
                break;
66
67
              case 'doVoid':
68
                $this->doVoid($bt, $o);
69
                break;
70
71
              case 'refundTransaction':
72
                $this->refundTransaction($bt, $o);
73
                break;
74
            }
75
76
            tep_redirect(tep_href_link(FILENAME_ORDERS, 'page=' . $HTTP_GET_VARS['page'] . '&oID=' . $HTTP_GET_VARS['oID'] . '&action=edit#section_status_history_content'));
77
          }
78
        }
79
      }
80
    }
81
82
    function getTransactionDetails($comments, $order) {
83
      global $messageStack;
84
85
      $result = null;
86
87
      $this->_app->setupCredentials($this->server === 1 ? 'live' : 'sandbox');
88
89
      $error = false;
90
91
      try {
92
        $response = Braintree_Transaction::find($comments['Transaction ID']);
93
      } catch (Exception $e) {
94
        $error = true;
95
      }
96
97
      if (($error === false) && is_object($response) && (get_class($response) == 'Braintree\\Transaction') && isset($response->id) && ($response->id == $comments['Transaction ID'])) {
98
        $result = 'Transaction ID: ' . tep_db_prepare_input($response->id) . "\n";
99
100
        if (($response->paymentInstrumentType == 'credit_card') && isset($comments['3D Secure'])) {
0 ignored issues
show
Documentation introduced by
The property paymentInstrumentType does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
101
          if (isset($response->threeDSecureInfo) && is_object($response->threeDSecureInfo)) {
0 ignored issues
show
Documentation introduced by
The property threeDSecureInfo does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
102
            $result .= '3D Secure: ' . tep_db_prepare_input($response->threeDSecureInfo->status . ' (Liability Shifted: ' . ($response->threeDSecureInfo->liabilityShifted === true ? 'true' : 'false') . ')') . "\n";
0 ignored issues
show
Documentation introduced by
The property threeDSecureInfo does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
103
          } else {
104
            $result .= '3D Secure: ** MISSING **' . "\n";
105
          }
106
        }
107
108
        $result .= 'Payment Status: ' . tep_db_prepare_input($response->status) . "\n" .
109
                   'Payment Type: ' . tep_db_prepare_input($response->paymentInstrumentType) . "\n";
0 ignored issues
show
Documentation introduced by
The property paymentInstrumentType does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
110
111
        if ($this->server === 0) {
112
          $result .= 'Server: sandbox' . "\n";
113
        }
114
115
        $result .= 'Status History:';
116
117 View Code Duplication
        foreach ($response->statusHistory as $sh) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
118
          $sh->timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
119
120
          $result .= "\n" . tep_db_prepare_input('[' . $sh->timestamp->format('Y-m-d H:i:s T') . '] ' . $sh->status . ' ' . $sh->amount . ' ' . $response->currencyIsoCode);
0 ignored issues
show
Documentation introduced by
The property currencyIsoCode does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
121
        }
122
      }
123
124 View Code Duplication
      if (!empty($result)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125
        $sql_data_array = array(
126
          'orders_id' => (int)$order['orders_id'],
127
          'orders_status_id' => OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID,
128
          'date_added' => 'now()',
129
          'customer_notified' => '0',
130
          'comments' => $result
131
        );
132
133
        tep_db_perform('orders_status_history', $sql_data_array);
134
135
        $messageStack->add_session($this->_app->getDef('ms_success_getTransactionDetails'), 'success');
136
      } else {
137
        $messageStack->add_session($this->_app->getDef('ms_error_getTransactionDetails'), 'error');
138
      }
139
    }
140
141
    function doCapture($comments, $order) {
142
      global $HTTP_POST_VARS, $messageStack;
143
144
      $capture_value = $this->_app->formatCurrencyRaw($order['total'], $order['currency'], $order['currency_value']);
145
146
      if ($this->_app->formatCurrencyRaw($_POST['btCaptureAmount'], $order['currency'], 1) < $capture_value) {
147
        $capture_value = $this->_app->formatCurrencyRaw($_POST['btCaptureAmount'], $order['currency'], 1);
148
      }
149
150
      $this->_app->setupCredentials($this->server === 1 ? 'live' : 'sandbox');
151
152
      $error = false;
153
154
      try {
155
        $response = Braintree_Transaction::submitForSettlement($comments['Transaction ID'], $capture_value);
156
      } catch (Exception $e) {
157
        $error = true;
158
      }
159
160
      if (($error === false) && is_object($response) && (get_class($response) == 'Braintree\\Result\\Successful') && ($response->success === true) && (get_class($response->transaction) == 'Braintree\\Transaction') && isset($response->transaction->id) && ($response->transaction->id == $comments['Transaction ID'])) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
161
        $result = 'Braintree App: Capture (' . $capture_value . ')' . "\n" .
162
                  'Transaction ID: ' . tep_db_prepare_input($response->transaction->id) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
163
                  'Payment Status: ' . tep_db_prepare_input($response->transaction->status) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
164
                  'Status History:';
165
166 View Code Duplication
        foreach ($response->transaction->statusHistory as $sh) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
167
          $sh->timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
168
169
          $result .= "\n" . tep_db_prepare_input('[' . $sh->timestamp->format('Y-m-d H:i:s T') . '] ' . $sh->status . ' ' . $sh->amount . ' ' . $response->transaction->currencyIsoCode);
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property currencyIsoCode does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
170
        }
171
172
        $sql_data_array = array(
173
          'orders_id' => (int)$order['orders_id'],
174
          'orders_status_id' => OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID,
175
          'date_added' => 'now()',
176
          'customer_notified' => '0',
177
          'comments' => $result
178
        );
179
180
        tep_db_perform('orders_status_history', $sql_data_array);
181
182
// immediately settle sandbox transactions
183
        if (strpos($order['payment_method'], 'Sandbox') !== false) {
184
          $error = false;
185
186
          try {
187
            $response = Braintree_Test_Transaction::settle($comments['Transaction ID']);
188
          } catch (Exception $e) {
189
            $error = true;
190
          }
191
192
          if (($error === false) && is_object($response) && (get_class($response) == 'Braintree\\Transaction') && isset($response->id) && ($response->id == $comments['Transaction ID'])) {
193
            $result = 'Braintree App: Settled (' . tep_db_prepare_input($response->amount) . ')' . "\n" .
194
                      'Transaction ID: ' . tep_db_prepare_input($response->id) . "\n" .
195
                      'Payment Status: ' . tep_db_prepare_input($response->status) . "\n" .
196
                      'Status History:';
197
198 View Code Duplication
            foreach ($response->statusHistory as $sh) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
199
              $sh->timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
200
201
              $result .= "\n" . tep_db_prepare_input('[' . $sh->timestamp->format('Y-m-d H:i:s T') . '] ' . $sh->status . ' ' . $sh->amount . ' ' . $response->currencyIsoCode);
0 ignored issues
show
Documentation introduced by
The property currencyIsoCode does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
202
            }
203
204
            $sql_data_array = array(
205
              'orders_id' => (int)$order['orders_id'],
206
              'orders_status_id' => OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID,
207
              'date_added' => 'now()',
208
              'customer_notified' => '0',
209
              'comments' => $result
210
            );
211
212
            tep_db_perform('orders_status_history', $sql_data_array);
213
          }
214
        }
215
216
        $messageStack->add_session($this->_app->getDef('ms_success_doCapture'), 'success');
217
      } else {
218
        $messageStack->add_session($this->_app->getDef('ms_error_doCapture'), 'error');
219
      }
220
    }
221
222
    function doVoid($comments, $order) {
223
      global $messageStack;
224
225
      $this->_app->setupCredentials($this->server === 1 ? 'live' : 'sandbox');
226
227
      $error = false;
228
229
      try {
230
        $response = Braintree_Transaction::void($comments['Transaction ID']);
231
      } catch (Exception $e) {
232
        $error = true;
233
      }
234
235
      if (($error === false) && is_object($response) && (get_class($response) == 'Braintree\\Result\\Successful') && ($response->success === true) && (get_class($response->transaction) == 'Braintree\\Transaction') && isset($response->transaction->id) && ($response->transaction->id == $comments['Transaction ID'])) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
236
        $result = 'Braintree App: Void (' . tep_db_prepare_input($response->transaction->amount) . ')' . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
237
                  'Transaction ID: ' . tep_db_prepare_input($response->transaction->id) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
238
                  'Payment Status: ' . tep_db_prepare_input($response->transaction->status) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
239
                  'Status History:';
240
241 View Code Duplication
        foreach ($response->transaction->statusHistory as $sh) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
242
          $sh->timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
243
244
          $result .= "\n" . tep_db_prepare_input('[' . $sh->timestamp->format('Y-m-d H:i:s T') . '] ' . $sh->status . ' ' . $sh->amount . ' ' . $response->transaction->currencyIsoCode);
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property currencyIsoCode does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
245
        }
246
247
        $sql_data_array = array('orders_id' => (int)$order['orders_id'],
248
                                'orders_status_id' => OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID,
249
                                'date_added' => 'now()',
250
                                'customer_notified' => '0',
251
                                'comments' => $result);
252
253
        tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
254
255
        $messageStack->add_session($this->_app->getDef('ms_success_doVoid'), 'success');
256
      } else {
257
        $messageStack->add($this->_app->getDef('ms_error_doVoid'), 'error');
258
      }
259
    }
260
261
    function refundTransaction($comments, $order) {
262
      global $HTTP_POST_VARS, $messageStack;
263
264
      $refund_value = (isset($_POST['btRefundAmount']) && !empty($_POST['btRefundAmount'])) ? $this->_app->formatCurrencyRaw($_POST['btRefundAmount'], $order['currency'], 1) : null;
265
266
      $this->_app->setupCredentials($this->server === 1 ? 'live' : 'sandbox');
267
268
      $error = false;
269
270
      try {
271
        $response = Braintree_Transaction::refund($comments['Transaction ID'], $refund_value);
272
      } catch (Exception $e) {
273
        $error = true;
274
      }
275
276
      if (($error === false) && is_object($response) && (get_class($response) == 'Braintree\\Result\\Successful') && ($response->success === true) && (get_class($response->transaction) == 'Braintree\\Transaction') && isset($response->transaction->refundedTransactionId) && ($response->transaction->refundedTransactionId == $comments['Transaction ID'])) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property refundedTransactionId does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
277
        $result = 'Braintree App: Refund (' . tep_db_prepare_input($response->transaction->amount) . ')' . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
278
                  'Credit Transaction ID: ' . tep_db_prepare_input($response->transaction->id) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
279
                  'Transaction ID: ' . tep_db_prepare_input($response->transaction->refundedTransactionId) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property refundedTransactionId does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
280
                  'Payment Status: ' . tep_db_prepare_input($response->transaction->status) . "\n" .
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
281
                  'Status History:';
282
283 View Code Duplication
        foreach ($response->transaction->statusHistory as $sh) {
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
284
          $sh->timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
285
286
          $result .= "\n" . tep_db_prepare_input('[' . $sh->timestamp->format('Y-m-d H:i:s T') . '] ' . $sh->status . ' ' . $sh->amount . ' ' . $response->transaction->currencyIsoCode);
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property currencyIsoCode does not exist on object<Braintree\Transaction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
287
        }
288
289
        $sql_data_array = array('orders_id' => (int)$order['orders_id'],
290
                                'orders_status_id' => OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID,
291
                                'date_added' => 'now()',
292
                                'customer_notified' => '0',
293
                                'comments' => $result);
294
295
        tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
296
297
        $messageStack->add_session($this->_app->getDef('ms_success_doRefund', array(
298
          'refund_amount' => tep_db_prepare_input($response->transaction->amount)
0 ignored issues
show
Documentation introduced by
The property transaction does not exist on object<Braintree\Result\Successful>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
299
        )), 'success');
300
      } else {
301
        $messageStack->add_session($this->_app->getDef('ms_error_doRefund', array(
302
          'refund_amount' => tep_db_prepare_input($response->transaction->amount)
303
        )), 'error');
304
      }
305
    }
306
  }
307
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
308