File SyncBackend.php
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
Method handleRemovedUsers
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleRemovedUsers(array $removedUsers, InputInterface $input, OutputInterface $output, $missingAccountsAction): void {
if (empty($removedUsers)) {
$output->writeln('No removed users have been detected.');
} else {
// define some actions to be used
Method configure
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure() {
$this
->setName('user:sync')
->setDescription('Synchronize users from a given backend to the accounts table.')
->addArgument(
Method execute
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('list')) {
$backends = $this->userManager->getBackends();
foreach ($backends as $backend) {
$output->writeln(\get_class($backend));
Method syncMultipleUsers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function syncMultipleUsers(
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
Function execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('list')) {
$backends = $this->userManager->getBackends();
foreach ($backends as $backend) {
$output->writeln(\get_class($backend));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method syncSingleUser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function syncSingleUser(
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
Function syncSingleUser
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function syncSingleUser(
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handleRemovedUsers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function handleRemovedUsers(array $removedUsers, InputInterface $input, OutputInterface $output, $missingAccountsAction): void {
if (empty($removedUsers)) {
$output->writeln('No removed users have been detected.');
} else {
// define some actions to be used
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method syncSingleUser
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
$uid,
Method syncMultipleUsers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
$missingAccountsAction
Avoid too many return
statements within this method. Open
return 0;
Avoid too many return
statements within this method. Open
return 1;
Avoid too many return
statements within this method. Open
return 1;
Function syncMultipleUsers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function syncMultipleUsers(
InputInterface $input,
OutputInterface $output,
SyncService $syncService,
UserInterface $backend,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"