Completed
Push — master ( c7919b...503a39 )
by Chris
03:49
created

EduSveaWebPayTestConfig::getCheckoutMerchantId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3 View Code Duplication
class EduSveaWebPayProductionConfig implements \Svea\WebPay\Config\ConfigurationProvider {
0 ignored issues
show
Duplication introduced by
This class 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...
4
5
	/**
6
	 * @var EDU_SveaWebPay
7
	 */
8
	public $plugin;
9
10
	/**
11
	 * EduSveaWebPayProductionConfig constructor.
12
	 *
13
	 * @param EDU_SveaWebPay $_plugin
14
	 */
15
	public function __construct( $_plugin ) {
16
		$this->plugin = $_plugin;
17
	}
18
19
	/**
20
	 * fetch username, used with invoice or payment plan (i.e. Svea WebService Europe API)
21
	 *
22
	 * @return string
23
	 *
24
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
25
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
26
	 *
27
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
28
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
29
	 */
30
	public function getUsername( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getUsername is in camel caps, but expected get_username instead as per the coding standard.
Loading history...
31
	}
32
33
	/**
34
	 * fetch password, used with invoice or payment plan (i.e. Svea WebService Europe API)
35
	 *
36
	 * @return string
37
	 *
38
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
39
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
40
	 *
41
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
42
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
43
	 */
44
	public function getPassword( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getPassword is in camel caps, but expected get_password instead as per the coding standard.
Loading history...
45
	}
46
47
	/**
48
	 * fetch client number, used with invoice or payment plan (i.e. Svea WebService Europe API)
49
	 *
50
	 * @return \Svea\WebPay\Config\ClientNumber
51
	 *
52
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
53
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
54
	 *
55
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
56
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
57
	 */
58
	public function getClientNumber( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getClientNumber is in camel caps, but expected get_client_number instead as per the coding standard.
Loading history...
59
	}
60
61
	/**
62
	 * fetch merchant id, used with card or direct bank payments (i.e. Svea Hosted Web Service API)
63
	 *
64
	 * @return string
65
	 *
66
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
67
	 * @param string $country CountryCode eg. SE, NO, DK, FI, NL, DE
68
	 */
69
	public function getMerchantId( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getMerchantId is in camel caps, but expected get_merchant_id instead as per the coding standard.
Loading history...
70
		return $this->plugin->get_option( 'merchant_key', '' );
71
	}
72
73
	/**
74
	 * fetch secret word, used with card or direct bank payments (i.e. Svea Hosted Web Service API)
75
	 *
76
	 * @return string
77
	 *
78
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
79
	 * @param string $country CountryCode eg. SE, NO, DK, FI, NL, DE
80
	 */
81
	public function getSecret( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getSecret is in camel caps, but expected get_secret instead as per the coding standard.
Loading history...
82
		return $this->plugin->get_option( 'merchant_secret', '' );
83
	}
84
85
	/**
86
	 * Constants for the endpoint url found in the class ConfigurationService.php
87
	 * getEndPoint() should return an url corresponding to $type.
88
	 *
89
	 * @param string $type one of Svea\WebPay\Config\ConfigurationProvider::HOSTED_TYPE, ::INVOICE_TYPE, ::PAYMENTPLAN_TYPE, ::HOSTED_ADMIN_TYPE, ::ADMIN_TYPE
90
	 *
91
	 * @throws Exception
92
	 */
93
94
	public function getEndPoint( $type ) {
0 ignored issues
show
Coding Style introduced by
The function name getEndPoint is in camel caps, but expected get_end_point instead as per the coding standard.
Loading history...
95
		switch ( strtoupper( $type ) ) {
96
			case "HOSTED":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal HOSTED does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
97
				return Svea\WebPay\Config\ConfigurationService::SWP_PROD_URL;
98
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
99
			case "INVOICE":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal INVOICE does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
100
			case "PAYMENTPLAN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal PAYMENTPLAN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
101
				return Svea\WebPay\Config\ConfigurationService::SWP_PROD_WS_URL;
102
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
103
			case "HOSTED_ADMIN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal HOSTED_ADMIN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
104
				return Svea\WebPay\Config\ConfigurationService::SWP_PROD_HOSTED_ADMIN_URL;
105
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
106
			case "ADMIN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal ADMIN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
107
				return Svea\WebPay\Config\ConfigurationService::SWP_PROD_ADMIN_URL;
108
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
109
			default:
110
				throw new Exception( 'Invalid type. Accepted values: INVOICE, PAYMENTPLAN, HOSTED, HOSTED_ADMIN' );
111
				break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
112
		}
113
	}
114
115
	/**
116
	 * fetch Checkout Merchant id, used for Checkout order type
117
	 *
118
	 * @return string
119
	 */
120
	public function getCheckoutMerchantId() {
0 ignored issues
show
Coding Style introduced by
The function name getCheckoutMerchantId is in camel caps, but expected get_checkout_merchant_id instead as per the coding standard.
Loading history...
121
		// TODO: Implement getCheckoutMerchantId() method.
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
122
	}
123
124
	/**
125
	 * fetch Checkout Secret word, used for Checkout order type
126
	 *
127
	 * @return string
128
	 */
129
	public function getCheckoutSecret() {
0 ignored issues
show
Coding Style introduced by
The function name getCheckoutSecret is in camel caps, but expected get_checkout_secret instead as per the coding standard.
Loading history...
130
		// TODO: Implement getCheckoutSecret() method.
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
131
	}
132
}
133
134 View Code Duplication
class EduSveaWebPayTestConfig implements \Svea\WebPay\Config\ConfigurationProvider {
0 ignored issues
show
Duplication introduced by
This class 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...
135
136
	/**
137
	 * @var EDU_SveaWebPay
138
	 */
139
	public $plugin;
140
141
	/**
142
	 * EduSveaWebPayTestConfig constructor.
143
	 *
144
	 * @param EDU_SveaWebPay $_plugin
145
	 */
146
	public function __construct( $_plugin ) {
147
		$this->plugin = $_plugin;
148
	}
149
150
	/**
151
	 * fetch username, used with invoice or payment plan (i.e. Svea WebService Europe API)
152
	 *
153
	 * @return string
154
	 *
155
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
156
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
157
	 *
158
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
159
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
160
	 */
161
	public function getUsername( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getUsername is in camel caps, but expected get_username instead as per the coding standard.
Loading history...
162
	}
163
164
	/**
165
	 * fetch password, used with invoice or payment plan (i.e. Svea WebService Europe API)
166
	 *
167
	 * @return string
168
	 *
169
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
170
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
171
	 *
172
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
173
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
174
	 */
175
	public function getPassword( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getPassword is in camel caps, but expected get_password instead as per the coding standard.
Loading history...
176
	}
177
178
	/**
179
	 * fetch client number, used with invoice or payment plan (i.e. Svea WebService Europe API)
180
	 *
181
	 * @return \Svea\WebPay\Config\ClientNumber
182
	 *
183
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
184
	 * @param string $country iso3166 alpha-2 CountryCode, eg. SE, NO, DK, FI, NL, DE can be used if needed to match different configuration settings
185
	 *
186
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidTypeException  in case of unsupported $type
187
	 * @throws \Svea\WebPay\HostedService\Helper\InvalidCountryException  in case of unsupported $country
188
	 */
189
	public function getClientNumber( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getClientNumber is in camel caps, but expected get_client_number instead as per the coding standard.
Loading history...
190
	}
191
192
	/**
193
	 * fetch merchant id, used with card or direct bank payments (i.e. Svea Hosted Web Service API)
194
	 *
195
	 * @return string
196
	 *
197
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
198
	 * @param string $country CountryCode eg. SE, NO, DK, FI, NL, DE
199
	 */
200
	public function getMerchantId( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getMerchantId is in camel caps, but expected get_merchant_id instead as per the coding standard.
Loading history...
201
		return $this->plugin->get_option( 'merchant_key', '' );
202
	}
203
204
	/**
205
	 * fetch secret word, used with card or direct bank payments (i.e. Svea Hosted Web Service API)
206
	 *
207
	 * @return string
208
	 *
209
	 * @param string $type    Svea\WebPay\Config\ConfigurationProvider::INVOICE_TYPE, ::PAYMENTPLAN_TYPE can be used if needed to match different configuration settings
210
	 * @param string $country CountryCode eg. SE, NO, DK, FI, NL, DE
211
	 */
212
	public function getSecret( $type, $country ) {
0 ignored issues
show
Coding Style introduced by
The function name getSecret is in camel caps, but expected get_secret instead as per the coding standard.
Loading history...
213
		return $this->plugin->get_option( 'merchant_secret', '' );
214
	}
215
216
	/**
217
	 * Constants for the endpoint url found in the class ConfigurationService.php
218
	 * getEndPoint() should return an url corresponding to $type.
219
	 *
220
	 * @param string $type one of Svea\WebPay\Config\ConfigurationProvider::HOSTED_TYPE, ::INVOICE_TYPE, ::PAYMENTPLAN_TYPE, ::HOSTED_ADMIN_TYPE, ::ADMIN_TYPE
221
	 *
222
	 * @throws Exception
223
	 */
224
	public function getEndPoint( $type ) {
0 ignored issues
show
Coding Style introduced by
The function name getEndPoint is in camel caps, but expected get_end_point instead as per the coding standard.
Loading history...
225
		switch ( strtoupper( $type ) ) {
226
			case "HOSTED":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal HOSTED does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
227
				return Svea\WebPay\Config\ConfigurationService::SWP_TEST_URL;
228
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
229
			case "INVOICE":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal INVOICE does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
230
			case "PAYMENTPLAN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal PAYMENTPLAN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
231
				return Svea\WebPay\Config\ConfigurationService::SWP_TEST_WS_URL;
232
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
233
			case "HOSTED_ADMIN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal HOSTED_ADMIN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
234
				return Svea\WebPay\Config\ConfigurationService::SWP_TEST_HOSTED_ADMIN_URL;
235
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
236
			case "ADMIN":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal ADMIN does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
237
				return Svea\WebPay\Config\ConfigurationService::SWP_TEST_ADMIN_URL;
238
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
239
			default:
240
				throw new Exception( 'Invalid type. Accepted values: INVOICE, PAYMENTPLAN, HOSTED, HOSTED_ADMIN' );
241
				break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
242
		}
243
	}
244
245
	/**
246
	 * fetch Checkout Merchant id, used for Checkout order type
247
	 *
248
	 * @return string
249
	 */
250
	public function getCheckoutMerchantId() {
0 ignored issues
show
Coding Style introduced by
The function name getCheckoutMerchantId is in camel caps, but expected get_checkout_merchant_id instead as per the coding standard.
Loading history...
251
		// TODO: Implement getCheckoutMerchantId() method.
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
252
	}
253
254
	/**
255
	 * fetch Checkout Secret word, used for Checkout order type
256
	 *
257
	 * @return string
258
	 */
259
	public function getCheckoutSecret() {
0 ignored issues
show
Coding Style introduced by
The function name getCheckoutSecret is in camel caps, but expected get_checkout_secret instead as per the coding standard.
Loading history...
260
		// TODO: Implement getCheckoutSecret() method.
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
261
	}
262
}