GroupBundle/Transformer/GroupTransformer.php
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$facadeClass,
AuthorizationCheckerInterface $authorizationChecker,
MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
GroupRepositoryInterface $groupRepository,
BusinessRulesManager $businessRulesManager
- Create a ticketCreate a ticket
Avoid assigning values to variables in if clauses and the like (line '98', column '55'). Open
Open
protected function addSite(FacadeInterface $facade, GroupInterface $group)
{
if ($this->hasGroup(CMSGroupContext::SITE) && $site = $group->getSite()) {
$facade->site = $this->getContext()->transform('site', $site);
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid unused parameters such as '$params'. Open
Open
public function reverseTransform(FacadeInterface $facade, array $params = array())
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Class extends undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open
Open
class GroupTransformer extends AbstractSecurityCheckerAwareTransformer
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
Open
throw new TransformerParameterTypeException();
- Create a ticketCreate a ticket
- Exclude checks
Call to method choose
from undeclared class \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open
Open
$facade->label = $this->multiLanguagesChoiceManager->choose($group->getLabels());
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->businessRulesManager
Open
Open
$this->businessRulesManager->isGranted(BusinessActionInterface::DELETE, $group, $nbrGroupsUsers)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property id
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
return $this->groupRepository->find($facade->id);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Transformer\GroupTransformer::newFacade
Open
Open
$facade = $this->newFacade();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Transformer\GroupTransformer::hasGroup
Open
Open
if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $authorizationChecker
has undeclared type \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addRoles(FacadeInterface $facade, GroupInterface $group)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addSite(FacadeInterface $facade, GroupInterface $group)
- Create a ticketCreate a ticket
- Exclude checks
Return type of addSite()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addSite(FacadeInterface $facade, GroupInterface $group)
- Create a ticketCreate a ticket
- Exclude checks
Return type of addRights()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addRights(FacadeInterface $facade, GroupInterface $group, array $nbrGroupsUsers)
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->groupRepository
Open
Open
return $this->groupRepository->find($facade->id);
- Create a ticketCreate a ticket
- Exclude checks
Saw an @param annotation for nbrUsers,
but it was not found in the param list of function addRights(\OpenOrchestra\BaseApi\Facade\FacadeInterface $facade, \OpenOrchestra\Backoffice\Model\GroupInterface $group, array $nbrGroupsUsers) : \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
* @param array $nbrUsers
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
$facade->addRight('can_duplicate', $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, GroupInterface::ENTITY_TYPE));
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property id
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
if (null !== $facade->id) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $multiLanguagesChoiceManager
has undeclared type \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Model\GroupInterface::getId
Open
Open
$facade->nbrUsers = array_key_exists($group->getId(), $nbrGroupsUsers) ? $nbrGroupsUsers[$group->getId()] : 0;
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Transformer\GroupTransformer::getContext
Open
Open
$facade->site = $this->getContext()->transform('site', $site);
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->businessRulesManager
(Did you mean $businessRulesManager) Open
Open
$this->businessRulesManager = $businessRulesManager;
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Model\GroupInterface::getName
Open
Open
$facade->name = $group->getName();
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->authorizationChecker
Open
Open
$facade->addRight('can_duplicate', $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, GroupInterface::ENTITY_TYPE));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Model\GroupInterface::getRoles
Open
Open
foreach ($group->getRoles() as $role) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRole
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
$facade->addRole($role);
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open
Open
parent::__construct($facadeClass, $authorizationChecker);
- Create a ticketCreate a ticket
- Exclude checks
@throws type of transform
has undeclared type \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
Open
public function transform($group, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addRights(FacadeInterface $facade, GroupInterface $group, array $nbrGroupsUsers)
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->authorizationChecker
Open
Open
$this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $group) &&
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Transformer\GroupTransformer::hasGroup
Open
Open
if ($this->hasGroup(CMSGroupContext::GROUP_ROLES)) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
public function reverseTransform(FacadeInterface $facade, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property site
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
$facade->site = $this->getContext()->transform('site', $site);
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
$facade->addRight('can_delete',
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\GroupBundle\Transformer\GroupTransformer->groupRepository
(Did you mean $groupRepository) Open
Open
$this->groupRepository = $groupRepository;
- Create a ticketCreate a ticket
- Exclude checks
Return type of transform()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
public function transform($group, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\Backoffice\Model\GroupInterface::getId
Open
Open
$facade->id = $group->getId();
- Create a ticketCreate a ticket
- Exclude checks
Return type of addRoles()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
protected function addRoles(FacadeInterface $facade, GroupInterface $group)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\GroupBundle\Transformer\GroupTransformer::hasGroup
Open
Open
if ($this->hasGroup(CMSGroupContext::SITE) && $site = $group->getSite()) {
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $multiLanguagesChoiceManager. Keep variable name length under 20. Open
Open
protected $multiLanguagesChoiceManager;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $multiLanguagesChoiceManager. Keep variable name length under 20. Open
Open
MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
There must be a single space between the closing parenthesis and the opening brace of a multi-line function declaration; found 0 spaces Open
Open
){
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
Open
$facade->addRight('can_duplicate', $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, GroupInterface::ENTITY_TYPE));
- Create a ticketCreate a ticket
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
Open
$facade->addRight('can_delete',
- Create a ticketCreate a ticket
- Exclude checks