Method buildForm
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('scheme', 'choice', array(
'choices' => $this->schemeChoices,
- Create a ticketCreate a ticket
Method configureOptions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'data_class' => $this->siteAliasClass,
- Create a ticketCreate a ticket
Avoid unused parameters such as '$options'. Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Avoid unused parameters such as '$form'. Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Avoid unused parameters such as '$options'. Open
public function buildForm(FormBuilderInterface $builder, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 $resolver
has undeclared type \Symfony\Component\OptionsResolver\OptionsResolver
Open
public function configureOptions(OptionsResolver $resolver)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant SCHEME_HTTPS
from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open
SchemeableInterface::SCHEME_HTTPS => 'open_orchestra_backoffice.scheme.https'
- Create a ticketCreate a ticket
- Exclude checks
Parameter $view
has undeclared type \Symfony\Component\Form\FormView
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Form\AbstractType
Open
class SiteAliasType extends AbstractType
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant SCHEME_HTTP
from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open
SchemeableInterface::SCHEME_HTTP => 'open_orchestra_backoffice.scheme.http',
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
$view->vars['columns']['language']['data'] = (array_key_exists($data, $this->frontLanguages)) ? $this->frontLanguages[$data] : '';
- Create a ticketCreate a ticket
- Exclude checks
Parameter $builder
has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open
public function buildForm(FormBuilderInterface $builder, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
$data = $view->vars['columns']['language']['data'];
- Create a ticketCreate a ticket
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
$builder
- Create a ticketCreate a ticket
- Exclude checks
Call to method setDefaults
from undeclared class \Symfony\Component\OptionsResolver\OptionsResolver
Open
$resolver->setDefaults(
- Create a ticketCreate a ticket
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
$resolver->setDefaults(
array(
'data_class' => $this->siteAliasClass,
'columns' => array('domain', 'language', 'prefix'),
'group_enabled' => true,
- Read upRead up
- Create a ticketCreate a ticket
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 143.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
The closing brace for the class must go on the next line after the body Open
}
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$view->vars['columns']['language']['data'] = (array_key_exists($data, $this->frontLanguages)) ? $this->frontLanguages[$data] : '';
- Create a ticketCreate a ticket
- Exclude checks