Showing 18 of 20 total issues
Function process
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (!$this->isEnableGroupCheck) {
$currentUser = $this->context->getAspect('frontend.user');
$currentUserId = (int)$currentUser->get('id');
- Read upRead up
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
File CheckConfiguration.php
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
ExtensionConfiguration
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ExtensionConfiguration implements SingletonInterface
{
public const FILE_TYPES_WILDCARD = '*';
public const OUTPUT_STREAM = 'stream';
Function onResourceStorageEmitPreGeneratePublicUrlSignal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function onResourceStorageEmitPreGeneratePublicUrlSignal(GeneratePublicUrlForResourceEvent $event): void
{
$driver = $event->getDriver();
$resource = $event->getResource();
- Read upRead up
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 onIconFactoryEmitBuildIconForResourceSignal
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function onIconFactoryEmitBuildIconForResourceSignal(ModifyIconForResourcePropertiesEvent $event): void
{
$resource = $event->getResource();
$driverType = $resource->getStorage()->getDriverType();
- Read upRead up
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
Method listAction
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listAction(?Filter $filter = null): ResponseInterface
{
if ($this->request->hasArgument('reset') && (bool)$this->request->getArgument('reset')) {
$filter = new Filter();
} elseif (!$filter instanceof Filter) {
Method deliver
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deliver(string $jsonWebToken, ServerRequestInterface $request): ResponseInterface
{
if (!$this->retrieveDataFromJsonWebToken($jsonWebToken)) {
return $this->getAccessDeniedResponse($request, 'Could not parse token.');
}
Method process
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (!$this->isEnableGroupCheck) {
$currentUser = $this->context->getAspect('frontend.user');
$currentUserId = (int)$currentUser->get('id');
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)) {
- Read upRead up
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) {
- Read upRead up
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
Method createLocalStorage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createLocalStorage($name, $basePath, $pathType, $description = '', $default = false): int
Method dispatchBeforeFileDeliverEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string &$outputFunction,
array &$header,
string $fileName,
string $mimeType,
bool $forceDownload
Function determineSecureDownloadsDriverBaseUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function determineSecureDownloadsDriverBaseUrl(): void
{
if ($this->baseUri === null) {
if (!empty($this->configuration['baseUri'])) {
$this->baseUri = rtrim((string)$this->configuration['baseUri'], '/') . '/';
- Read upRead up
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());
- Read upRead up
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 deliver
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deliver(string $jsonWebToken, ServerRequestInterface $request): ResponseInterface
{
if (!$this->retrieveDataFromJsonWebToken($jsonWebToken)) {
return $this->getAccessDeniedResponse($request, 'Could not parse token.');
}
- Read upRead up
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 too many return
statements within this method. Open
return $this->getFileNotFoundResponse($request, 'File does not exist!');
Function hasAccess
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function hasAccess(): bool
{
foreach (CheckRegistry::getChecks() as $check) {
$checkClass = $check['class'];
if ($checkClass instanceof AbstractCheck) {
- Read upRead up
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';
}
- Read upRead up
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"