ama-team/php-projection-framework

View on GitHub

Showing 102 of 102 total issues

Function validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate($value, array $path = [])
    {
        if (!is_array($value)) {
            throw new ValidationException('Is not an array', $path);
        }
Severity: Minor
Found in src/Framework/Validation/Tile/TileFaceValidator.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate($value, array $path = [])
    {
        if (!is_array($value)) {
            throw new ValidationException('Is not an array', $path);
        }
Severity: Minor
Found in src/Framework/Validation/Tile/TileRowValidator.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

class FXAAProcessor implements ProcessorInterface
{
    const DEBUG_OFF = 0;
    const DEBUG_EDGE = 1;
    // Horizontal edges are

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 '92', column '27').
Open

                throw new \BadMethodCallException($message);
Severity: Minor
Found in src/Image/Adapter/Gd/Image.php by phpmd

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

Function treeify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function treeify(array $tiles)
    {
        $target = [];
        foreach ($tiles as $tile) {
            $position = $tile->getPosition();
Severity: Minor
Found in src/Tile/Tile.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid using static access to class '\AmaTeam\Image\Projection\Type\CubeMap\Mapping\Vector' in method 'getPosition'.
Open

        $dominant = Vector::getDominant($vector);
Severity: Minor
Found in src/Type/CubeMap/Mapping.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 'AmaTeam\Image\Projection\Image\Adapter\Imagick\Color' in method 'setColorAt'.
Open

        Color::set($pixel, $color);
Severity: Minor
Found in src/Image/Adapter/Imagick/Image.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 '\AmaTeam\Image\Projection\Image\Utility\Luma' in method 'fill'.
Open

        $this->west = Luma::compute($grid->west);

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 '\AmaTeam\Image\Projection\Filesystem\Factory' in method '__construct'.
Open

        $this->filesystem = $filesystem ?: Factory::create();
Severity: Minor
Found in src/Type/Registry.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 'AmaTeam\Image\Projection\Type\SizeExtractor' in method 'createReader'.
Open

        $tileSize = $tileSize ?: SizeExtractor::extractTileSize($face);
Severity: Minor
Found in src/Type/AbstractHandler.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 '\AmaTeam\Image\Projection\Image\Utility\Luma' in method 'fill'.
Open

        $this->north = Luma::compute($grid->north);

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 'AmaTeam\Image\Projection\Type\SizeExtractor' in method 'validate'.
Open

        $layout = $layout ?: SizeExtractor::calculateLayout($face);

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 '\AmaTeam\Image\Projection\Image\Utility\Luma' in method 'fill'.
Open

        $this->south = Luma::compute($grid->south);

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 '\AmaTeam\Image\Projection\Tile\Tile' in method 'createReader'.
Open

        $tree = Tile::treeify($tiles);
Severity: Minor
Found in src/Type/AbstractHandler.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 '\AmaTeam\Image\Projection\Type\CubeMap\Mapping\Vector' in method 'getPosition'.
Open

        $vector = Vector::multiply($vector, abs(1 / $value));
Severity: Minor
Found in src/Type/CubeMap/Mapping.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 '\AmaTeam\Image\Projection\Image\EncodingOptions' in method '__construct'.
Open

        $this->encoding = $encoding ?: EncodingOptions::defaults();

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 '\AmaTeam\Image\Projection\Type\CubeMap\Mapping\Face' in method '__construct'.
Open

        $this->faces = Face::generateCubeFaces();
Severity: Minor
Found in src/Type/CubeMap/Mapping.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 '\AmaTeam\Image\Projection\Image\Utility\Luma' in method 'fill'.
Open

        $this->east = Luma::compute($grid->east);

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 '\AmaTeam\Image\Projection\Type\CubeMap\Mapping\Face' in method '__construct'.
Open

        $this->faceNameMap = Face::getNames();
Severity: Minor
Found in src/Type/CubeMap/Mapping.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 '\AmaTeam\Image\Projection\Conversion\Processor\FXAA\SubPixelOffsetCalculator' in method 'process'.
Open

                $offset = SubPixelOffsetCalculator::calculate($edge);

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

Severity
Category
Status
Source
Language