rinvex/cortex-foundation

View on GitHub
src/Providers/FoundationServiceProvider.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method boot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function boot(): void
    {
        // Fix the specified key was too long error
        Schema::defaultStringLength(191);

Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

Method bindBlueprintMacro has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function bindBlueprintMacro(): void
    {
        Blueprint::macro('auditable', function () {
            $this->integer('created_by_id')->unsigned()->after('created_at')->nullable();
            $this->string('created_by_type')->after('created_at')->nullable();
Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

Avoid too many return statements within this method.
Open

            return false;
Severity: Major
Found in src/Providers/FoundationServiceProvider.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return in_array($name, $parameterNames);
Severity: Major
Found in src/Providers/FoundationServiceProvider.php - About 30 mins to fix

The class FoundationServiceProvider has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
Open

class FoundationServiceProvider extends ServiceProvider
{
    use ConsoleTools;

    /**

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '98', column '24').
Open

            return new \Cortex\Foundation\Overrides\Illuminate\Session\DatabaseSessionHandler(

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

Avoid assigning values to variables in if clauses and the like (line '130', column '17').
Open

    public function boot(): void
    {
        // Fix the specified key was too long error
        Schema::defaultStringLength(191);

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

There are no issues that match your filters.

Category
Status