Backoffice/Validator/Constraints/UnremovableLanguageConditionValidator.php
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function validate($value, Constraint $constraint)
{
if ($constraint instanceof UnremovableLanguageConditionInterface) {
$languages = array();
foreach ($value as $alias) {
- 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
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
Open
$languages[] = $alias->getLanguage();
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Validator\ConstraintValidator
Open
Open
class UnremovableLanguageConditionValidator extends ConstraintValidator
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Validator\Constraints\UnremovableLanguageConditionInterface->message
Open
Open
$this->context->buildViolation($constraint->message)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $constraint
has undeclared type \Symfony\Component\Validator\Constraint
Open
Open
public function validate($value, Constraint $constraint)
- Create a ticketCreate a ticket
- Exclude checks
string
passed to foreach instead of array Open
Open
foreach ($value as $alias) {
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
Open
if ($alias instanceof SiteAliasInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Validator\Constraints\UnremovableLanguageConditionValidator->context
Open
Open
$this->context->buildViolation($constraint->message)
- Create a ticketCreate a ticket
- Exclude checks
There must be one blank line after the last USE statement; 2 found; Open
Open
use Symfony\Component\Validator\ConstraintValidator;
- Create a ticketCreate a ticket
- Exclude checks