src/CoreBundle/Controller/IndexController.php
The method toggleStudentView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$content = 'studentview';
}
- 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
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/sessions', name: 'sessions')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/p/{slug}', name: 'public_page')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/toggle_student_view', methods: ['GET'])]
- Exclude checks
Missing class doc comment Open
Open
class IndexController extends BaseController
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/', name: 'index', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/admin', name: 'admin', options: ['expose' => true])]
- Exclude checks
You must use "/**" style comments for a function comment Open
Open
public function toggleStudentView(Request $request, SettingsManager $settingsManager): Response
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/sessions/{extra}', name: 'sessions_options')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/admin/configuration/colors', name: 'configuration_colors')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/resources/document/{nodeId}/manager', name: 'resources_filemanager', methods: ['GET'])]
- Exclude checks
You must use "/**" style comments for a function comment Open
Open
public function index(): Response
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Security("is_granted('ROLE_TEACHER')")]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/faq', name: 'faq', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/home', name: 'home', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/login', name: 'login', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/demo', name: 'demo', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/account/home', name: 'chamilo_core_account_home', options: ['expose' => true])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/courses', name: 'courses', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/catalogue/{slug}', name: 'catalogue', options: ['expose' => true], methods: ['GET', 'POST'])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/social', name: 'chamilo_core_socialnetwork', options: ['expose' => true])]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/course/{cid}/home', name: 'chamilo_core_course_home')]
- Exclude checks
Add a single space around assignment operators Open
Open
declare(strict_types=1);
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/resources/ccalendarevent', name: 'resources_ccalendarevent', methods: ['GET'])]
- Exclude checks