original_string: protected function buildMethods()
      {
          $refl = new \ReflectionClass($this);
          $enterMethods = [];
          $leaveMethods = [];
  
          foreach ($refl->getMethods() as $method) {
              $name = $method->getName();
              if (preg_match('/^(enter|leave).+/', $name) && !preg_match('/^(enter|leave)Node$/', $name)) {
                  $params = $method->getParameters();
                  if ($params && $params[0]->getClass()) {
                      $nodeType = $params[0]->getClass()->getName();
                      if (Text::startsWith($name, 'enter')) {
                          $enterMethods[$nodeType][] = $name;
                      } else {
                          $leaveMethods[$nodeType][] = $name;
                      }
                  }
              }
          }
          self::$enterMethods[get_class($this)] = $enterMethods;
          self::$leaveMethods[get_class($this)] = $leaveMethods;
      }
code: protected function buildMethods()
      {
          $refl = new \ReflectionClass($this);
          $enterMethods = [];
          $leaveMethods = [];
  
          foreach ($refl->getMethods() as $method) {
              $name = $method->getName();
              if (preg_match('/^(enter|leave).+/', $name) && !preg_match('/^(enter|leave)Node$/', $name)) {
                  $params = $method->getParameters();
                  if ($params && $params[0]->getClass()) {
                      $nodeType = $params[0]->getClass()->getName();
                      if (Text::startsWith($name, 'enter')) {
                          $enterMethods[$nodeType][] = $name;
                      } else {
                          $leaveMethods[$nodeType][] = $name;
                      }
                  }
              }
          }
          self::$enterMethods[get_class($this)] = $enterMethods;
          self::$leaveMethods[get_class($this)] = $leaveMethods;
      }
code_tokens: protected function buildMethods ( ) { $ refl = new \ ReflectionClass ( $ this ) ; $ enterMethods = [ ] ; $ leaveMethods = [ ] ; foreach ( $ refl -> getMethods ( ) as $ method ) { $ name = $ method -> getName ( ) ; if ( preg_match ( '/^(enter|leave).+/' , $ name ) && ! preg_match ( '/^(enter|leave)Node$/' , $ name ) ) { $ params = $ method -> getParameters ( ) ; if ( $ params && $ params [ 0 ] -> getClass ( ) ) { $ nodeType = $ params [ 0 ] -> getClass ( ) -> getName ( ) ; if ( Text :: startsWith ( $ name , 'enter' ) ) { $ enterMethods [ $ nodeType ] [ ] = $ name ; } else { $ leaveMethods [ $ nodeType ] [ ] = $ name ; } } } } self :: $ enterMethods [ get_class ( $ this ) ] = $ enterMethods ; self :: $ leaveMethods [ get_class ( $ this ) ] = $ leaveMethods ; }
docstring: collect all rule method according to node type of parameter
docstring_tokens: collect all rule method according to node type of parameter