open-orchestra/open-orchestra-cms-bundle

View on GitHub
BackofficeBundle/Controller/ContentTypeController.php

Summary

Maintainability
A
1 hr
Test Coverage

Method newAction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function newAction(Request $request)
    {
        /** @var ContentTypeInterface $contentType */
        $contentType = $this->get('open_orchestra_backoffice.manager.content_type')->initializeNewContentType();

Severity: Minor
Found in BackofficeBundle/Controller/ContentTypeController.php - About 1 hr to fix

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

        return $this->renderAdminForm($form);

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

        return $this->renderAdminForm($form);

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

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_UPDATE, new ContentTypeEvent($newContentType));

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

        $form->handleRequest($request);

Call to method getMethod from undeclared class \Symfony\Component\HttpFoundation\Request
Open

        if ('PATCH' !== $request->getMethod()) {

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

    public function formAction(Request $request, $contentTypeId)

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::generateUrl
Open

        $action = $this->generateUrl('open_orchestra_backoffice_content_type_form', array('contentTypeId' => $contentTypeId));

Reference to constant CONTENT_TYPE_UPDATE from undeclared class \OpenOrchestra\ModelInterface\ContentTypeEvents
Open

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_UPDATE, new ContentTypeEvent($newContentType));

Argument 2 (data) is \OpenOrchestra\ModelInterface\Model\ContentTypeInterface but \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::createForm() takes null defined at /code/BackofficeBundle/Controller/AbstractAdminController.php:94
Open

        return $this->createForm('oo_content_type', $contentType, $option);

Argument 2 (option) is array{action:mixed,enable_delete_button:mixed,delete_button:mixed,need_link_to_site_defintion:false} but \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::createContentTypeForm() takes string defined at /code/BackofficeBundle/Controller/ContentTypeController.php:108
Open

            'action' => $action,

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::generateUrl
Open

        $action = $this->generateUrl('open_orchestra_backoffice_content_type_new', array());

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::denyAccessUnlessGranted
Open

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

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

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

Reference to constant CONTENT_TYPE_CREATE from undeclared class \OpenOrchestra\ModelInterface\ContentTypeEvents
Open

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_CREATE, new ContentTypeEvent($contentType));

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

                    Response::HTTP_CREATED,

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

        $newContentType = $this->get('open_orchestra_backoffice.manager.content_type')->duplicate($contentType);

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

        $form->handleRequest($request);

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

                $language = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();

Return type of createContentTypeForm() is undeclared type \Symfony\Component\Form\Form
Open

    protected function createContentTypeForm(Request $request, $option, ContentTypeInterface $contentType)

Argument 2 (option) is array{action:mixed,new_button:true,need_link_to_site_defintion:true} but \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::createContentTypeForm() takes string defined at /code/BackofficeBundle/Controller/ContentTypeController.php:108
Open

            'action' => $action,

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

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_CREATE, new ContentTypeEvent($contentType));

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

                $response = new Response(

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::isGranted
Open

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

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

            if ($form->isValid()) {

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

            if ($form->isValid()) {

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

    protected function createContentTypeForm(Request $request, $option, ContentTypeInterface $contentType)

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

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_UPDATE, new ContentTypeEvent($newContentType));

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)

When appending to a value of type string, found an array access index of type 'validation_groups', but expected the index to be of type int
Open

            $option["validation_groups"] = false;

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

                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_CREATE, new ContentTypeEvent($contentType));

Parameter $contentType has undeclared type \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open

    protected function createContentTypeForm(Request $request, $option, ContentTypeInterface $contentType)

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

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

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

                $this->get('session')->getFlashBag()->add('success', $this->get('translator')->trans('open_orchestra_backoffice.form.content_type.success'));

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

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

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

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

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

    public function formAction(Request $request, $contentTypeId)

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

        $contentType = $this->get('open_orchestra_model.repository.content_type')->findOneByContentTypeIdInLastVersion($contentTypeId);

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

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

Call to method getMethod from undeclared class \Symfony\Component\HttpFoundation\Request
Open

        if ("PATCH" === $request->getMethod()) {

Call to method getMethod from undeclared class \Symfony\Component\HttpFoundation\Request
Open

        if ('PATCH' !== $request->getMethod()) {

Call to undeclared method \OpenOrchestra\BackofficeBundle\Controller\ContentTypeController::get
Open

        $contentType = $this->get('open_orchestra_backoffice.manager.content_type')->initializeNewContentType();

Line exceeds 120 characters; contains 157 characters
Open

                $this->get('session')->getFlashBag()->add('success', $this->get('translator')->trans('open_orchestra_backoffice.form.content_type.success'));

Line exceeds 120 characters; contains 126 characters
Open

        $action = $this->generateUrl('open_orchestra_backoffice_content_type_form', array('contentTypeId' => $contentTypeId));

Line exceeds 120 characters; contains 159 characters
Open

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

Line exceeds 120 characters; contains 169 characters
Open

                    array('Content-type' => 'text/plain; charset=utf-8', 'contentTypeId' => $contentType->getContentTypeId(), 'name' => $contentType->getName($language))

Line exceeds 120 characters; contains 135 characters
Open

        $contentType = $this->get('open_orchestra_model.repository.content_type')->findOneByContentTypeIdInLastVersion($contentTypeId);

There are no issues that match your filters.

Category
Status