Backoffice/EventSubscriber/FieldTypeTypeSubscriber.php
Function addOptionsFormType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function addOptionsFormType(FieldTypeInterface $data, $type, FormInterface $form)
{
if (is_null($type) || !array_key_exists($type, $this->fieldTypeParameters)) {
return;
}
- Read upRead up
- Create a ticketCreate a ticket
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 addDefaultValueFormType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function addDefaultValueFormType(FieldTypeInterface $data, $type, FormInterface $form)
{
$container = $form->get('container');
if ($container->has('default_value')) {
- Read upRead up
- Create a ticketCreate a ticket
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
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
if ($data instanceof FieldTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method get
from undeclared class \Symfony\Component\Form\FormInterface
Open
Open
$container = $form->get('container');
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$dataSend = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method get
from undeclared class \Symfony\Component\Form\FormInterface
Open
Open
$container = $form->get('options');
- Create a ticketCreate a ticket
- Exclude checks
Call to method getDefaultValue
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
$defaultOption['data'] = $data->getDefaultValue();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $data
has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
protected function addOptionsFormType(FieldTypeInterface $data, $type, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
Open
protected function addDefaultValueFormType(FieldTypeInterface $data, $type, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant PRE_SUBMIT
from undeclared class \Symfony\Component\Form\FormEvents
Open
Open
FormEvents::PRE_SUBMIT => 'preSubmit',
- Create a ticketCreate a ticket
- Exclude checks
Call to method setFieldTypeSearchable
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
$data->setFieldTypeSearchable($this->fieldTypeParameters[$type]['search']);
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Symfony\Component\Validator\Constraints\NotBlank
Open
Open
$formTypeOptions['constraints'] = new NotBlank();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
Open
protected function addOptionFormType(FormInterface $form, $child, $data) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant PRE_SET_DATA
from undeclared class \Symfony\Component\Form\FormEvents
Open
Open
FormEvents::PRE_SET_DATA => 'preSetData',
- Create a ticketCreate a ticket
- Exclude checks
Call to method getType
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
if ($data->getType() !== $type) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method setDefaultValue
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
$data->setDefaultValue(null);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
Open
public function preSetData(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getOptions
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
foreach ($data->getOptions() as $fieldOption) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
Open
public function preSubmit(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$event->getForm()->setData($data);
- Create a ticketCreate a ticket
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormInterface
Open
Open
$form->add($child, $formType, $formTypeOptions);
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open
Open
class FieldTypeTypeSubscriber implements EventSubscriberInterface
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$data = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
Open
protected function addOptionsFormType(FieldTypeInterface $data, $type, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getType
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
$type = $data->getType();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $data
has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
protected function addDefaultValueFormType(FieldTypeInterface $data, $type, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Expected 1 space after "as"; 2 found Open
Open
foreach ($container->all() as $child) {
- Create a ticketCreate a ticket
- Exclude checks
Opening brace should be on a new line Open
Open
protected function addOptionFormType(FormInterface $form, $child, $data) {
- Create a ticketCreate a ticket
- Exclude checks