public function required($name, $class = null)
    {
        if (! isset($this->$name)) {
            throw new InvalidModuleException('Undefined module: ' . $name . ', required by ' . Utilities::getCaller());
        }
        if (isset($class) and !Utilities::isSubclassOf($this->$name, $class)) {
            throw new InvalidModuleException(
                'The module "' . $name . '" of type ' . get_class($this->$name)
                . ' was expected by ' . Utilities::getCaller()
                . ' to be of type ' . $class
            );
        }
    }