sixty-nine/php-cloud-lib

View on GitHub
src/SixtyNine/Cloud/Command/CommandsHelper.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method createCloud has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createCloud($type, InputInterface $input)
    {
        Assert::oneOf($type, array('from-url', 'from-file'), 'Invalid type for createCloud: ' . $type);

        $stopwatch = new Stopwatch();
Severity: Major
Found in src/SixtyNine/Cloud/Command/CommandsHelper.php - About 2 hrs to fix

    Method getFilterBuilder has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $minWordLength,
            $maxWordLength,
            $changeCase = null,
            $noRemoveNumbers = false,
            $noRemoveUnwanted = false,
    Severity: Minor
    Found in src/SixtyNine/Cloud/Command/CommandsHelper.php - About 45 mins to fix

      Method render has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              CloudBuilder $cloudBuilder,
              FontsFactory $factory,
              PlacerInterface $placer = null,
              $renderBoxes = false,
              $renderMask = false
      Severity: Minor
      Found in src/SixtyNine/Cloud/Command/CommandsHelper.php - About 35 mins to fix

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

        class CommandsHelper
        {
            protected $fontSizeBoosts = array('linear', 'dim', 'boost');
            protected $paletteTypes = array('cycle', 'random');
            protected $outputFormats = array('gif', 'jpeg', 'png');

        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

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

                $noRemoveTrailing = false

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

                $noRemoveUnwanted = false,

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

                $renderBoxes = false,

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

                $renderMask = false

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

                $noRemoveNumbers = false,

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

                } else {
                    $builder->importUrl($url);
                }

        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

        Avoid using static access to class '\Webmozart\Assert\Assert' in method 'createCloud'.
        Open

                Assert::oneOf($type, array('from-url', 'from-file'), 'Invalid type for createCloud: ' . $type);

        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 '\Webmozart\Assert\Assert' in method 'output'.
        Open

                Assert::oneOf($outputFormat, $this->outputFormats, 'Invalid output format: ' . $outputFormat);

        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 '\Webmozart\Assert\Assert' in method 'getPlacer'.
        Open

                    Assert::oneOf($name, $availablePlacers, 'Word placer not found: ' . $name);

        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 '\Webmozart\Assert\Assert' in method 'insertWords'.
        Open

                Assert::oneOf($type, array('from-url', 'from-file'), 'Invalid type for createCloud: ' . $type);

        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 '\Webmozart\Assert\Assert' in method 'insertWords'.
        Open

                    Assert::fileExists($file, 'File not found: ' . $file);

        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 '\Webmozart\Assert\Assert' in method 'getColorGenerator'.
        Open

                    Assert::oneOf($paletteType, $this->paletteTypes, 'Palette type must be either "cycle" or "random"');

        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 '\Webmozart\Assert\Assert' in method 'getFont'.
        Open

                Assert::notEmpty($factory->getFonts(), 'No font file found');

        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 '\SixtyNine\Cloud\Factory\FontsFactory' in method 'createCloud'.
        Open

                $factory = FontsFactory::create($fontsPath);

        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 '\Webmozart\Assert\Assert' in method 'getPlacer'.
        Open

                Assert::notEmpty($availablePlacers, 'No word placers available');

        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 '\Webmozart\Assert\Assert' in method 'getFontSizeGenerator'.
        Open

                Assert::oneOf($type, $this->fontSizeBoosts, 'Invalid font size boost: ' . $type);

        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 '\Webmozart\Assert\Assert' in method 'insertWords'.
        Open

                Assert::true(null !== $file || null !== $url);

        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

        There are no issues that match your filters.

        Category
        Status