renoki-co/php-k8s

View on GitHub
src/Traits/Resource/HasAttributes.php

Summary

Maintainability
A
30 mins
Test Coverage

Avoid too many return statements within this method.
Open

        return $this;
Severity: Major
Found in src/Traits/Resource/HasAttributes.php - About 30 mins to fix

    Avoid using static access to class '\Illuminate\Support\Arr' in method 'setAttribute'.
    Open

            Arr::set($this->attributes, $name, $value);
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Arr' in method 'removeAttribute'.
    Open

            Arr::forget($this->attributes, $name);
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

                $attribute = Str::camel(
                    str_replace('get', '', $method)
                );
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Arr' in method 'getAttribute'.
    Open

            return Arr::get($this->attributes, $name, $default);
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

                $attribute = Str::camel(
                    str_replace('set', '', $method)
                );
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

                $attribute = Str::camel(
                    str_replace('remove', '', $method)
                );
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

            if (Str::startsWith($method, 'get')) {
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

            if (Str::startsWith($method, 'remove')) {
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 '\Illuminate\Support\Str' in method '__call'.
    Open

            if (Str::startsWith($method, 'set')) {
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.php by phpmd

    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 short method names like HasAttributes::is(). The configured minimum method name length is 3.
    Open

        public function is(self $instance)
        {
            return $instance->toJson() === $this->toJson();
        }
    Severity: Minor
    Found in src/Traits/Resource/HasAttributes.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

    There are no issues that match your filters.

    Category
    Status