code: protected function getConstantValues(string $classIdentifier, string $regex) : array
      {
          $reflectionClass = new \ReflectionClass($classIdentifier);
          $constants = $reflectionClass->getConstants();
  
          $validValues = array_filter($constants, function ($constantName) use ($regex) {
              return preg_match($regex, $constantName);
          }, ARRAY_FILTER_USE_KEY);
  
          return $validValues;
      }
docs: Returns the constant values of the given class when its name matches
  the given regex.
  
  @param string $classIdentifier
  @param string $regex
  @return array