Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
ContentTypeRepositoryInterface $contentTypeRepository,
StatusRepositoryInterface $statusRepository,
$contentAttributeClass,
MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
$fieldTypesConfiguration,
- Create a ticketCreate a ticket
Function postSetData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function postSetData(FormEvent $event)
{
$form = $event->getForm();
$data = $event->getData();
- 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 postSubmit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function postSubmit(FormEvent $event)
{
$form = $event->getForm();
$content = $form->getData();
$contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($content->getContentType());
- 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
The class ContentTypeSubscriber has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13. Open
class ContentTypeSubscriber implements EventSubscriberInterface
{
protected $multiLanguagesChoiceManager;
protected $contentTypeRepository;
protected $contentAttributeClass;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Parameter $translator
has undeclared type \Symfony\Component\Translation\TranslatorInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method trans
from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open
$message = $this->translator->trans("open_orchestra_backoffice.form.content.transformation_error");
- Create a ticketCreate a ticket
- Exclude checks
Call to method dispatch
from undeclared class \Symfony\Component\EventDispatcher\EventDispatcherInterface
Open
$this->eventDispatcher->dispatch(StatusEvents::STATUS_CHANGE, $event);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $multiLanguagesChoiceManager
has undeclared type \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant POST_SET_DATA
from undeclared class \Symfony\Component\Form\FormEvents
Open
FormEvents::POST_SET_DATA => 'postSetData',
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant POST_SUBMIT
from undeclared class \Symfony\Component\Form\FormEvents
Open
FormEvents::POST_SUBMIT => 'postSubmit',
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByContentTypeIdInLastVersion
from undeclared class \OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface
Open
$contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($data->getContentType());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
public function postSubmit(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
if ($contentType instanceof ContentTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentTypeField
has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
protected function getFieldOptions(FieldTypeInterface $contentTypeField)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
if ($content instanceof ContentInterface && $statusId && $content->getStatus()->getId() != $statusId) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByContentTypeIdInLastVersion
from undeclared class \OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface
Open
$contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($content->getContentType());
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
if ($content instanceof ContentInterface && $statusId && $content->getStatus()->getId() != $statusId) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method choose
from undeclared class \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open
'label' => $this->multiLanguagesChoiceManager->choose($contentTypeField->getLabels()),
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
public function preSetData(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
if ($contentType instanceof ContentTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant STATUS_CHANGE
from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open
$this->eventDispatcher->dispatch(StatusEvents::STATUS_CHANGE, $event);
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant PRE_SET_DATA
from undeclared class \Symfony\Component\Form\FormEvents
Open
FormEvents::PRE_SET_DATA => 'preSetData',
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open
class ContentTypeSubscriber implements EventSubscriberInterface
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
$data = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Symfony\Component\Form\FormError
Open
$error = new FormError($message);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
protected function addFieldToForm(FieldTypeInterface $contentTypeField, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
$content = $event->getForm()->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFieldId
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
$contentTypeField->getFieldId(),
- Create a ticketCreate a ticket
- Exclude checks
Possibly zero references to use statement for classlike/namespace ContentAttributeInterface
(\OpenOrchestra\ModelInterface\Model\ContentAttributeInterface)
Open
use OpenOrchestra\ModelInterface\Model\ContentAttributeInterface;
- Create a ticketCreate a ticket
- Exclude checks
Call to method getType
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
$fieldTypeConfiguration = $this->fieldTypesConfiguration[$contentTypeField->getType()];
- Create a ticketCreate a ticket
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormInterface
Open
$form->add(
- Create a ticketCreate a ticket
- Exclude checks
Catching undeclared class \Symfony\Component\Form\Exception\TransformationFailedException
Open
} catch (TransformationFailedException $e) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
$data = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\ModelInterface\Event\StatusableEvent
Open
$event = new StatusableEvent($content, $toStatus);
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant PRE_SUBMIT
from undeclared class \Symfony\Component\Form\FormEvents
Open
FormEvents::PRE_SUBMIT => 'preSubmit',
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
public function postSetData(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getType
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
$field = $this->fieldTypesConfiguration[$contentTypeField->getType()];
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByContentTypeIdInLastVersion
from undeclared class \OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface
Open
$contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($content->getContentType());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentTypeFields
has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface[]
Open
protected function addContentTypeFieldsToForm($contentTypeFields, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentTypeField
has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
protected function addFieldToForm(FieldTypeInterface $contentTypeField, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $statusRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFields
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
$this->addContentTypeFieldsToForm($contentType->getFields(), $form);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $eventDispatcher
has undeclared type \Symfony\Component\EventDispatcher\EventDispatcherInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getType
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
if (isset($this->fieldTypesConfiguration[$contentTypeField->getType()])) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Symfony\Component\Validator\Constraints\NotBlank
Open
$fieldParameters['constraints'] = new NotBlank();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFormOptions
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
$contentTypeOptions = $contentTypeField->getFormOptions();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
$content = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFields
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
foreach ($contentType->getFields() as $contentTypeField) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
public function preSubmit(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Call to method find
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
$toStatus = $this->statusRepository->find($statusId);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
protected function addContentTypeFieldsToForm($contentTypeFields, FormInterface $form)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLabels
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
'label' => $this->multiLanguagesChoiceManager->choose($contentTypeField->getLabels()),
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentTypeRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
if ($contentType instanceof ContentTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFields
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
foreach ($contentType->getFields() as $contentTypeField) {
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $fieldTypesConfiguration. Keep variable name length under 20. Open
protected $fieldTypesConfiguration;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $multiLanguagesChoiceManager. Keep variable name length under 20. Open
protected $multiLanguagesChoiceManager;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $contentAttributeClass. Keep variable name length under 20. Open
$contentAttributeClass,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $contentAttributeClass. Keep variable name length under 20. Open
protected $contentAttributeClass;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fieldTypeConfiguration. Keep variable name length under 20. Open
$fieldTypeConfiguration = $this->fieldTypesConfiguration[$contentTypeField->getType()];
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $contentTypeRepository. Keep variable name length under 20. Open
protected $contentTypeRepository;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fieldTypesConfiguration. Keep variable name length under 20. Open
$fieldTypesConfiguration,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $valueTransformerManager. Keep variable name length under 20. Open
ValueTransformerManager $valueTransformerManager,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $multiLanguagesChoiceManager. Keep variable name length under 20. Open
MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $valueTransformerManager. Keep variable name length under 20. Open
protected $valueTransformerManager;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $contentTypeRepository. Keep variable name length under 20. Open
ContentTypeRepositoryInterface $contentTypeRepository,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Blank line found at start of control structure Open
foreach ($contentTypeFields as $contentTypeField) {
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$options[$optionName] = (isset($contentTypeOptions[$optionName])) ? $contentTypeOptions[$optionName] : $optionConfiguration['default_value'];
- Create a ticketCreate a ticket
- Exclude checks