Leuchtfeuer/typo3-secure-downloads

View on GitHub
Classes/UserFunctions/CheckConfiguration.php

Summary

Maintainability
B
5 hrs
Test Coverage

File CheckConfiguration.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in Classes/UserFunctions/CheckConfiguration.php - About 2 hrs to fix

    Function getSuitableDirectories has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getSuitableDirectories(Finder $directories, string $publicDirectory): void
        {
            foreach ($directories as $directory) {
                $directoryPath = sprintf('%s/%s', $publicDirectory, $directory->getRelativePathname());
                if ($this->isDirectoryMatching($directoryPath)) {
    Severity: Minor
    Found in Classes/UserFunctions/CheckConfiguration.php - About 1 hr 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 checkDirectories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function checkDirectories(): void
        {
            $lastSecuredDirectory = null;
    
            foreach ($this->directories as $directory) {
    Severity: Minor
    Found in Classes/UserFunctions/CheckConfiguration.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 checkFilesAccessibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function checkFilesAccessibility(string $realDirectoryPath, string $directoryPath): void
        {
            $fileFinder = (new Finder())->name($this->fileTypePattern)->in($realDirectoryPath)->depth(0);
            foreach ($fileFinder->files() as $file) {
                $publicUrl = sprintf('%s/%s/%s', $this->domain, $directoryPath, $file->getRelativePathname());
    Severity: Minor
    Found in Classes/UserFunctions/CheckConfiguration.php - About 35 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 renderCheckAccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function renderCheckAccess(): string
        {
            if ($this->extensionConfiguration->isSkipCheckConfiguration()) {
                return 'Check skipped as the option "backend.skipCheckConfiguration" is active';
            }
    Severity: Minor
    Found in Classes/UserFunctions/CheckConfiguration.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

    There are no issues that match your filters.

    Category
    Status