The method getExtraFieldBlock() has an NPath complexity of 246. The configured NPath complexity threshold is 200. Open
private function getExtraFieldBlock(
int $userId,
UserRepository $userRepository,
SettingsManager $settingsManager,
ExtraFieldRepository $extraFieldRepository,
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method group() has an NPath complexity of 208. The configured NPath complexity threshold is 200. Open
public function group(
Request $request,
UsergroupRepository $usergroupRepository,
EntityManagerInterface $em,
MessageRepository $messageRepository
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The class SocialController has a coupling between objects value of 34. Consider to reduce the number of dependencies under 13. Open
class SocialController extends AbstractController
{
public function __construct(
private readonly UserHelper $userHelper,
) {}
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The method handlePrivacyRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return $this->json(['success' => false, 'message' => 'Invalid action type']);
}
- Read upRead up
- 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
The method getLegalTerms uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$term = $this->getLastConditionByLanguage($languageRepo, $isoCode, $legalTermsRepo, $settingsManager);
}
- Read upRead up
- 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
The method getGroups uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$groups = $usergroupRepository->getGroupsByUser($userId);
foreach ($groups as $group) {
$items[] = [
'id' => $group->getId(),
- Read upRead up
- 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
The method handlePrivacyRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
MessageManager::sendMessageToAllAdminUsers($user->getId(), $emailSubject, $emailContent);
}
- Read upRead up
- 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
The method group uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data = json_decode($request->getContent(), true);
$userId = $data['userId'] ?? null;
$groupId = $data['groupId'] ?? null;
$action = $data['action'] ?? null;
- Read upRead up
- 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
Avoid unused local variables such as '$legalTime'. Open
[$legalId, $legalLanguageId, $legalTime] = explode(':', $value['value']);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$legalLanguageId'. Open
[$legalId, $legalLanguageId, $legalTime] = explode(':', $value['value']);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$illustrationRepository'. Open
public function groupInvitedUsers(int $groupId, UsergroupRepository $usergroupRepository, IllustrationRepository $illustrationRepository): JsonResponse
- Read upRead up
- 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
Avoid unused local variables such as '$coordinates'. Open
$coordinates = $geoData[1] ?? '';
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$res'. Open
$res = MessageManager::send_message(
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$extraFieldRepository'. Open
ExtraFieldRepository $extraFieldRepository,
- Read upRead up
- 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
Avoid unused local variables such as '$legalId'. Open
[$legalId, $legalLanguageId, $legalTime] = explode(':', $value['value']);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$legalLanguageId'. Open
[$legalId, $legalLanguageId, $legalTime] = explode(':', $value['value']);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/legal-status/{userId}', name: 'chamilo_core_social_legal_status')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getLegalStatus(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/handle-privacy-request', name: 'chamilo_core_social_handle_privacy_request')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function handlePrivacyRequest(
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getDiscussionMessages(
- Exclude checks
You must use "/**" style comments for a function comment Open
public function groupInvitedUsers(int $groupId, UsergroupRepository $usergroupRepository, IllustrationRepository $illustrationRepository): JsonResponse
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[IsGranted('ROLE_USER')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/user-profile/{userId}', name: 'chamilo_core_social_user_profile')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function group(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/group-action', name: 'chamilo_core_social_group_action')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/get-forum-link', name: 'get_forum_link')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function groupDetails(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/upload-group-picture/{groupId}', name: 'chamilo_core_social_upload_group_picture')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/send-legal-term', name: 'chamilo_core_social_send_legal_term')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/delete-legal', name: 'chamilo_core_social_delete_legal')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function deleteLegal(Request $request, TranslatorInterface $translator): JsonResponse
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/group/{groupId}/discussion/{discussionId}/messages', name: 'chamilo_core_social_group_discussion_messages')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getInvitations(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/user-action', name: 'chamilo_core_social_user_action')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function uploadGroupPicture(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/social-network')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function sendLegalTerm(
- Exclude checks
Declare public methods first,then protected ones and finally private ones Open
public function getInvitations(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/terms-restrictions/{userId}', name: 'chamilo_core_social_terms_restrictions')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function search(
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getOnlineStatus(Request $request, TrackEOnlineRepository $trackOnlineRepository): JsonResponse
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getForumLink(
- Exclude checks
You must use "/**" style comments for a function comment Open
public function inviteFriends(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/group/{groupId}/invited-users', name: 'chamilo_core_social_group_invited_users')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/group-details/{groupId}', name: 'chamilo_core_social_group_details')]
- Exclude checks
Add a single space around assignment operators Open
declare(strict_types=1);
- Exclude checks
You must use "/**" style comments for a class comment Open
class SocialController extends AbstractController
- Exclude checks
Missing function doc comment Open
public function __construct(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/add-users-to-group/{groupId}', name: 'chamilo_core_social_add_users_to_group')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getUserProfile(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/invitations/count/{userId}', name: 'chamilo_core_social_invitations_count')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[IsGranted('ROLE_USER')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getUserRelation(int $currentUserId, int $profileUserId, EntityManagerInterface $em): JsonResponse
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getPersonalData(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/terms-and-conditions/{userId}', name: 'chamilo_core_social_terms')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getLegalTerms(
- Exclude checks
You must use "/**" style comments for a function comment Open
public function user(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/user-relation/{currentUserId}/{profileUserId}', name: 'chamilo_core_social_get_user_relation')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/online-status', name: 'chamilo_core_social_get_online_status', methods: ['POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/personal-data/{userId}', name: 'chamilo_core_social_personal_data')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function addUsersToGroup(Request $request, int $groupId, UsergroupRepository $usergroupRepository): JsonResponse
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getInvitationsCount(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/search', name: 'chamilo_core_social_search')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function checkTermsRestrictions(
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/groups/{userId}', name: 'chamilo_core_social_groups')]
- Exclude checks
You must use "/**" style comments for a function comment Open
public function getGroups(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/invite-friends/{userId}/{groupId}', name: 'chamilo_core_social_invite_friends')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Route('/invitations/{userId}', name: 'chamilo_core_social_invitations')]
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly UserHelper $userHelper,
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks