open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
3 hrs
Test Coverage

Reference to constant WORKFLOW_PROFILE_CREATE from undeclared class \OpenOrchestra\ModelInterface\WorkflowProfileEvents
Open

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_CREATE, new WorkflowProfileEvent($workflowProfile));

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

        $workflowProfile = $this->get('open_orchestra_model.repository.workflow_profile')->find($workflowProfileId);

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

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

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

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

Reference to constant WORKFLOW_PROFILE_UPDATE from undeclared class \OpenOrchestra\ModelInterface\WorkflowProfileEvents
Open

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_UPDATE, new WorkflowProfileEvent($workflowProfile));

Argument 1 (form) is \Symfony\Component\Form\Form but \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\WorkflowProfileController::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\WorkflowProfileController::get
Open

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

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

                Response::HTTP_CREATED,

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

    public function newAction(Request $request)

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

    public function newAction(Request $request)

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

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

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

    public function formAction(Request $request, $workflowProfileId)

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

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

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

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_CREATE, new WorkflowProfileEvent($workflowProfile));

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

    public function formAction(Request $request, $workflowProfileId)

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

        return $this->renderAdminForm($form);

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

        $form = $this->createForm('oo_workflow_profile', $workflowProfile, array(

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

        if ($form->isValid()) {

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

            $response = new Response(

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

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

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

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

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

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_UPDATE, new WorkflowProfileEvent($workflowProfile));

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

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_CREATE, new WorkflowProfileEvent($workflowProfile));

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

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

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

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

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

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_UPDATE, new WorkflowProfileEvent($workflowProfile));

Reference to undeclared property \OpenOrchestra\WorkflowAdminBundle\Controller\Admin\WorkflowProfileController->container
Open

        $workflowProfileClass = $this->container->getParameter('open_orchestra_model.document.workflow_profile.class');

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

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

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

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

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\WorkflowProfileController::denyAccessUnlessGranted
Open

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

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

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

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

        $form->handleRequest($request);

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

        $form->handleRequest($request);

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

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($workflowProfile);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.workflow_profile.creation');
WorkflowAdminBundle/Controller/Admin/StatusController.php on lines 73..88

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 248 characters
Open

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

Line exceeds 120 characters; contains 125 characters
Open

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_UPDATE, new WorkflowProfileEvent($workflowProfile));

Line exceeds 120 characters; contains 124 characters
Open

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

Line exceeds 120 characters; contains 125 characters
Open

            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_CREATE, new WorkflowProfileEvent($workflowProfile));

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                );

There are no issues that match your filters.

Category
Status