Showing 42 of 53 total issues
File NamespaceHelper.php
has 643 lines of code (exceeds 500 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration;
Function replaceNestedDtoWithEntityInstanceIfIdsMatch
has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring. Open
private function replaceNestedDtoWithEntityInstanceIfIdsMatch(
DataTransferObjectInterface $dto,
EntityInterface $entity
): void {
$dtoHash = spl_object_hash($dto);
- 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
AbstractEntityRepository
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractEntityRepository implements EntityRepositoryInterface
{
/**
* @var array
*/
Function updateNestedDtosWithFakeData
has a Cognitive Complexity of 27 (exceeds 10 allowed). Consider refactoring. Open
private function updateNestedDtosWithFakeData(DataTransferObjectInterface $dto): void
{
$reflection = new ReflectionClass(get_class($dto));
$reflectionMethods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
- 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
DoctrineStaticMeta
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class DoctrineStaticMeta
{
public const DSM_INIT_METHOD_PREFIX = 'dsmInit';
/**
Builder
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Builder
{
/**
* @var EntityGenerator
UnusedRelationsRemover
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class UnusedRelationsRemover
{
/**
* @var NamespaceHelper
*/
TestEntityGenerator
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class TestEntityGenerator
{
/**
* @var EntityManagerInterface
*/
Function update
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
final public function update(DataTransferObjectInterface $dto): void
{
$backup = [];
$setters = self::getDoctrineStaticMeta()->getSetters();
try {
- 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 jsonSerialize
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
public function jsonSerialize(): array
{
$dsm = static::getDoctrineStaticMeta();
$toSerialize = [];
$getters = $dsm->getGetters();
- 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 createDtoRelatedToEntityDataObject
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
private function createDtoRelatedToEntityDataObject(
EntityData $owningDataObject,
string $relatedEntityFqn
): DataTransferObjectInterface {
$relatedDtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($relatedEntityFqn);
- 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 getGettersForDtosOrCollections
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
private function getGettersForDtosOrCollections(DataTransferObjectInterface $dto): array
{
$dtoReflection = new ReflectionClass(get_class($dto));
$dtoGetters = [];
$collectionGetters = [];
- 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 deriveDtoAndEntityFqnFromCollection
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
private function deriveDtoAndEntityFqnFromCollection(Collection $collection): array
{
if (0 === $collection->count()) {
throw new RuntimeException('Collection is empty');
}
- 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 __construct
has 15 arguments (exceeds 10 allowed). Consider refactoring. Open
EntityCreator $entityCreator,
AbstractEntityFactoryCreator $abstractEntityFactoryCreator,
EntityFactoryCreator $entityFactoryCreator,
EntityInterfaceCreator $entityInterfaceCreator,
AbstractEntityRepositoryCreator $abstractEntityRepositoryCreator,
Function guessMissingColumnFormatters
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
private function guessMissingColumnFormatters(): void
{
$meta = $this->testedEntityDsm->getMetaData();
foreach ($meta->getFieldNames() as $fieldName) {
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 theEntityGettersReturnValues
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
public function theEntityGettersReturnValues(EntityInterface $entity): EntityInterface
{
$meta = $this->getEntityManager()->getClassMetadata(static::$testedEntityFqn);
$dto = $this->getDtoFactory()->createDtoFromEntity($entity);
foreach ($meta->getFieldNames() as $fieldName) {
- 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 validateConfig
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
private function validateConfig(): void
{
$errors = [];
$typeHelper = new TypeHelper();
foreach (ConfigInterface::PARAM_TYPES as $param => $requiredType) {
- 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 getGetters
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
public function getGetters(): array
{
if (null !== $this->getters) {
return $this->getters;
}
- 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 createEntity
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
private function createEntity(
string $entityFqn,
DataTransferObjectInterface $dto = null,
$isRootEntity = true
): EntityInterface {
- 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 __construct
has 13 arguments (exceeds 10 allowed). Consider refactoring. Open
EntityGenerator $entityGenerator,
FieldGenerator $fieldGenerator,
EntityFieldSetter $fieldSetter,
RelationsGenerator $relationsGenerator,
ArchetypeEmbeddableGenerator $archetypeEmbeddableGenerator,