astehlik/typo3-extension-mediaoembed

View on GitHub

Showing 14 of 17 total issues

Avoid excessively long class names like RequestHandlerClassDoesNotExistsException. Keep class name length under 40.
Open

final class RequestHandlerClassDoesNotExistsException extends OEmbedException
{
    public function __construct(Provider $provider)
    {
        $message = 'The configured renderer class %s of provider: %s does not exists.';

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

Source https://phpmd.org/rules/naming.html#longclassname

Avoid excessively long variable names like $afterFormEnginePageInitializedEvent. Keep variable name length under 30.
Open

    public function __invoke(AfterFormEnginePageInitializedEvent $afterFormEnginePageInitializedEvent): void

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Function handleUrlInputBlur has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handleUrlInputBlur(urlInput) {
    if (!urlInput.value.includes('<iframe')) {
      return;
    }

Severity: Minor
Found in Resources/Public/JavaScript/backend/url-parser.js - About 1 hr to fix

    Avoid using undefined variables such as '$queryParams' which will lead to PHP notices.
    Open

                $queryParams['rel'] = $response->getConfiguration()->shouldPlayRelated() ? '1' : '0';

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

    Avoid using undefined variables such as '$queryParams' which will lead to PHP notices.
    Open

                return $this->urlService->mergeQueryParameters($url, $queryParams);

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

        private function startRequestLoop(Configuration $configuration): void
        {
            $response = null;
            $request = null;
    
    
    Severity: Minor
    Found in Classes/Controller/OembedController.php - About 1 hr to fix

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

              int $uid,
              string $url,
              int $maxHeight = 0,
              int $maxWidth = 0,
              bool $playRelated = true,
      Severity: Minor
      Found in Classes/Domain/Model/Content.php - About 45 mins to fix

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

        class OembedController extends ActionController
        {
            private ConfigurationFactory $configurationFactory;
        
            private ContainerInterface $container;

        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

        Avoid too many return statements within this method.
        Open

                        return $this->createResponseGeneric($finalResponseData, $configuration);
        Severity: Major
        Found in Classes/Response/ResponseBuilder.php - About 30 mins to fix

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

                  bool $playRelated = true,
          Severity: Minor
          Found in Classes/Domain/Model/Content.php by phpmd

          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

          Avoid too many return statements within this function.
          Open

                return;
          Severity: Major
          Found in Resources/Public/JavaScript/backend/url-parser.js - About 30 mins to fix

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

              handleUrlInputBlur(urlInput) {
                if (!urlInput.value.includes('<iframe')) {
                  return;
                }
            
            
            Severity: Minor
            Found in Resources/Public/JavaScript/backend/url-parser.js - 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 unused parameters such as '$afterFormEnginePageInitializedEvent'.
            Open

                public function __invoke(AfterFormEnginePageInitializedEvent $afterFormEnginePageInitializedEvent): void

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$errorDetails'.
            Open

                public function __construct(string $message, int $httpCode, \Throwable $previous = null, string $errorDetails = '')

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Severity
            Category
            Status
            Source
            Language