The method asIs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = URLify::downcode($text, $language);
return self::hashtagify($text);
}
- 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 camelcase_Snake uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = lcfirst(ucwords(strtolower(URLify::downcode($text, $language))));
return self::hashtagify($text, "_", "And");
}
- 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 camelCase uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = lcfirst(ucwords(strtolower(URLify::downcode($text, $language))));
return self::hashtagify($text, null, 'And');
}
- 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 UPPERCASE uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = strtoupper(URLify::downcode($text, $language));
return self::hashtagify($text, null, "AND");
}
- 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 lowercase_snake uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = strtolower(URLify::downcode($text, $language));
return self::hashtagify($text, "_");
}
- 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 Uppercase_Snake uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = ucwords(strtolower(URLify::downcode($text, $language)));
return self::hashtagify($text, "_", "And");
}
- 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 lowercase uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = strtolower(URLify::downcode($text, $language));
return self::hashtagify($text);
}
- 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 PascalCase uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = ucwords(strtolower(URLify::downcode($text, $language)));
return self::hashtagify($text, null, 'And');
}
- 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 camelcase_Snake is not named in camelCase. Open
public static function camelcase_Snake ($text, $language = "") {
if (is_array($text)) {
return array_map( function($string) { return Hashtagify::camelcase_Snake($string); }, $text);
} else {
$text = lcfirst(ucwords(strtolower(URLify::downcode($text, $language))));
- 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 Uppercase_Snake is not named in camelCase. Open
public static function Uppercase_Snake ($text, $language = "") {
if (is_array($text)) {
return array_map( function($string) { return Hashtagify::Uppercase_Snake($string); }, $text);
} else {
$text = ucwords(strtolower(URLify::downcode($text, $language)));
- 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 UPPERCASE is not named in camelCase. Open
public static function UPPERCASE ($text, $language = "") {
if (is_array($text)) {
return array_map( function($string) { return Hashtagify::UPPERCASE($string); }, $text);
} else {
$text = strtoupper(URLify::downcode($text, $language));
- 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 lowercase_snake is not named in camelCase. Open
public static function lowercase_snake ($text, $language = "") {
if (is_array($text)) {
return array_map( function($string) { return Hashtagify::lowercase_snake($string); }, $text);
} else {
$text = strtolower(URLify::downcode($text, $language));
- 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 PascalCase is not named in camelCase. Open
public static function PascalCase ($text, $language = "") {
if (is_array($text)) {
return array_map( function($string) { return Hashtagify::PascalCase($string); }, $text);
} else {
$text = ucwords(strtolower(URLify::downcode($text, $language)));
- 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() {
}
}