original_string: public function subCommands($commandName)
      {
          $Shell = $this->getShell($commandName);
  
          if (!$Shell) {
              return [];
          }
  
          $taskMap = $this->Tasks->normalizeArray((array)$Shell->tasks);
          $return = array_keys($taskMap);
          $return = array_map('Cake\Utility\Inflector::underscore', $return);
  
          $shellMethodNames = ['main', 'help', 'getOptionParser', 'initialize', 'runCommand'];
  
          $baseClasses = ['Object', 'Shell', 'AppShell'];
  
          $Reflection = new ReflectionClass($Shell);
          $methods = $Reflection->getMethods(ReflectionMethod::IS_PUBLIC);
          $methodNames = [];
          foreach ($methods as $method) {
              $declaringClass = $method->getDeclaringClass()->getShortName();
              if (!in_array($declaringClass, $baseClasses)) {
                  $methodNames[] = $method->getName();
              }
          }
  
          $return = array_merge($return, array_diff($methodNames, $shellMethodNames));
          sort($return);
  
          return $return;
      }
code: public function subCommands($commandName)
      {
          $Shell = $this->getShell($commandName);
  
          if (!$Shell) {
              return [];
          }
  
          $taskMap = $this->Tasks->normalizeArray((array)$Shell->tasks);
          $return = array_keys($taskMap);
          $return = array_map('Cake\Utility\Inflector::underscore', $return);
  
          $shellMethodNames = ['main', 'help', 'getOptionParser', 'initialize', 'runCommand'];
  
          $baseClasses = ['Object', 'Shell', 'AppShell'];
  
          $Reflection = new ReflectionClass($Shell);
          $methods = $Reflection->getMethods(ReflectionMethod::IS_PUBLIC);
          $methodNames = [];
          foreach ($methods as $method) {
              $declaringClass = $method->getDeclaringClass()->getShortName();
              if (!in_array($declaringClass, $baseClasses)) {
                  $methodNames[] = $method->getName();
              }
          }
  
          $return = array_merge($return, array_diff($methodNames, $shellMethodNames));
          sort($return);
  
          return $return;
      }
code_tokens: public function subCommands ( $ commandName ) { $ Shell = $ this -> getShell ( $ commandName ) ; if ( ! $ Shell ) { return [ ] ; } $ taskMap = $ this -> Tasks -> normalizeArray ( ( array ) $ Shell -> tasks ) ; $ return = array_keys ( $ taskMap ) ; $ return = array_map ( 'Cake\Utility\Inflector::underscore' , $ return ) ; $ shellMethodNames = [ 'main' , 'help' , 'getOptionParser' , 'initialize' , 'runCommand' ] ; $ baseClasses = [ 'Object' , 'Shell' , 'AppShell' ] ; $ Reflection = new ReflectionClass ( $ Shell ) ; $ methods = $ Reflection -> getMethods ( ReflectionMethod :: IS_PUBLIC ) ; $ methodNames = [ ] ; foreach ( $ methods as $ method ) { $ declaringClass = $ method -> getDeclaringClass ( ) -> getShortName ( ) ; if ( ! in_array ( $ declaringClass , $ baseClasses ) ) { $ methodNames [ ] = $ method -> getName ( ) ; } } $ return = array_merge ( $ return , array_diff ( $ methodNames , $ shellMethodNames ) ) ; sort ( $ return ) ; return $ return ; }
docstring: Return a list of subcommands for a given command
  
  @param string $commandName The command you want subcommands from.
  @return string[]
  @throws \ReflectionException
docstring_tokens: Return a list of subcommands for a given command