open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

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

Method testConfigureOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolver);
Severity: Minor
Found in Backoffice/Tests/Form/Type/SiteAliasTypeTest.php - About 1 hr to fix

Method getConfigTreeBuilder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('open_orchestra_api');

Severity: Minor
Found in ApiBundle/DependencyInjection/Configuration.php - About 1 hr to fix

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

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

Method getBadRoles has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getBadRoles()
    {
        $actions = array(
            'Read'   => ContributionActionInterface::READ,
            'Edit'   => ContributionActionInterface::EDIT,

Method testConfigureOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolver);
Severity: Minor
Found in GroupBundle/Tests/Form/Type/GroupTypeTest.php - About 1 hr to fix

Method addWorkflowProfile has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addWorkflowProfile(GroupFormEvent $event)
    {
        $builder = $event->getBuilder();
        $group = $builder->getData();
        $configuration = array();

Method testConfigureOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolverMock = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolverMock);
Severity: Minor
Found in Backoffice/Tests/Form/Type/ContentTypeTest.php - About 1 hr to fix

Method testUpdatePath has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testUpdatePath()
    {
        $nodeId = 'node';
        $path = 'path';
        $parentNodeId = 'parent';

Method changeStatusAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function changeStatusAction(Request $request, $saveOldPublishedVersion)
    {
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            'OpenOrchestra\ApiBundle\Facade\NodeFacade',
Severity: Minor
Found in ApiBundle/Controller/NodeController.php - About 1 hr to fix

Method buildForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('labels', 'oo_multi_languages', array(
                'label' => 'open_orchestra_group.form.group.label',
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.php - About 1 hr to fix

Method getNotSupportedSubjects has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getNotSupportedSubjects()
    {
        $content = $this->createPhakeContent();
        $trashItem = $this->createPhakeTrashItem();
        $site = $this->createPhakeSite();
Severity: Minor
Found in Backoffice/Tests/Security/Authorization/Voter/NodeVoterTest.php - About 1 hr to fix

Method buildForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('nodeId', 'text', array(
            'group_id' => 'data',
            'sub_group_id' => 'content',
Severity: Minor
Found in Backoffice/GenerateForm/Strategies/SearchResultStrategy.php - About 1 hr to fix

Method getNotSupportedSubjects has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getNotSupportedSubjects()
    {
        $node = $this->createPhakeNode();
        $content = $this->createPhakeContent();
        $site = $this->createPhakeSite();

Function reverseTransform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function reverseTransform($groups)
    {
        $value = new ArrayCollection();
        if (is_array($groups) && array_key_exists('groups_collection', $groups)) {
            $groups = $groups['groups_collection'];
Severity: Minor
Found in GroupBundle/Form/DataTransformer/GroupListToArrayTransformer.php - About 1 hr 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 preSubmit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function preSubmit(FormEvent $event)
    {
        $form = $event->getForm();
        $data = $form->getData();

Severity: Minor
Found in Backoffice/EventSubscriber/SortableCollectionSubscriber.php - About 1 hr 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 transform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform($value)
    {
        $result = array();
        $workflowProfiles = $this->workflowProfileRepository->findAll();
        $contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion();

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 setUp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $contentType = 'fakeContentType';
        $choiceType = 'fakeChoiceType';
        $language = 'fakeLanguage';
Severity: Minor
Found in Backoffice/Tests/EventSubscriber/ContentSearchSubscriberTest.php - About 1 hr to fix

Method testBuildView has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testBuildView()
    {
        $resolvedFormType = Phake::mock('Symfony\Component\Form\ResolvedFormTypeInterface');
        Phake::when($resolvedFormType)->getName()->thenReturn('collection');

Severity: Minor
Found in Backoffice/Tests/Form/Type/Extension/AccordionExtensionTest.php - About 1 hr to fix

Method addFieldTypesParameter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addFieldTypesParameter()
    {
        $builder = new TreeBuilder();
        $fieldTypes = $builder->root('field_types');

Severity: Minor
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 1 hr to fix
Severity
Category
Status
Source
Language