Showing 100 of 108 total issues
File services.php
has 1301 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the Silverback API Components Bundle Project
*
Function calculateSortValue
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function calculateSortValue(ComponentPosition $componentPosition, ?int $originalSortValue): void
{
$sortCollection = $componentPosition->getSortCollection();
$sortValueSet = null !== $componentPosition->sortValue;
if (!$sortCollection) {
- 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
AbstractUser
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
#[Silverback\Timestamped]
#[UniqueEntity(fields: ['username'], message: 'Sorry, that user already exists in the database.', errorPath: 'username')]
#[UniqueEntity(fields: ['emailAddress'], message: 'Sorry, that email address already exists in the database.', errorPath: 'emailAddress')]
#[AcbAssert\NewEmailAddress(groups: ['User:emailAddress', 'Default'])]
abstract class AbstractUser implements SymfonyUserInterface, PasswordAuthenticatedUserInterface, JWTUserInterface
Method addUserNode
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addUserNode(ArrayNodeDefinition $rootNode): void
{
$rootNode
->children()
->arrayNode('user')
Method load
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
File AbstractUser.php
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the Silverback API Components Bundle Project
*
File SilverbackApiComponentsExtension.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the Silverback API Components Bundle Project
*
Method filterProperty
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
{
if (
null === $value
|| !$this->isPropertyEnabled($property, $resourceClass)
Method calculateSortValue
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function calculateSortValue(ComponentPosition $componentPosition, ?int $originalSortValue): void
{
$sortCollection = $componentPosition->getSortCollection();
$sortValueSet = null !== $componentPosition->sortValue;
if (!$sortCollection) {
Function create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function create(string $resourceClass): ResourceMetadataCollection
{
$resourceMetadata = $this->decorated->create($resourceClass);
$interfaces = class_implements($resourceClass);
if (!\in_array(ComponentInterface::class, $interfaces, true)) {
- 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
ResourceMetadata
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ResourceMetadata implements ResourceMetadataInterface
{
// for page data
#[Groups('cwa_resource:metadata')]
private ?PageDataMetadata $pageDataMetadata = null;
Function getResourceIrisFromArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getResourceIrisFromArray(array $resource, array $iris = []): array
{
$resourceId = $resource['@id'] ?? null;
if (
$resourceId
- 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 prependApiPlatformConfig
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prependApiPlatformConfig(ContainerBuilder $container, array $config): void
{
$srcBase = __DIR__ . '/..';
$mappingPaths = [$srcBase . '/Entity/Core'];
$this->appendMappingPaths($mappingPaths, $srcBase, 'uploadable');
Method transform
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transform(Collection $object): Collection
{
$parameters = $this->resourceRouteFinder->findByIri($object->getResourceIri());
$attributes = AttributesExtractor::extractAttributes($parameters);
$request = $this->requestStack->getMainRequest();
Method loadClassMetadata
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
{
/** @var ClassMetadataInfo $metadata */
$metadata = $eventArgs->getClassMetadata();
if (!$this->publishableStatusChecker->isConfigured($metadata->getName())) {
Method buildForm
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'username',
Function create
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function create(string $resourceClass): ResourceMetadataCollection
{
$resourceMetadata = $this->decorated->create($resourceClass);
if (!$this->uploadableFileManager->isConfigured($resourceClass)) {
return $resourceMetadata;
- 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 filterProperty
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
{
if (
null === $value
|| !$this->isPropertyEnabled($property, $resourceClass)
- 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 buildForm
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'username',
Method onPostRespond
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onPostRespond(ResponseEvent $event): void
{
$request = $event->getRequest();
$attributes = $this->getAttributes($request);