owncloud/core

View on GitHub
core/Command/User/SyncBackend.php

Summary

Maintainability
D
2 days
Test Coverage

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>
 *
Severity: Minor
Found in core/Command/User/SyncBackend.php - About 4 hrs to fix

    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
    Severity: Major
    Found in core/Command/User/SyncBackend.php - About 2 hrs to fix

      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(
      Severity: Minor
      Found in core/Command/User/SyncBackend.php - About 1 hr to fix

        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));
        Severity: Minor
        Found in core/Command/User/SyncBackend.php - About 1 hr to fix

          Method syncMultipleUsers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function syncMultipleUsers(
                  InputInterface $input,
                  OutputInterface $output,
                  SyncService $syncService,
                  UserInterface $backend,
          Severity: Minor
          Found in core/Command/User/SyncBackend.php - About 1 hr to fix

            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));
            Severity: Minor
            Found in core/Command/User/SyncBackend.php - About 1 hr to fix

            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,
            Severity: Minor
            Found in core/Command/User/SyncBackend.php - About 1 hr to fix

              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,
              Severity: Minor
              Found in core/Command/User/SyncBackend.php - About 1 hr to fix

              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
              Severity: Minor
              Found in core/Command/User/SyncBackend.php - About 1 hr to fix

              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,
              Severity: Minor
              Found in core/Command/User/SyncBackend.php - About 45 mins to fix

                Method syncMultipleUsers has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        InputInterface $input,
                        OutputInterface $output,
                        SyncService $syncService,
                        UserInterface $backend,
                        $missingAccountsAction
                Severity: Minor
                Found in core/Command/User/SyncBackend.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return 0;
                  Severity: Major
                  Found in core/Command/User/SyncBackend.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return 1;
                    Severity: Major
                    Found in core/Command/User/SyncBackend.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return 1;
                      Severity: Major
                      Found in core/Command/User/SyncBackend.php - About 30 mins to fix

                        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,
                        Severity: Minor
                        Found in core/Command/User/SyncBackend.php - About 25 mins to fix

                        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

                        There are no issues that match your filters.

                        Category
                        Status