public function addRealm(Realm $realm)
    {
        $realmName = $realm->getRealmName();

        if (!static::validRealmName($realm->getRealmName())) {
            throw new InvalidRealmNameException;
        }

        if (array_key_exists($realm->getRealmName(), $this->realms)) {
            throw new \Exception('There is already a realm \'' . $realm->getRealmName() . '\'');
        }

        Logger::debug($this, 'Adding realm \'' . $realmName . '\'');

        $this->realms[$realm->getRealmName()] = $realm;

        $this->router->getEventDispatcher()->dispatch('new_realm', new NewRealmEvent($realm));
    }
public function addRealm(Realm $realm)
    {
        $realmName = $realm->getRealmName();

        if (!static::validRealmName($realm->getRealmName())) {
            throw new InvalidRealmNameException;
        }

        if (array_key_exists($realm->getRealmName(), $this->realms)) {
            throw new \Exception('There is already a realm \'' . $realm->getRealmName() . '\'');
        }

        Logger::debug($this, 'Adding realm \'' . $realmName . '\'');

        $this->realms[$realm->getRealmName()] = $realm;

        $this->router->getEventDispatcher()->dispatch('new_realm', new NewRealmEvent($realm));
    }
public function addRealm ( Realm $ realm ) { $ realmName = $ realm -> getRealmName ( ) ; if ( ! static :: validRealmName ( $ realm -> getRealmName ( ) ) ) { throw new InvalidRealmNameException ; } if ( array_key_exists ( $ realm -> getRealmName ( ) , $ this -> realms ) ) { throw new \ Exception ( 'There is already a realm \'' . $ realm -> getRealmName ( ) . '\'' ) ; } Logger :: debug ( $ this , 'Adding realm \'' . $ realmName . '\'' ) ; $ this -> realms [ $ realm -> getRealmName ( ) ] = $ realm ; $ this -> router -> getEventDispatcher ( ) -> dispatch ( 'new_realm' , new NewRealmEvent ( $ realm ) ) ; }
Add new realm

@param \Thruway\Realm $realm
@throws \Thruway\Exception\InvalidRealmNameException
@throws \Exception
Add new realm