original_string: protected function isControllerAction(
          string $method = null,
          string $path = null,
          string $class
      ) {
          $method = ucfirst(strtolower($method));
          $args = explode("/", $path);
          $action = array_shift($args);
          $action = empty($action) ? "index" : $action;
          $action = str_replace("-", "", $action);
          $action1 = "{$action}Action{$method}";
          $action2 = "{$action}Action";
          $action3 = "catchAll{$method}";
          $action4 = "catchAll";
  
          foreach ([$action1, $action2] as $target) {
              try {
                  $refl = new \ReflectionMethod($class, $target);
                  if (!$refl->isPublic()) {
                      throw new NotFoundException("Controller method '$class::$target' is not a public method.");
                  }
  
                  return [$class, $target, $args];
              } catch (\ReflectionException $e) {
                  ;
              }
          }
  
          foreach ([$action3, $action4] as $target) {
              try {
                  $refl = new \ReflectionMethod($class, $target);
                  if (!$refl->isPublic()) {
                      throw new NotFoundException("Controller method '$class::$target' is not a public method.");
                  }
  
                  array_unshift($args, $action);
                  return [$class, $target, $args];
              } catch (\ReflectionException $e) {
                  ;
              }
          }
  
          return false;
      }
code: protected function isControllerAction(
          string $method = null,
          string $path = null,
          string $class
      ) {
          $method = ucfirst(strtolower($method));
          $args = explode("/", $path);
          $action = array_shift($args);
          $action = empty($action) ? "index" : $action;
          $action = str_replace("-", "", $action);
          $action1 = "{$action}Action{$method}";
          $action2 = "{$action}Action";
          $action3 = "catchAll{$method}";
          $action4 = "catchAll";
  
          foreach ([$action1, $action2] as $target) {
              try {
                  $refl = new \ReflectionMethod($class, $target);
                  if (!$refl->isPublic()) {
                      throw new NotFoundException("Controller method '$class::$target' is not a public method.");
                  }
  
                  return [$class, $target, $args];
              } catch (\ReflectionException $e) {
                  ;
              }
          }
  
          foreach ([$action3, $action4] as $target) {
              try {
                  $refl = new \ReflectionMethod($class, $target);
                  if (!$refl->isPublic()) {
                      throw new NotFoundException("Controller method '$class::$target' is not a public method.");
                  }
  
                  array_unshift($args, $action);
                  return [$class, $target, $args];
              } catch (\ReflectionException $e) {
                  ;
              }
          }
  
          return false;
      }
code_tokens: protected function isControllerAction ( string $ method = null , string $ path = null , string $ class ) { $ method = ucfirst ( strtolower ( $ method ) ) ; $ args = explode ( "/" , $ path ) ; $ action = array_shift ( $ args ) ; $ action = empty ( $ action ) ? "index" : $ action ; $ action = str_replace ( "-" , "" , $ action ) ; $ action1 = "{$action}Action{$method}" ; $ action2 = "{$action}Action" ; $ action3 = "catchAll{$method}" ; $ action4 = "catchAll" ; foreach ( [ $ action1 , $ action2 ] as $ target ) { try { $ refl = new \ ReflectionMethod ( $ class , $ target ) ; if ( ! $ refl -> isPublic ( ) ) { throw new NotFoundException ( "Controller method '$class::$target' is not a public method." ) ; } return [ $ class , $ target , $ args ] ; } catch ( \ ReflectionException $ e ) { ; } } foreach ( [ $ action3 , $ action4 ] as $ target ) { try { $ refl = new \ ReflectionMethod ( $ class , $ target ) ; if ( ! $ refl -> isPublic ( ) ) { throw new NotFoundException ( "Controller method '$class::$target' is not a public method." ) ; } array_unshift ( $ args , $ action ) ; return [ $ class , $ target , $ args ] ; } catch ( \ ReflectionException $ e ) { ; } } return false ; }
docstring: Check if items can be used to call a controller action, verify
  that the controller exists, the action has a class-method to call.
  
  @param string $method the request method.
  @param string $path   the matched path, base for the controller action
  and the arguments.
  @param string $class  the controller class
  
  @return array with callable details.
docstring_tokens: Check if items can be used to call a controller action verify that the controller exists the action has a class - method to call .