iranianpep/code-jetter

View on GitHub
core/Base.php

Summary

Maintainability
B
5 hrs
Test Coverage

The method getComponentsNamespace has a boolean flag argument $trailingBackSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getComponentsNamespace($trailingBackSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getControllersPath has a boolean flag argument $trailingSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getControllersPath($component = null, $trailingSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getComponentName has a boolean flag argument $lowercase, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getComponentName($lowercase = false)
Severity: Minor
Found in core/Base.php by phpmd

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 getModelsNamespace has a boolean flag argument $trailingBackSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getModelsNamespace($component = null, $trailingBackSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getControllersNamespace has a boolean flag argument $trailingBackSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getControllersNamespace($component = null, $trailingBackSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getComponentsPath has a boolean flag argument $trailingSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getComponentsPath($trailingSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getModelsPath has a boolean flag argument $trailingSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getModelsPath($component = null, $trailingSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getMappersNamespace has a boolean flag argument $trailingBackSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getMappersNamespace($component = null, $trailingBackSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getMappersPath has a boolean flag argument $trailingSlash, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getMappersPath($component = null, $trailingSlash = true)
Severity: Minor
Found in core/Base.php by phpmd

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 getComponentName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return $componentName;
        }
Severity: Minor
Found in core/Base.php by phpmd

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getMappersPath($component = null, $trailingSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $path = $this->getComponentsPath().$component.DIRECTORY_SEPARATOR.'mappers';
Severity: Major
Found in core/Base.php and 2 other locations - About 1 hr to fix
core/Base.php on lines 109..116
core/Base.php on lines 126..133

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getModelsPath($component = null, $trailingSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $path = $this->getComponentsPath().$component.DIRECTORY_SEPARATOR.'models';
Severity: Major
Found in core/Base.php and 2 other locations - About 1 hr to fix
core/Base.php on lines 126..133
core/Base.php on lines 143..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getControllersPath($component = null, $trailingSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $path = $this->getComponentsPath().$component.DIRECTORY_SEPARATOR.'controllers';
Severity: Major
Found in core/Base.php and 2 other locations - About 1 hr to fix
core/Base.php on lines 109..116
core/Base.php on lines 143..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getControllersNamespace($component = null, $trailingBackSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $namespace = $this->getComponentsNamespace().$component.'\\'.'components';
Severity: Major
Found in core/Base.php and 2 other locations - About 45 mins to fix
core/Base.php on lines 158..165
core/Base.php on lines 190..197

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getModelsNamespace($component = null, $trailingBackSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $namespace = $this->getComponentsNamespace().$component.'\\'.'models';
Severity: Major
Found in core/Base.php and 2 other locations - About 45 mins to fix
core/Base.php on lines 175..182
core/Base.php on lines 190..197

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function getMappersNamespace($component = null, $trailingBackSlash = true)
    {
        $component = empty($component) ? $this->getComponentName(true) : strtolower($component);

        $namespace = $this->getComponentsNamespace().$component.'\\'.'mappers';
Severity: Major
Found in core/Base.php and 2 other locations - About 45 mins to fix
core/Base.php on lines 158..165
core/Base.php on lines 175..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

The 'getCurrentLoggedIn()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getCurrentLoggedIn()
    {
        return (new UserAuthentication())->getCurrentLoggedIn();
    }
Severity: Minor
Found in core/Base.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

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

There are no issues that match your filters.

Category
Status