# registerScope method

1. @override

void registerScope(

1. String scopeName,
2. PodScope scope

)
override

Registers a new scope with the given name.

Scopes control the lifecycle and visibility of pods. Common scopes include 'singleton', 'prototype', 'request', 'session', etc.

## Usage Example:

    factory.registerScope('request', RequestScope());
    factory.registerScope('session', SessionScope());

@param scopeName The name of the scope to register @param scope The scope implementation to register

## Implementation

    @override
    void registerScope(String scopeName, PodScope scope) {
      if (ScopeType.SINGLETON.name.equalsIgnoreCase(scopeName) || ScopeType.PROTOTYPE.name.equalsIgnoreCase(scopeName)) {
    			throw IllegalArgumentException("Cannot replace existing scopes 'singleton' and 'prototype'");
    		}

    		PodScope? previous = _scopes.get(scopeName.toLowerCase());
    		if (previous != null && previous != scope) {
    			if (logger.getIsDebugEnabled()) {
    				logger.debug("Replacing scope '$scopeName' from [$previous] to [$scope]");
    			}
    		} else if (logger.getIsTraceEnabled()) {
    			logger.trace("Registering scope '$scopeName' with implementation [$scope]");
    		}

      _scopes[scopeName.toLowerCase()] = scope;
    }