Showing 100 of 108 total issues
Method buildForm
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var UserInterface|null $user */
$user = $builder->getEmptyData();
Method createEmailMessage
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createEmailMessage(array $context = []): ?TemplatedEmail
{
if (!$this->enabled) {
return null;
}
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function create(string $resourceClass): ResourceMetadataCollection
{
$resourceMetadata = $this->decorated->create($resourceClass);
$refl = new \ReflectionClass($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
Function denormalize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
$context[self::ALREADY_CALLED] = true;
foreach ($data as $fieldName => $value) {
- 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 create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(string $resourceClass): ResourceMetadataCollection
{
$resourceMetadata = $this->decorated->create($resourceClass);
if (!$this->uploadableFileManager->isConfigured($resourceClass)) {
return $resourceMetadata;
Method __invoke
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(?object $data, Request $request, UploadableFileManager $uploadableFileManager, PublishableStatusChecker $publishableStatusChecker)
{
$contentType = $request->headers->get('CONTENT_TYPE');
if (null === $contentType) {
throw new UnsupportedMediaTypeHttpException('The "Content-Type" header must exist.');
Method setMailerServiceArguments
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setMailerServiceArguments(ContainerBuilder $container, array $config): void
{
$definition = $container->getDefinition(UserMailer::class);
$definition->setArgument(
'$context',
Method addWhereByStrategy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive): void
{
$wrapCase = $this->createWrapCase($caseSensitive);
$valueParameter = $queryNameGenerator->generateParameterName($field);
switch ($strategy) {
Function transform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function transform(Collection $object): Collection
{
$parameters = $this->resourceRouteFinder->findByIri($object->getResourceIri());
$attributes = AttributesExtractor::extractAttributes($parameters);
$request = $this->requestStack->getMainRequest();
- 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 remove
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function remove(array $paths, array $filters): void
{
if (empty($paths) && empty($filters)) {
return;
}
- 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 loadClassMetadata
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
{
$reflectionClass = $classMetadata->getReflectionClass();
$reflectionClassName = $reflectionClass->getName();
if (
- 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 __invoke
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __invoke(?object $data, Request $request, UploadableFileManager $uploadableFileManager, PublishableStatusChecker $publishableStatusChecker)
{
$contentType = $request->headers->get('CONTENT_TYPE');
if (null === $contentType) {
throw new UnsupportedMediaTypeHttpException('The "Content-Type" header must exist.');
- 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 findGetCollectionOperation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function findGetCollectionOperation(string $resourceClass): ?HttpOperation
{
$metadata = $this->resourceMetadataCollectionFactory->create($resourceClass);
$it = $metadata->getIterator();
/** @var ApiResource $apiResource */
- 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 __invoke
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(FormSuccessEvent $event): void
{
// This is not a sub-request because forms have greater permissions to create entitites with whatever properties wanted.
if (
Method checkMergeDraftIntoPublished
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkMergeDraftIntoPublished(Request $request, object $data, bool $flushDatabase = false): object
{
if (!$this->publishableStatusChecker->isActivePublishedAt($data)) {
return $data;
}
Method loadClassMetadata
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
{
$reflectionClass = $classMetadata->getReflectionClass();
$reflectionClassName = $reflectionClass->getName();
if (
Method loadClassMetadata
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
{
$reflectionClass = $classMetadata->getReflectionClass();
$attributes = $reflectionClass->getAttributes(Publishable::class);
if (!\count($attributes)) {
Method configure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure(): void
{
$this
->setDescription('Create a user.')
->setDefinition(
Method persistFiles
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function persistFiles(object $object): void
{
$propertyAccessor = PropertyAccess::createPropertyAccessor();
$classMetadata = $this->getClassMetadata($object);
Method create
has 29 lines of code (exceeds 25 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)) {