Avoid using static access to class '\OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration' in method 'listInGroupAction'. 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
Avoid using static access to class '\OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration' in method 'listAction'. 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
The method listAction uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sitesId = $this->getAvailableSiteIds();
$collection = $repository->findForPaginateFilterBySiteIds($configuration, $language, $sitesId);
$recordsTotal = $repository->countFilterBySiteIds($sitesId);
$recordsFiltered = $repository->countWithFilterAndSiteIds($configuration, $language, $sitesId);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
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
Returning type array{}
but showAction()
is declared to return \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseApiBundle\Controller\BaseController
Open
class UserController extends BaseController
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
return $this->get('open_orchestra_api.transformer_manager')->transform('user', $user);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function removeGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$availableSites = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getAvailableSites();
- 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
Return type of addGroupAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function addGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
@throws type of addGroupAction
has undeclared type \OpenOrchestra\BaseApi\Exceptions\HttpException\UserNotFoundHttpException
Open
public function addGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$group = $this->get('open_orchestra_user.repository.group')->find($groupId);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$this->get('open_orchestra_user.repository.user')->addGroup($users, $group);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$users = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('user_collection', $facade);
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant USER_DELETE
from undeclared class \OpenOrchestra\UserBundle\UserEvents
Open
$this->dispatchEvent(UserEvents::USER_DELETE, new UserEvent($user));
- 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
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::isGranted
Open
if ($this->isGranted(ContributionActionInterface::DELETE, $user)) {
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
if ($user instanceof UserInterface) {
- 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
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::getParameter
Open
$this->getParameter('open_orchestra_user_admin.facade.user_collection.class'),
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Return type of listAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function listAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$facade = $this->get('open_orchestra_api.transformer_manager')->transform('user_collection', $collection);
- Create a ticketCreate a ticket
- Exclude checks
Returning type array{}
but addGroupAction()
is declared to return \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function deleteUsersAction(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 method getId
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
$this->get('open_orchestra_user.repository.user')->removeGroup($user->getId(), $groupId);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function addGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$users = $this->get('open_orchestra_api.transformer_manager')->get('user_collection')->reverseTransform($facade);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$facade = $this->get('jms_serializer')->deserialize(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$userRepository = $this->get('open_orchestra_user.repository.user');
- Create a ticketCreate a ticket
- Exclude checks
Returning type array{}
but deleteUsersAction()
is declared to return \Symfony\Component\HttpFoundation\Response
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$repository = $this->get('open_orchestra_user.repository.user');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$facade = $this->get('jms_serializer')->deserialize(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$repository = $this->get('open_orchestra_user.repository.user');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$user = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('user', $facade);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$language = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\BaseApi\Exceptions\HttpException\UserNotFoundHttpException
Open
throw new UserNotFoundHttpException();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::dispatchEvent
Open
$this->dispatchEvent(UserEvents::USER_DELETE, new UserEvent($user));
- 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
Return type of showAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function showAction($email)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
if (!$user instanceof UserInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$facade = $this->get('jms_serializer')->deserialize(
- 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
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::getParameter
Open
$this->getParameter('open_orchestra_user_admin.facade.user_collection.class'),
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
if ($this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function listInGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Return type of removeGroupAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function removeGroupAction(Request $request, $groupId)
- 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\UserAdminBundle\Controller\Api\UserController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $user);
- Create a ticketCreate a ticket
- Exclude checks
Return type of deleteUsersAction()
is undeclared type \Symfony\Component\HttpFoundation\Response
Open
public function deleteUsersAction(Request $request)
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\UserBundle\Event\UserEvent
Open
$this->dispatchEvent(UserEvents::USER_DELETE, new UserEvent($user));
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Return type of listInGroupAction()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function listInGroupAction(Request $request, $groupId)
- 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
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::denyAccessUnlessGranted
Open
$this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$facade = $this->get('open_orchestra_api.transformer_manager')->transform('user_collection', $collection);
- Create a ticketCreate a ticket
- Exclude checks
@throws type of removeGroupAction
has undeclared type \OpenOrchestra\BaseApi\Exceptions\HttpException\UserNotFoundHttpException
Open
public function removeGroupAction(Request $request, $groupId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::getParameter
Open
$this->getParameter('open_orchestra_user_admin.facade.user.class'),
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$this->get('open_orchestra_user.repository.user')->removeGroup($user->getId(), $groupId);
- Create a ticketCreate a ticket
- Exclude checks
Returning type array{}
but removeGroupAction()
is declared to return \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
return array();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\UserAdminBundle\Controller\Api\UserController::get
Open
$user = $this->get('open_orchestra_user.repository.user')->findOneByEmail($email);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $request
has undeclared type \Symfony\Component\HttpFoundation\Request
Open
public function listAction(Request $request)
- 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
Line exceeds 120 characters; contains 121 characters Open
$users = $this->get('open_orchestra_api.transformer_manager')->get('user_collection')->reverseTransform($facade);
- Create a ticketCreate a ticket
- Exclude checks