open-orchestra/open-orchestra-cms-bundle

View on GitHub
WorkflowAdminBundle/Controller/Admin/StatusController.php

Summary

Maintainability
C
1 day
Test Coverage

Parameter $request has undeclared type \Symfony\Component\HttpFoundation\Request
Open

    public function newAction(Request $request)

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

        $status = $this->get('open_orchestra_model.repository.status')->find($statusId);

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::isGranted
Open

            'delete_button' => $this->isGranted(ContributionActionInterface::DELETE, $status)

Call to method __construct from undeclared class \OpenOrchestra\ModelInterface\Event\StatusEvent
Open

            $this->dispatchEvent(StatusEvents::STATUS_UPDATE, new StatusEvent($status));

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, StatusInterface::ENTITY_TYPE);

Call to method __construct from undeclared class \Symfony\Component\HttpFoundation\Response
Open

            $response = new Response(

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

        $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.status.success');

Call to method handleRequest from undeclared class \Symfony\Component\Form\Form
Open

        $form->handleRequest($request);

Return type of formAction() is undeclared type \Symfony\Component\HttpFoundation\Response
Open

    public function formAction(Request $request, $statusId)

Call to method isValid from undeclared class \Symfony\Component\Form\Form
Open

        if ($form->isValid()) {

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

            'enable_delete_button' => $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status),

Argument 1 (form) is \Symfony\Component\Form\Form but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::handleForm() takes \Symfony\Component\Form\FormInterface defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:29
Open

        if ($this->handleForm($form, $message)) {

Argument 2 (data) is object but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::createForm() takes null defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:94
Open

        $form = $this->createForm('oo_status', $status, array(

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::getParameter
Open

        $statusClass = $this->getParameter('open_orchestra_model.document.status.class');

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::generateUrl
Open

            'action' => $this->generateUrl('open_orchestra_workflow_admin_status_new'),

Return type of newAction() is undeclared type \Symfony\Component\HttpFoundation\Response
Open

    public function newAction(Request $request)

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, StatusInterface::ENTITY_TYPE);

Reference to constant HTTP_CREATED from undeclared class \Symfony\Component\HttpFoundation\Response
Open

                Response::HTTP_CREATED,

Reference to constant STATUS_UPDATE from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open

            $this->dispatchEvent(StatusEvents::STATUS_UPDATE, new StatusEvent($status));

Possibly zero references to use statement for classlike/namespace Config (\Sensio\Bundle\FrameworkExtraBundle\Configuration)
Open

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $status);

Call to method handleRequest from undeclared class \Symfony\Component\Form\Form
Open

        $form->handleRequest($request);

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

            $this->get('session')->getFlashBag()->add('success', $message);

Argument 2 (event) is \OpenOrchestra\ModelInterface\Event\StatusEvent but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::dispatchEvent() takes \Symfony\Component\EventDispatcher\Event defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:81
Open

            $this->dispatchEvent(StatusEvents::STATUS_CREATE, new StatusEvent($status));

Reference to constant STATUS_CREATE from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open

            $this->dispatchEvent(StatusEvents::STATUS_CREATE, new StatusEvent($status));

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::generateUrl
Open

            'action' => $this->generateUrl('open_orchestra_workflow_admin_status_form', array(

Argument 1 (form) is \Symfony\Component\Form\Form but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::renderAdminForm() takes \Symfony\Component\Form\FormInterface defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:58
Open

        return $this->renderAdminForm($form);

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

            $documentManager = $this->get('object_manager');

Call to method __construct from undeclared class \OpenOrchestra\ModelInterface\Event\StatusEvent
Open

            $this->dispatchEvent(StatusEvents::STATUS_CREATE, new StatusEvent($status));

Argument 1 (form) is \Symfony\Component\Form\Form but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::renderAdminForm() takes \Symfony\Component\Form\FormInterface defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:58
Open

        return $this->renderAdminForm($form);

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

            $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.status.creation');

Parameter $request has undeclared type \Symfony\Component\HttpFoundation\Request
Open

    public function formAction(Request $request, $statusId)

Argument 2 (event) is \OpenOrchestra\ModelInterface\Event\StatusEvent but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::dispatchEvent() takes \Symfony\Component\EventDispatcher\Event defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:81
Open

            $this->dispatchEvent(StatusEvents::STATUS_UPDATE, new StatusEvent($status));

Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\StatusController::get
Open

                array('Content-type' => 'text/html; charset=utf-8', 'statusId' => $status->getId(), 'name' => $status->getLabel($this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage()))

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function formAction(Request $request, $statusId)
    {
        $status = $this->get('open_orchestra_model.repository.status')->find($statusId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $status);
        $form = $this->createForm('oo_status', $status, array(
Severity: Major
Found in WorkflowAdminBundle/Controller/Admin/StatusController.php and 1 other location - About 5 hrs to fix
GroupBundle/Controller/Admin/GroupController.php on lines 76..96

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($status);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.status.creation');
Severity: Major
Found in WorkflowAdminBundle/Controller/Admin/StatusController.php and 1 other location - About 3 hrs to fix
WorkflowAdminBundle/Controller/Admin/WorkflowProfileController.php on lines 41..56

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 158.

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

Further Reading

Line exceeds 120 characters; contains 154 characters
Open

            'enable_delete_button' => $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status),

Line exceeds 120 characters; contains 221 characters
Open

                array('Content-type' => 'text/html; charset=utf-8', 'statusId' => $status->getId(), 'name' => $status->getLabel($this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage()))

There are no issues that match your filters.

Category
Status