Method RemoveAccents
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
Function LongestCommonSubsequence
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class QString has 13 public methods. Consider refactoring QString to keep number of public methods under 10. Open
abstract class QString {
/**
* This faux constructor method throws a caller exception.
* The String object should never be instantiated, and this constructor
* override simply guarantees it.
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class QString has an overall complexity of 51 which is very high. The configured complexity threshold is 50. Open
abstract class QString {
/**
* This faux constructor method throws a caller exception.
* The String object should never be instantiated, and this constructor
* override simply guarantees it.
- Exclude checks
File QString.class.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* An abstract utility class to handle string manipulation. All methods
* are statically available.
*/
Method LongestCommonSubsequence
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
Function LastCharacter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public final static function LastCharacter($strString) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$intLength = mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__);
if ($intLength > 0)
return mb_substr($strString, $intLength - 1, 1, __QAPPLICATION_ENCODING_TYPE__);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function FirstCharacter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public final static function FirstCharacter($strString) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
if (mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__) > 0)
return mb_substr($strString, 0 , 1, __QAPPLICATION_ENCODING_TYPE__);
else
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $intSize;
The method LongestCommonSubsequence() has an NPath complexity of 540. The configured NPath complexity threshold is 200. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method RemoveAccents() has 127 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Exclude checks
The method LongestCommonSubsequence() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using undefined variables such as '$double_chars' which will lead to PHP notices. Open
$strString = str_replace($double_chars['in'], $double_chars['out'], $strString);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$double_chars' which will lead to PHP notices. Open
$double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$double_chars' which will lead to PHP notices. Open
$double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254));
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$double_chars' which will lead to PHP notices. Open
$strString = str_replace($double_chars['in'], $double_chars['out'], $strString);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '15', column '14'). Open
throw new QCallerException('String should never be instantiated. All methods and variables are publically statically accessible.');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '433', column '15'). Open
throw new QCallerException('Cannot generate a random string of zero length');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '437', column '15'). Open
throw new QCallerException('Character set must contain at least 1 printable character.');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method RemoveAccents uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Assume ISO-8859-1 if not UTF-8
$chars['in'] = chr(128) . chr(131) . chr(138) . chr(142) . chr(154) . chr(158)
. chr(159) . chr(162) . chr(165) . chr(181) . chr(192) . chr(193) . chr(194)
. chr(195) . chr(196) . chr(197) . chr(199) . chr(200) . chr(201) . chr(202)
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method SanitizeForUrl uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return $strString;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'QType' in method 'GetRandomString'. Open
$intLength = QType::Cast($intLength, QType::Integer);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method FirstCharacter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (strlen($strString)) {
return $strString[0];
} else {
return null;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method LongestCommonSubsequence uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$str1Len = strlen($str1);
$str2Len = strlen($str2);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method FirstCharacter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'QString' in method 'SanitizeForUrl'. Open
$strString = QString::RemoveAccents($strString);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method DisplayByteSize uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return $intSize;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method LastCharacter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$intLength = strlen($strString);
if ($intLength > 0)
return $strString[$intLength -1];
else
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'QType' in method 'GetRandomString'. Open
$strCharacterSet = QType::Cast($strCharacterSet, QType::String);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid variables with short names like $s. Configured minimum length is 3. Open
public static function Base64UrlSafeEncode($s) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $s. Configured minimum length is 3. Open
public static function Base64UrlSafeDecode($s) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $double_chars is not named in camelCase. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $double_chars is not named in camelCase. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $double_chars is not named in camelCase. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $CSL is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $double_chars is not named in camelCase. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method XmlEscape is not named in camelCase. Open
public final static function XmlEscape($strString) {
if ((mb_strpos($strString, '<', 0, __QAPPLICATION_ENCODING_TYPE__) !== false) ||
(mb_strpos($strString, '&', 0, __QAPPLICATION_ENCODING_TYPE__) !== false)) {
$strString = str_replace(']]>', ']]]]><![CDATA[>', $strString);
$strString = sprintf('<![CDATA[%s]]>', $strString);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method Base64UrlSafeDecode is not named in camelCase. Open
public static function Base64UrlSafeDecode($s) {
$s = str_replace('_', '/', $s);
$s = str_replace('-', '+', $s);
$s = base64_decode($s);
return ($s);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method LastCharacter is not named in camelCase. Open
public final static function LastCharacter($strString) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$intLength = mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__);
if ($intLength > 0)
return mb_substr($strString, $intLength - 1, 1, __QAPPLICATION_ENCODING_TYPE__);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method LongestCommonSubsequence is not named in camelCase. Open
public final static function LongestCommonSubsequence($str1, $str2) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
$str1Len = mb_strlen($str1, __QAPPLICATION_ENCODING_TYPE__);
$str2Len = mb_strlen($str2, __QAPPLICATION_ENCODING_TYPE__);
} else {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method FirstCharacter is not named in camelCase. Open
public final static function FirstCharacter($strString) {
if (defined('__QAPPLICATION_ENCODING_TYPE__')) {
if (mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__) > 0)
return mb_substr($strString, 0 , 1, __QAPPLICATION_ENCODING_TYPE__);
else
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method StartsWith is not named in camelCase. Open
public final static function StartsWith($strHaystack, $strNeedle) {
// If the length of needle is greater than the length of haystack, then return false
if(strlen($strNeedle) > strlen($strHaystack)){
// To supress the error in strpos function below
return false;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method RemoveAccents is not named in camelCase. Open
public static function RemoveAccents($strString) {
if (!preg_match('/[\x80-\xff]/', $strString))
return $strString;
if (self::IsUtf8($strString)) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method IsUtf8 is not named in camelCase. Open
public static function IsUtf8($strString) {
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method GetRandomString is not named in camelCase. Open
public static function GetRandomString($intLength, $strCharacterSet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') {
// Cast in case there were something else
$intLength = QType::Cast($intLength, QType::Integer);
$strCharacterSet = QType::Cast($strCharacterSet, QType::String);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method SanitizeForUrl is not named in camelCase. Open
public static function SanitizeForUrl($strString = '', $intMaxLength = null) {
if (mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__) > $intMaxLength ||
(mb_strlen($strString, __QAPPLICATION_ENCODING_TYPE__) < $intMaxLength)) {
$strString = strip_tags($strString);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method EndsWith is not named in camelCase. Open
public final static function EndsWith($strHaystack, $strNeedle) {
// If the length of needle is greater than the length of haystack, then return false
if(strlen($strNeedle) > strlen($strHaystack)){
// To supress the error in strpos function below
return false;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method DisplayByteSize is not named in camelCase. Open
public static function DisplayByteSize($intSize, $intPrecision = null) {
if (is_null($intSize)) return 'n/a';
if ($intSize == 0) return '0 KB';
if ($intSize < 0) return '-';
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method Truncate is not named in camelCase. Open
public final static function Truncate($strText, $intMaxLength) {
if (mb_strlen($strText, __QAPPLICATION_ENCODING_TYPE__) > $intMaxLength)
return mb_substr($strText, 0, $intMaxLength - 3, __QAPPLICATION_ENCODING_TYPE__) . "...";
else
return $strText;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method Base64UrlSafeEncode is not named in camelCase. Open
public static function Base64UrlSafeEncode($s) {
$s = base64_encode($s);
$s = str_replace('+', '-', $s);
$s = str_replace('/', '_', $s);
$s = str_replace('=', '', $s);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}