open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

Method transform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function transform($status, array $params = array())
    {
        if (!$status instanceof StatusInterface) {
            throw new TransformerParameterTypeException();
        }
Severity: Minor
Found in WorkflowAdminBundle/Transformer/StatusTransformer.php - About 1 hr to fix

Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $facadeClass,
        EncryptionManager $encrypter,
        SiteRepositoryInterface $siteRepository,
        StatusRepositoryInterface $statusRepository,
        EventDispatcherInterface $eventDispatcher,
Severity: Major
Found in ApiBundle/Transformer/NodeTransformer.php - About 1 hr to fix

Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ContentTypeRepositoryInterface $contentTypeRepository,
        StatusRepositoryInterface $statusRepository,
        $contentAttributeClass,
        MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
        $fieldTypesConfiguration,
Severity: Major
Found in Backoffice/EventSubscriber/ContentTypeSubscriber.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {
            $canDelete = $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $status)
                && !$this->usageFinder->hasUsage($status)
                && !$status->isInitialState()
                && !$status->isPublishedState()
Severity: Major
Found in WorkflowAdminBundle/Transformer/StatusTransformer.php - About 1 hr to fix

Function newAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function newAction(Request $request, $siteId, $language, $parentId, $order)
    {
        $order = (int) $order;
        $nodeManager = $this->get('open_orchestra_backoffice.manager.node');
        $nodeRepository = $this->get('open_orchestra_model.repository.node');
Severity: Minor
Found in BackofficeBundle/Controller/NodeController.php - About 55 mins to fix

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 assertSameTransitions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function assertSameTransitions(array $expectedTransitions, array $flattenedTransitions)
    {
        foreach ($expectedTransitions as $transition) {
            $flattenedTransition = $transition->getStatusFrom()->getId() . '-' . $transition->getStatusTo()->getId();
            $this->assertContains($flattenedTransition, $flattenedTransitions);

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 deleteAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteAction($contentTypeId)
    {
        if (0 == $this->get('open_orchestra_model.repository.content')->countByContentType($contentTypeId)) {
            $contentTypes = $this->get('open_orchestra_model.repository.content_type')->findBy(array('contentTypeId' => $contentTypeId));
            if (count($contentTypes) > 0) {
Severity: Minor
Found in ApiBundle/Controller/ContentTypeController.php - About 55 mins to fix

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 buildView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        if ($form->getConfig()->getAttribute('group_enabled')) {
            $view->vars['group'] = array();
            $groupRender = $form->getConfig()->getAttribute('group_render');
Severity: Minor
Found in Backoffice/Form/Type/Extension/FormTypeGroupExtension.php - About 55 mins to fix

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 buildForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $sitesId = array();
        $disabled = false;
        if (array_key_exists('data', $options) && ($user = $options['data']) instanceof UserInterface) {
Severity: Minor
Found in UserAdminBundle/Form/Type/UserType.php - About 55 mins to fix

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 extractContentsFromElement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractContentsFromElement($element, array $references = array())
    {
        if ($this->isContentSearchAttribute($element)) {
            $references[] = $element['contentId'];

Severity: Minor
Found in Backoffice/Reference/Strategies/AbstractContentReferenceStrategy.php - About 55 mins to fix

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 extractKeywordsFromElement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractKeywordsFromElement($element, array $references = array())
    {
        if ($this->isKeywordsConditionAttribute($element)) {
            $keywordIds = $this->extractKeywordIdsFromConditionAttribute($element);
            foreach ($keywordIds as $keywordId) {
Severity: Minor
Found in Backoffice/Reference/Strategies/AbstractKeywordReferenceStrategy.php - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }
Severity: Minor
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 55 mins to fix

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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $facadeClass,
        MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
        ContentRepositoryInterface $contentRepository,
        ContentTypeRepositoryInterface $contentTypeRepository,
        AuthorizationCheckerInterface $authorizationChecker,
Severity: Major
Found in ApiBundle/Transformer/ContentTypeTransformer.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $facadeClass,
        DisplayBlockManager      $displayBlockManager,
        BlockConfigurationManager $blockConfigurationManager,
        TranslatorInterface $translator,
        NodeRepositoryInterface $nodeRepository,
Severity: Major
Found in ApiBundle/Transformer/BlockTransformer.php - About 50 mins to fix

Method newAction has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function newAction(Request $request, $nodeId, $language, $version, $areaId, $position, $component)
Severity: Major
Found in BackofficeBundle/Controller/BlockController.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $redirectionClass,
        ContextBackOfficeInterface $contextManager,
        DocumentManager $documentManager,
        EventDispatcherInterface $eventDispatcher,
        SiteRepositoryInterface $siteRepository,
Severity: Major
Found in Backoffice/Manager/RedirectionManager.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        EventSubscriberInterface $groupPerimeterSubscriber,
        EventDispatcherInterface $eventDispatcher,
        DataTransformerInterface $groupRoleTransformer,
        DataTransformerInterface $groupPerimeterTransformer,
        GeneratePerimeterManager $generatePerimeterManager,
Severity: Major
Found in GroupBundle/Form/Type/GroupType.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ApiClientRepositoryInterface $apiClientRepository,
        UserRepositoryInterface $userRepository,
        EncoderFactory $encoderFactory,
        Serializer $serializer,
        ValidatorInterface $validator,
Severity: Major
Found in UserAdminBundle/OAuth2/Strategy/ResourceOwnerPasswordGrantStrategy.php - About 50 mins to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        NodeManager $nodeManager,
        ContextBackOfficeInterface $contextManager,
        SiteRepositoryInterface $siteRepository,
        TemplateManager $templateManager,
        $nodeClass,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 50 mins to fix

Method testVote has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function testVote($object, $attribute, array $roles, $inPerimeter, $expectedVote, $inProfile = true)
Severity: Minor
Found in Workflow/Tests/Security/Authorization/Voter/ContentWorkflowVoterTest.php - About 45 mins to fix
Severity
Category
Status
Source
Language