Showing 108 of 108 total issues
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)) {
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 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 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 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 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 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 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 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 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 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 __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 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