Dhii/i18n-helper-base

View on GitHub
src/StringTranslatingTrait.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$context'.
Open

    protected function _translate($string, $context = null)
Severity: Minor
Found in src/StringTranslatingTrait.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid using short method names like StringTranslatingTrait::__(). The configured minimum method name length is 3.
Open

    protected function __($string, $args = array(), $context = null)
    {
        $string = $this->_translate($string, $context);
        array_unshift($args, $string);
        $result = call_user_func_array('sprintf', $args);
Severity: Minor
Found in src/StringTranslatingTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

The method _translate is not named in camelCase.
Open

    protected function _translate($string, $context = null)
    {
        return $string;
    }
Severity: Minor
Found in src/StringTranslatingTrait.php by phpmd

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 __ is not named in camelCase.
Open

    protected function __($string, $args = array(), $context = null)
    {
        $string = $this->_translate($string, $context);
        array_unshift($args, $string);
        $result = call_user_func_array('sprintf', $args);
Severity: Minor
Found in src/StringTranslatingTrait.php by phpmd

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

There are no issues that match your filters.

Category
Status