Method newAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newAction(Request $request)
{
$groupClass = $this->getParameter('open_orchestra_user.document.group.class');
/** @var GroupInterface $group */
$group = new $groupClass();
- Create a ticketCreate a ticket
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::generateUrl
Open
'action' => $this->generateUrl('open_orchestra_group_new'),
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant GROUP_UPDATE
from undeclared class \OpenOrchestra\UserBundle\GroupEvents
Open
$this->dispatchEvent(GroupEvents::GROUP_UPDATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$documentManager = $this->get('object_manager');
- Create a ticketCreate a ticket
- Exclude checks
Call to method handleRequest
from undeclared class \Symfony\Component\Form\Form
Open
$form->handleRequest($request);
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (event)
is \OpenOrchestra\UserBundle\Event\GroupEvent
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::dispatchEvent()
takes \Symfony\Component\EventDispatcher\Event
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:81
Open
$this->dispatchEvent(GroupEvents::GROUP_UPDATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\UserBundle\Event\GroupEvent
Open
$this->dispatchEvent(GroupEvents::GROUP_CREATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::isGranted
Open
'delete_button' => $this->isGranted(ContributionActionInterface::DELETE, $group)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$group = $this->get('open_orchestra_user.repository.group')->find($groupId);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
'enable_delete_button' => $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(ContributionActionInterface::DELETE, $group),
- Create a ticketCreate a ticket
- Exclude checks
Argument 1 (form)
is \Symfony\Component\Form\Form
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::handleForm()
takes \Symfony\Component\Form\FormInterface
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:29
Open
if ($this->handleForm($form, $message)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Symfony\Component\HttpFoundation\Response
Open
$response = new Response(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $group);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$message = $this->get('translator')->trans('open_orchestra_group.form.group.edit.success');
- Create a ticketCreate a ticket
- Exclude checks
Call to method isValid
from undeclared class \Symfony\Component\Form\Form
Open
if ($form->isValid()) {
- Create a ticketCreate a ticket
- Exclude checks
Argument 1 (form)
is \Symfony\Component\Form\Form
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::renderAdminForm()
takes \Symfony\Component\Form\FormInterface
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:58
Open
return $this->renderAdminForm($form);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function newAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Return type of newAction()
is undeclared type \Symfony\Component\HttpFoundation\Response
Open
public function newAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::getParameter
Open
$groupClass = $this->getParameter('open_orchestra_user.document.group.class');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$group->setSite($this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId));
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (event)
is \OpenOrchestra\UserBundle\Event\GroupEvent
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::dispatchEvent()
takes \Symfony\Component\EventDispatcher\Event
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:81
Open
$this->dispatchEvent(GroupEvents::GROUP_CREATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, $group);
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (data)
is object
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::createForm()
takes null
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:94
Open
$form = $this->createForm('oo_group', $group, array(
- Create a ticketCreate a ticket
- Exclude checks
Call to method handleRequest
from undeclared class \Symfony\Component\Form\Form
Open
$form->handleRequest($request);
- Create a ticketCreate a ticket
- Exclude checks
Return type of formAction()
is undeclared type \Symfony\Component\HttpFoundation\Response
Open
public function formAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$message = $this->get('translator')->trans('open_orchestra_group.form.group.new.success');
- Create a ticketCreate a ticket
- Exclude checks
Argument 1 (form)
is \Symfony\Component\Form\Form
but \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::renderAdminForm()
takes \Symfony\Component\Form\FormInterface
defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:58
Open
return $this->renderAdminForm($form);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
- Create a ticketCreate a ticket
- Exclude checks
Possibly zero references to use statement for classlike/namespace Config
(\Sensio\Bundle\FrameworkExtraBundle\Configuration)
Open
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::generateUrl
Open
'action' => $this->generateUrl('open_orchestra_group_form', array(
- Create a ticketCreate a ticket
- Exclude checks
Possibly zero references to use statement for classlike/namespace GroupInterface
(\OpenOrchestra\Backoffice\Model\GroupInterface)
Open
use OpenOrchestra\Backoffice\Model\GroupInterface;
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\UserBundle\Event\GroupEvent
Open
$this->dispatchEvent(GroupEvents::GROUP_UPDATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Admin\GroupController::get
Open
$this->get('session')->getFlashBag()->add('success', $message);
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant GROUP_CREATE
from undeclared class \OpenOrchestra\UserBundle\GroupEvents
Open
$this->dispatchEvent(GroupEvents::GROUP_CREATE, new GroupEvent($group));
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function formAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant HTTP_CREATED
from undeclared class \Symfony\Component\HttpFoundation\Response
Open
Response::HTTP_CREATED,
- Create a ticketCreate a ticket
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function formAction(Request $request, $groupId)
{
$group = $this->get('open_orchestra_user.repository.group')->find($groupId);
$this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $group);
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 202.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Line exceeds 120 characters; contains 157 characters Open
'enable_delete_button' => $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(ContributionActionInterface::DELETE, $group),
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
array('Content-type' => 'text/plain; charset=utf-8', 'groupId' => $group->getId(), 'name' => $group->getName())
- Create a ticketCreate a ticket
- Exclude checks