attogram/shared-media-api

View on GitHub

Showing 23 of 23 total issues

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

<?php

namespace Attogram\SharedMedia\Api;

use PHPUnit\Framework\TestCase;
Severity: Major
Found in tests/ToolsTest.php and 4 other locations - About 2 hrs to fix
tests/BaseTest.php on lines 1..28
tests/CategoryTest.php on lines 1..28
tests/MediaTest.php on lines 1..28
tests/PageTest.php on lines 1..28

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 91.

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 5 locations. Consider refactoring.
Open

<?php

namespace Attogram\SharedMedia\Api;

use PHPUnit\Framework\TestCase;
Severity: Major
Found in tests/BaseTest.php and 4 other locations - About 2 hrs to fix
tests/CategoryTest.php on lines 1..28
tests/MediaTest.php on lines 1..28
tests/PageTest.php on lines 1..28
tests/ToolsTest.php on lines 1..28

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 91.

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 5 locations. Consider refactoring.
Open

<?php

namespace Attogram\SharedMedia\Api;

use PHPUnit\Framework\TestCase;
Severity: Major
Found in tests/MediaTest.php and 4 other locations - About 2 hrs to fix
tests/BaseTest.php on lines 1..28
tests/CategoryTest.php on lines 1..28
tests/PageTest.php on lines 1..28
tests/ToolsTest.php on lines 1..28

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 91.

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 5 locations. Consider refactoring.
Open

<?php

namespace Attogram\SharedMedia\Api;

use PHPUnit\Framework\TestCase;
Severity: Major
Found in tests/PageTest.php and 4 other locations - About 2 hrs to fix
tests/BaseTest.php on lines 1..28
tests/CategoryTest.php on lines 1..28
tests/MediaTest.php on lines 1..28
tests/ToolsTest.php on lines 1..28

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 91.

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 5 locations. Consider refactoring.
Open

<?php

namespace Attogram\SharedMedia\Api;

use PHPUnit\Framework\TestCase;
Severity: Major
Found in tests/CategoryTest.php and 4 other locations - About 2 hrs to fix
tests/BaseTest.php on lines 1..28
tests/MediaTest.php on lines 1..28
tests/PageTest.php on lines 1..28
tests/ToolsTest.php on lines 1..28

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 91.

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

Method send has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function send()
    {
        $this->logger->debug('Transport:send');
        if (!$this->hasParams()) {
            $this->logger->error('Transport::send: params Not Found');
Severity: Minor
Found in src/Transport.php - About 1 hr to fix

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

        protected function setGeneratorCategories()
        {
            $this->logger->debug('Base:setGeneratorCategories');
            $this->setParam('generator', 'categories');
            $this->setParam('gclprop', 'hidden|timestamp');
    Severity: Minor
    Found in src/Base.php and 1 other location - About 55 mins to fix
    src/Base.php on lines 125..131

    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 54.

    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 2 locations. Consider refactoring.
    Open

        protected function setGeneratorCategorymembers()
        {
            $this->logger->debug('Base:setGeneratorCategorymembers');
            $this->setParam('generator', 'categorymembers');
            $this->setParam('gcmprop', 'ids|title|type|timestamp');
    Severity: Minor
    Found in src/Base.php and 1 other location - About 55 mins to fix
    src/Base.php on lines 138..144

    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 54.

    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 2 locations. Consider refactoring.
    Open

        public function getMediaOnPage()
        {
            $this->logger->debug('Meda:getMediaOnPage');
            if (!$this->setIdentifier('', 's')) {
                return [];
    Severity: Minor
    Found in src/Media.php and 1 other location - About 30 mins to fix
    src/Category.php on lines 50..58

    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 47.

    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 2 locations. Consider refactoring.
    Open

        public function getCategoryfromPage()
        {
            $this->logger->debug('Category:getCategoryfromPage');
            if (!$this->setIdentifier('', 's')) {
                return [];
    Severity: Minor
    Found in src/Category.php and 1 other location - About 30 mins to fix
    src/Media.php on lines 50..58

    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 47.

    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

    Missing class import via use statement (line '25', column '22').
    Open

            $media = new \Attogram\SharedMedia\Api\Media();
    Severity: Minor
    Found in tests/MediaTest.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

    Missing class import via use statement (line '25', column '21').
    Open

            $page = new \Attogram\SharedMedia\Api\Page();
    Severity: Minor
    Found in tests/PageTest.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

    Missing class import via use statement (line '25', column '21').
    Open

            $base = new \Attogram\SharedMedia\Api\Base();
    Severity: Minor
    Found in tests/BaseTest.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

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

            $category = new \Attogram\SharedMedia\Api\Category();
    Severity: Minor
    Found in tests/CategoryTest.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

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

            $sources = new \Attogram\SharedMedia\Api\Sources();
    Severity: Minor
    Found in tests/SourcesTest.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

    Missing class import via use statement (line '25', column '22').
    Open

            $tools = new \Attogram\SharedMedia\Api\Tools();
    Severity: Minor
    Found in tests/ToolsTest.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

    Missing class import via use statement (line '36', column '26').
    Open

            $transport = new \Attogram\SharedMedia\Api\Transport();
    Severity: Minor
    Found in tests/TransportTest.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

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

        private function decodeRequest()
        {
            $this->logger->debug('Transport:decodeRequest');
            if (($this->response = json_decode($this->request->getBody(), true))) {
                return true;
    Severity: Minor
    Found in src/Transport.php by phpmd

    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

    Property \Attogram\SharedMedia\Api\Transport->logger has undeclared type \Psr\Log\LoggerInterface
    Open

        public $logger;
    Severity: Minor
    Found in src/Transport.php by phan

    Return type of getClient() is undeclared type \GuzzleHttp\Client
    Open

        private function getClient()
    Severity: Minor
    Found in src/Transport.php by phan
    Severity
    Category
    Status
    Source
    Language