The method sanitizeString has a boolean flag argument $strip, which is a certain sign of a Single Responsibility Principle violation. Open
public static function sanitizeString($string, $alpha = true, $strip = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method contains has a boolean flag argument $caseSensitive, which is a certain sign of a Single Responsibility Principle violation. Open
public static function contains($string, $subStr, $caseSensitive = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method sanitizeString has a boolean flag argument $alpha, which is a certain sign of a Single Responsibility Principle violation. Open
public static function sanitizeString($string, $alpha = true, $strip = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class 'efureev\uString' in method 'compareString'. Open
$expectedLength = uString::byteLength($expected);
- 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 using static access to class 'efureev\uString' in method 'compareString'. Open
$actualLength = uString::byteLength($actual);
- 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 class uString is not named in CamelCase. Open
class uString
{
/**
* Start string with $startStr
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Inline control structures are not allowed Open
if ($strip) $string = self::stripSpace($string);
- Exclude checks
Inline control structures are not allowed Open
if ($startStr === '')
- Exclude checks
Inline control structures are not allowed Open
if ($alpha) $string = preg_replace('/[^a-zA-Z 0-9]+/', '', $string);
- Exclude checks
Class name "uString" is not in camel caps format Open
class uString
- Exclude checks