Function reverseTransform
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function reverseTransform($value)
{
$result = new ArrayCollection();
if (is_array($value)) {
foreach ($value as $key => $profiles) {
- 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 transform
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function transform($value)
{
$result = array();
$workflowProfiles = $this->workflowProfileRepository->findAll();
$contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion();
- 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
Class implements undeclared interface \Symfony\Component\Form\DataTransformerInterface
Open
class GroupWorkflowProfileCollectionTransformer implements DataTransformerInterface
- Create a ticketCreate a ticket
- Exclude checks
Parameter $value
has undeclared type \Doctrine\Common\Collections\Collection
Open
public function transform($value)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findAllNotDeletedInLastVersion
from undeclared class \OpenOrchestra\ModelInterface\Repository\ContentTypeRepositoryInterface
Open
$contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion();
- Create a ticketCreate a ticket
- Exclude checks
Return type of reverseTransform()
is undeclared type \Doctrine\Common\Collections\Collection
Open
public function reverseTransform($value)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findAll
from undeclared class \OpenOrchestra\ModelInterface\Repository\WorkflowProfileRepositoryInterface
Open
$workflowProfiles = $this->workflowProfileRepository->findAll();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open
$result = new ArrayCollection();
- Create a ticketCreate a ticket
- Exclude checks
Call to method set
from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open
$result->set($key, $profileCollection);
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$nodeTypeId = NodeInterface::ENTITY_TYPE;
- 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
Parameter $workflowProfileRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\WorkflowProfileRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Returning type \Doctrine\Common\Collections\ArrayCollection
but reverseTransform()
is declared to return \Doctrine\Common\Collections\Collection
Open
return $result;
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \Doctrine\Common\Collections\Collection
Open
if ($value instanceof Collection) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method find
from undeclared class \OpenOrchestra\ModelInterface\Repository\WorkflowProfileRepositoryInterface
Open
$document = $this->workflowProfileRepository->find($profileId);
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\ModelBundle\Document\WorkflowProfileCollection
Open
$profileCollection = new WorkflowProfileCollection();
- Create a ticketCreate a ticket
- Exclude checks
Call to method addProfile
from undeclared class \OpenOrchestra\ModelBundle\Document\WorkflowProfileCollection
Open
$profileCollection->addProfile($document);
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $settedWorkflowProfiles. Keep variable name length under 20. Open
$settedWorkflowProfiles = array();
- 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 $workflowProfileRepository. Keep variable name length under 20. Open
protected $workflowProfileRepository;
- 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 $workflowProfileCollectionName. Keep variable name length under 20. Open
foreach ($value as $workflowProfileCollectionName => $workflowProfileCollection) {
- 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 $workflowProfileCollection. Keep variable name length under 20. Open
foreach ($value as $workflowProfileCollectionName => $workflowProfileCollection) {
- 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
Avoid excessively long variable names like $workflowProfileRepository. Keep variable name length under 20. Open
WorkflowProfileRepositoryInterface $workflowProfileRepository,
- 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 class names like GroupWorkflowProfileCollectionTransformer. Keep class name length under 40. Open
class GroupWorkflowProfileCollectionTransformer implements DataTransformerInterface
{
protected $workflowProfileRepository;
protected $contentTypeRepository;
protected $contextManager;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Line exceeds 120 characters; contains 194 characters Open
$result[$nodeTypeId][$workflowProfile->getId()] = array_key_exists($nodeTypeId, $settedWorkflowProfiles) && in_array($workflowProfile->getId(), $settedWorkflowProfiles[$nodeTypeId]);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 207 characters Open
$result[$contentTypeId][$workflowProfile->getId()] = array_key_exists($contentTypeId, $settedWorkflowProfiles) && in_array($workflowProfile->getId(), $settedWorkflowProfiles[$contentTypeId]);
- Create a ticketCreate a ticket
- Exclude checks