Backoffice/Validator/Constraints/ContentTypeFieldValidator.php
Function validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function validate($value, Constraint $constraint)
{
if($value instanceof ContentTypeInterface) {
$fields = $value->getFields();
foreach ($fields as $key => $field) {
- 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
Parameter $constraint
has undeclared type \Symfony\Component\Validator\Constraint
Open
Open
public function validate($value, Constraint $constraint)
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
Open
if($value instanceof ContentTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFields
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
Open
$fields = $value->getFields();
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Validator\Constraints\ContentTypeFieldValidator->context
Open
Open
$this->context->buildViolation($constraint->message)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property message
from undeclared class \Symfony\Component\Validator\Constraint
Open
Open
$this->context->buildViolation($constraint->message)
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Validator\ConstraintValidator
Open
Open
class ContentTypeFieldValidator extends ConstraintValidator
- Create a ticketCreate a ticket
- Exclude checks
Call to method getFieldId
from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
if ($field instanceof FieldTypeInterface && in_array($field->getFieldId(), $this->disallowedFieldNames)) {
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open
Open
if ($field instanceof FieldTypeInterface && in_array($field->getFieldId(), $this->disallowedFieldNames)) {
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
if ($field instanceof FieldTypeInterface && in_array($field->getFieldId(), $this->disallowedFieldNames)) {
- Create a ticketCreate a ticket
- Exclude checks
Expected 1 space after IF keyword; 0 found Open
Open
if($value instanceof ContentTypeInterface) {
- Create a ticketCreate a ticket
- Exclude checks