GroupBundle/Form/DataTransformer/GroupListToArrayTransformer.php
Function reverseTransform
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function reverseTransform($groups)
{
$value = new ArrayCollection();
if (is_array($groups) && array_key_exists('groups_collection', $groups)) {
$groups = $groups['groups_collection'];
- 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 $groups
has undeclared type \Doctrine\Common\Collections\ArrayCollection
Open
Open
public function transform($groups)
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \Doctrine\Common\Collections\Collection
Open
Open
if ($groups instanceof Collection) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method add
from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open
Open
$value->add($group);
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Doctrine\Common\Collections\ArrayCollection
Open
Open
$value = new ArrayCollection();
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\Form\DataTransformerInterface
Open
Open
class GroupListToArrayTransformer implements DataTransformerInterface
- Create a ticketCreate a ticket
- Exclude checks
Return type of reverseTransform()
is undeclared type \Doctrine\Common\Collections\ArrayCollection
Open
Open
public function reverseTransform($groups)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\Backoffice\Context\SiteInterface
Open
Open
$this->availableSiteIds[] = $site->getId();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Repository\GroupRepository::find
Open
Open
$group = $this->groupRepository->find($groupId);
- Create a ticketCreate a ticket
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($groups as $group) {
- Create a ticketCreate a ticket
- Exclude checks