code: private function isAccessible(\ReflectionClass $class, $methodName, $parameters)
      {
          if ($class->hasMethod($methodName)) {
              $method = $class->getMethod($methodName);
  
              if ($method->isPublic() && $method->getNumberOfRequiredParameters() === $parameters) {
                  return true;
              }
          }
  
          return false;
      }
docs: Returns whether a method is public and has a specific number of required parameters.
  
  Copied from {@link Symfony\Component\PropertyAccess\PropertyAccessor}.
  
  @param  \ReflectionClass $class      The class of the method
  @param  string           $methodName The method name
  @param  integer          $parameters The number of parameters
  
  @return Boolean Whether the method is public and has $parameters
  required parameters