How to create a Class that I can reuse in multiple modules? I would like to create a class that has a set of methods that I want to reuse across the site in either mytheme.theme or secondmodule.module files. 

How would I create this class and class methods so that they can be used in multiple areas? Would I have to create a custom module for this?

Here is what I was trying so far, but need assistance on next step. 

&lt;?php
namespace Drupal\CustomClass;

class MyClass {
  public static function processEntity($var1, $var2) {
    /* process the parameters */
    return value;
  }
}


If I wanted to use this in a mytheme.theme file I was thinking to do this

&lt;?php

use Drupal\CustomClass\MyClass;

function _some_function() {
  /* processing logic here which results in $var1, $var2 */
  $results = MyClass::processEntity($var1, $var2);
}
Your use case is where Drupal 8 services come into play. When you'd like to create classes/methods that can be used across Drupal by other modules and your theme, create a custom module that provides this class as a service. You can then get an instance of this service class by either using the static service getter \Drupal::service() within *.module or *.theme files, or dependency injection in other classes/services.