Test Failed
Push — 135-map-multiple-wordpress-obj... ( 3634c2...bb35fb )
by Jonathan
12:00
created

Lib_Test_Enterprise_QueryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTestName() 4 4 1
A _run() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2 View Code Duplication
class Lib_Test_Enterprise_QueryTest extends Lib_Test_TestAbstractEnterprise
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...
3
{
4
	public function getTestName()
0 ignored issues
show
Coding Style introduced by
The function name getTestName is in camel caps, but expected get_test_name instead as per the coding standard.
Loading history...
5
	{
6
		return 'Query';
7
	}
8
	
9
	protected function _run()
10
	{
11
		$query = 'SELECT Id,Name from Account limit 5';
12
		$response = $this->_mySforceConnection->query($query);
13
14
		foreach ($response->records as $record) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
15
			print_r($record);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
16
			print "<br>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <br> 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...
17
		}
18
	}
19
}