open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/GenerateForm/Strategies/VideoStrategy.php

Summary

Maintainability
F
3 days
Test Coverage

File VideoStrategy.php has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\Backoffice\GenerateForm\Strategies;

use OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\VideoStrategy as BaseVideoStrategy;
Severity: Minor
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php - About 5 hrs to fix

Method addYoutubeForm has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addYoutubeForm(FormBuilderInterface $builder)
    {

        $builder
            ->add('youtubeVideoId', 'oo_video', array(
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php - About 4 hrs to fix

Method addDailyMotionForm has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addDailyMotionForm($builder)
    {
        $builder
            ->add('dailymotionVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.dailymotion.video_id',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php - About 4 hrs to fix

Method addVimeoForm has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addVimeoForm($builder)
    {
        $builder
            ->add('vimeoVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.vimeo.video_id',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php - About 4 hrs to fix

The method addYoutubeForm() has 119 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function addYoutubeForm(FormBuilderInterface $builder)
    {

        $builder
            ->add('youtubeVideoId', 'oo_video', array(

The method addVimeoForm() has 106 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function addVimeoForm($builder)
    {
        $builder
            ->add('vimeoVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.vimeo.video_id',

The method addDailyMotionForm() has 115 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function addDailyMotionForm($builder)
    {
        $builder
            ->add('dailymotionVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.dailymotion.video_id',

Avoid unused parameters such as '$options'.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Parameter $builder has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open

    protected function addYoutubeForm(FormBuilderInterface $builder)

Parameter $builder has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open

    public function buildForm(FormBuilderInterface $builder, array $options)

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder

Call to method getComponent from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        return BaseVideoStrategy::NAME === $block->getComponent();

Parameter $builder has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open

    protected function addVimeoForm($builder)

Parameter $block has undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

    public function support(BlockInterface $block)

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder

Reference to constant NAME from undeclared class \OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\VideoStrategy (Did you mean class \OpenOrchestra\Backoffice\GenerateForm\Strategies\VideoStrategy)
Open

        return BaseVideoStrategy::NAME === $block->getComponent();

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder->add('videoType', 'choice', array(

Parameter $builder has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open

    protected function addDailyMotionForm($builder)

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        $builder
            ->add('youtubeVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.youtube.video_id',
                'group_id' => 'data',
                'sub_group_id' => 'content',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php and 2 other locations - About 3 hrs to fix
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 177..215
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 298..336

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        $builder
            ->add('dailymotionVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.dailymotion.video_id',
                'group_id' => 'data',
                'sub_group_id' => 'content',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php and 2 other locations - About 3 hrs to fix
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 53..90
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 298..336

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        $builder
            ->add('vimeoVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.vimeo.video_id',
                'group_id' => 'data',
                'sub_group_id' => 'content',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php and 2 other locations - About 3 hrs to fix
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 53..90
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 177..215

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Line exceeds 120 characters; contains 139 characters
Open

                'attr' => array('data-video-type' => 'youtube', 'help_text' => 'open_orchestra_backoffice.block.video.youtube.rel.helper'),

There are no issues that match your filters.

Category
Status