Showing 100 of 108 total issues
Method confirmNewEmailAddress
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function confirmNewEmailAddress(string $username, string $email, string $token): void
{
if ('' === $email) {
throw new InvalidArgumentException('User not found');
}
Function voteOnAttribute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function voteOnAttribute(string $attribute, $routable, TokenInterface $token): bool
{
if (!$this->securityStr) {
return 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
Function getPageDataTotal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getPageDataTotal(ComponentInterface $component): int
{
/** @var \Generator $pageDataLocations */
$pageDataLocations = $this->pageDataProvider->findPageDataComponentMetadata($component);
$pageDataCount = 0;
- 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 onPreWrite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function onPreWrite(ViewEvent $event): void
{
$request = $event->getRequest();
$data = $request->attributes->get('data');
$resourceClass = $request->attributes->get('_api_resource_class');
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(RoutableInterface $object, ?Route $route = null): Route
{
$entityManager = $this->registry->getManagerForClass($className = $object::class);
if (!$entityManager) {
throw new InvalidArgumentException(sprintf('Could not find entity manager for %s', $className));
Method getFileResponse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileResponse(object $object, string $property, bool $forceDownload = false): Response
{
try {
$reflectionProperty = new \ReflectionProperty($object, $property);
} catch (\ReflectionException $exception) {
Method applyToItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void
{
$configuration = $this->getConfiguration($resourceClass);
if (!$configuration || !$this->requestStack->getCurrentRequest()) {
Method validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate($componentPosition, Constraint $constraint): void
{
$collection = $componentPosition->componentGroup;
if (!$collection) {
return;
Method normalize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function normalize($object, $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
{
$context[self::ALREADY_CALLED] = true;
$finalRoute = $object;
Method createFromRequest
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createFromRequest(Request $request, bool $normalization, ?array $extractedAttributes = null): array
{
$context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes);
if (
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiResourceRouteFinder $resourceRouteFinder,
ProviderInterface $provider,
RequestStack $requestStack,
SerializerContextBuilderInterface $serializerContextBuilder,
NormalizerInterface $itemNormalizer,
Function prefixRoute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function prefixRoute(string $resourceClass, array $routePrefixParts, ResourceMetadataCollection $resourceMetadata): ResourceMetadataCollection
{
$resources = [];
/** @var ApiResource $resourceMetadatum */
foreach ($resourceMetadata as $i => $resourceMetadatum) {
- 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 onPostRespond
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onPostRespond(ResponseEvent $event): void
{
$request = $event->getRequest();
$attributes = $this->getAttributes($request);
- 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 addWhereByStrategy
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive): void
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(ManagerRegistry $registry, UploadableAttributeReader $annotationReader, FilesystemProvider $filesystemProvider, FlysystemDataLoader $flysystemDataLoader, FileInfoCacheManager $fileInfoCacheManager, ?CacheManager $imagineCacheManager, ?FilterService $filterService = null)
Method create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function create(string $username, string $password, ?string $email = null, bool $inactive = false, bool $superAdmin = false, bool $admin = false, bool $overwrite = false): void
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(ContainerInterface $container, EventDispatcherInterface $eventDispatcher, string $subject, bool $enabled = true, ?string $defaultRedirectPath = null, ?string $redirectPathQueryKey = null, array $emailContext = [])
Method filterProperty
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(EntityManagerInterface $entityManager, ValidatorInterface $validator, UserRepositoryInterface $userRepository, TimestampedDataPersister $timestampedDataPersister, UserPasswordHasherInterface $passwordHasher, string $userClass)
Function __invoke
has a Cognitive Complexity of 8 (exceeds 5 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 (
- 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"