Avoid using static access to class '\OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration' in method 'listTableAction'. Open
$configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, StatusInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::dispatchEvent
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$repository = $this->get('open_orchestra_model.repository.status');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $status);
- Create a ticketCreate a ticket
- Exclude checks
Returning type array{}
but deleteAction()
is declared to return \Symfony\Component\HttpFoundation\Response
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Possibly zero references to use statement for classlike/namespace Api
(\OpenOrchestra\BaseApiBundle\Controller\Annotation)
Open
use OpenOrchestra\BaseApiBundle\Controller\Annotation as Api;
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, StatusInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$status = $this->get('open_orchestra_model.repository.status')->find($statusId);
- Create a ticketCreate a ticket
- Exclude checks
Call to method generateFromRequest
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function deleteStatusesAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant STATUS_DELETE
from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseApiBundle\Controller\BaseController
Open
class StatusController extends BaseController
- Create a ticketCreate a ticket
- Exclude checks
Call to method getContent
from undeclared class \Symfony\Component\HttpFoundation\Request
Open
$request->getContent(),
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant STATUS_DELETE
from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::isGranted
Open
return $this->isGranted(ContributionActionInterface::DELETE, $status)
- 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\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
return $this->get('open_orchestra_api.transformer_manager')->transform('status_collection', $status);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function listTableAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Call to method get
from undeclared class \Symfony\Component\HttpFoundation\Request
Open
$format = $request->get('_format', 'json');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$facade = $this->get('jms_serializer')->deserialize(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$statuses = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('status_collection', $facade);
- Create a ticketCreate a ticket
- Exclude checks
@throws annotation of deleteAction
has suspicious class type \OpenOrchestra\WorkflowAdminBundle\Exceptions\HttpException\StatusNotDeletableException,
which does not extend Error/Exception Open
public function deleteAction($statusId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$objectManager = $this->get('object_manager');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
&& $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status);
- Create a ticketCreate a ticket
- Exclude checks
Return type of listTableAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function listTableAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Return type of deleteAction()
is undeclared type \Symfony\Component\HttpFoundation\Response
Open
public function deleteAction($statusId)
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\ModelInterface\Event\StatusEvent
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$status = $this->get('open_orchestra_model.repository.status')->findNotOutOfWorkflow();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $status
has undeclared type \OpenOrchestra\ModelInterface\Model\StatusInterface
Open
protected function isDeleteGranted(StatusInterface $status)
- Create a ticketCreate a ticket
- Exclude checks
Return type of listAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function listAction()
- Create a ticketCreate a ticket
- Exclude checks
Return type of deleteStatusesAction()
is undeclared type \Symfony\Component\HttpFoundation\Response
Open
public function deleteStatusesAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$statusRepository = $this->get('open_orchestra_model.repository.status');
- Create a ticketCreate a ticket
- Exclude checks
Returning type array{}
but deleteStatusesAction()
is declared to return \Symfony\Component\HttpFoundation\Response
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\ModelInterface\Event\StatusEvent
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::get
Open
$facade = $this->get('open_orchestra_api.transformer_manager')->transform('status_collection', $collection);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::getParameter
Open
$this->getParameter('open_orchestra_workflow_admin.facade.status_collection.class'),
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\WorkflowAdminBundle\Controller\Api\StatusController::dispatchEvent
Open
$this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
- Create a ticketCreate a ticket
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function listTableAction(Request $request)
{
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, StatusInterface::ENTITY_TYPE);
$mapping = array(
'label' => 'labels'
- 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 151.
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 121 characters Open
$statuses = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('status_collection', $facade);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
&& $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $status)) {
- Create a ticketCreate a ticket
- Exclude checks