original_string: protected function longestCommandName($commands, $argv)
      {
          for ($i = 3; $i > 1; $i--) {
              $parts = array_slice($argv, 0, $i);
              $name = implode(' ', $parts);
              if ($commands->has($name)) {
                  return [$name, array_slice($argv, $i)];
              }
          }
          $name = array_shift($argv);
  
          return [$name, $argv];
      }
code: protected function longestCommandName($commands, $argv)
      {
          for ($i = 3; $i > 1; $i--) {
              $parts = array_slice($argv, 0, $i);
              $name = implode(' ', $parts);
              if ($commands->has($name)) {
                  return [$name, array_slice($argv, $i)];
              }
          }
          $name = array_shift($argv);
  
          return [$name, $argv];
      }
code_tokens: protected function longestCommandName ( $ commands , $ argv ) { for ( $ i = 3 ; $ i > 1 ; $ i -- ) { $ parts = array_slice ( $ argv , 0 , $ i ) ; $ name = implode ( ' ' , $ parts ) ; if ( $ commands -> has ( $ name ) ) { return [ $ name , array_slice ( $ argv , $ i ) ] ; } } $ name = array_shift ( $ argv ) ; return [ $ name , $ argv ] ; }
docstring: Build the longest command name that exists in the collection
  
  Build the longest command name that matches a
  defined command. This will traverse a maximum of 3 tokens.
  
  @param \Cake\Console\CommandCollection $commands The command collection to check.
  @param array $argv The CLI arguments.
  @return array An array of the resolved name and modified argv.
docstring_tokens: Build the longest command name that exists in the collection