Headoo/ElasticSearchBundle

View on GitHub
Command/PopulateElasticCommand.php

Summary

Maintainability
C
1 day
Test Coverage

Method processBatch has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processBatch($type, $transformer)
    {
        $this->output->writeln(self::completeLine("Creating Type {$type} and Mapping"));

        $objectType = $this->getIndexFromType($type)->getType($type);
Severity: Minor
Found in Command/PopulateElasticCommand.php - About 1 hr to fix

    Function execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $this->init($input, $output);
    
            if ($input->getOption('where') && ! $input->getOption('id')) {
    Severity: Minor
    Found in Command/PopulateElasticCommand.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 runParallel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
        {
            // do not modify the object pointers in the argument, copy to local working variable
            $processesQueue = $processes;
            // fix maxParallel to be max the number of processes or positive
    Severity: Minor
    Found in Command/PopulateElasticCommand.php - About 1 hr to fix

      Method _getQuery has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function _getQuery($type, &$iResults)
          {
              $id = filter_var($this->id, FILTER_SANITIZE_STRING);
              $where = filter_var($this->where, FILTER_SANITIZE_STRING);
              $joins = filter_var($this->join, FILTER_SANITIZE_STRING);
      Severity: Minor
      Found in Command/PopulateElasticCommand.php - About 1 hr to fix

        Function runParallel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
            {
                // do not modify the object pointers in the argument, copy to local working variable
                $processesQueue = $processes;
                // fix maxParallel to be max the number of processes or positive
        Severity: Minor
        Found in Command/PopulateElasticCommand.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 execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $this->init($input, $output);
        
                if ($input->getOption('where') && ! $input->getOption('id')) {
        Severity: Minor
        Found in Command/PopulateElasticCommand.php - About 1 hr to fix

          Function processBatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function processBatch($type, $transformer)
              {
                  $this->output->writeln(self::completeLine("Creating Type {$type} and Mapping"));
          
                  $objectType = $this->getIndexFromType($type)->getType($type);
          Severity: Minor
          Found in Command/PopulateElasticCommand.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 _getQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _getQuery($type, &$iResults)
              {
                  $id = filter_var($this->id, FILTER_SANITIZE_STRING);
                  $where = filter_var($this->where, FILTER_SANITIZE_STRING);
                  $joins = filter_var($this->join, FILTER_SANITIZE_STRING);
          Severity: Minor
          Found in Command/PopulateElasticCommand.php - About 45 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

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

              public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
          Severity: Minor
          Found in Command/PopulateElasticCommand.php - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $returnValue;
            Severity: Major
            Found in Command/PopulateElasticCommand.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status