src/Mvc/Listener/EmailVerificationStrategy.php
public function checkEmailVerification(MvcEvent $event)
    {
        $services = $event->getApplication()->getServiceManager();
        
        $appConfig = $services->get('config');
        $config = $this->defaultConfig;
        if (array_key_exists(self::CONFIG_KEY, $appConfig)) {
            $config = $appConfig[self::CONFIG_KEY] + $config;
        }
        
//         if (empty($config['routeParams'])) {
//             throw new \Exception(sprintf(
//                 "Route parameters missing. Add \"array('%s' => array('routeParams' => array(PARAMETERS)))\" to your configuration", 
//                 self::CONFIG_KEY));
//         }
        
        $routeMatch = $event->getRouteMatch();
        if (in_array($routeMatch->getMatchedRouteName(), $config['routeBlacklist'])) {
            return;
        }
        
        $auth = $services->get($config['authServiceName']);
        if (!$auth->hasIdentity()) {
            return;
        }
        
        $identity = $services->get($config['identityServiceName']);
        $isVerified = $config['identityCheckType'] == 'property' ? 
                $identity->$config['identityCheck'] :
                call_user_func(array($identity, $config['identityCheck']));
        
        if ($isVerified) {
            return;
        }
        
        //$routeMatch = new RouteMatch($config['routeParams']);
        //$event->setRouteMatch($routeMatch);
        return $services->get('controllerPluginManager')->get('redirect')->toRoute($config['route'], $config['routeParams']);
    }
public function checkEmailVerification(MvcEvent $event)
    {
        $services = $event->getApplication()->getServiceManager();
        
        $appConfig = $services->get('config');
        $config = $this->defaultConfig;
        if (array_key_exists(self::CONFIG_KEY, $appConfig)) {
            $config = $appConfig[self::CONFIG_KEY] + $config;
        }
        
//         if (empty($config['routeParams'])) {
//             throw new \Exception(sprintf(
//                 "Route parameters missing. Add \"array('%s' => array('routeParams' => array(PARAMETERS)))\" to your configuration", 
//                 self::CONFIG_KEY));
//         }
        
        $routeMatch = $event->getRouteMatch();
        if (in_array($routeMatch->getMatchedRouteName(), $config['routeBlacklist'])) {
            return;
        }
        
        $auth = $services->get($config['authServiceName']);
        if (!$auth->hasIdentity()) {
            return;
        }
        
        $identity = $services->get($config['identityServiceName']);
        $isVerified = $config['identityCheckType'] == 'property' ? 
                $identity->$config['identityCheck'] :
                call_user_func(array($identity, $config['identityCheck']));
        
        if ($isVerified) {
            return;
        }
        
        //$routeMatch = new RouteMatch($config['routeParams']);
        //$event->setRouteMatch($routeMatch);
        return $services->get('controllerPluginManager')->get('redirect')->toRoute($config['route'], $config['routeParams']);
    }
public function checkEmailVerification ( MvcEvent $ event ) { $ services = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ appConfig = $ services -> get ( 'config' ) ; $ config = $ this -> defaultConfig ; if ( array_key_exists ( self :: CONFIG_KEY , $ appConfig ) ) { $ config = $ appConfig [ self :: CONFIG_KEY ] + $ config ; } //         if (empty($config['routeParams'])) { //             throw new \Exception(sprintf( //                 "Route parameters missing. Add \"array('%s' => array('routeParams' => array(PARAMETERS)))\" to your configuration",  //                 self::CONFIG_KEY)); //         } $ routeMatch = $ event -> getRouteMatch ( ) ; if ( in_array ( $ routeMatch -> getMatchedRouteName ( ) , $ config [ 'routeBlacklist' ] ) ) { return ; } $ auth = $ services -> get ( $ config [ 'authServiceName' ] ) ; if ( ! $ auth -> hasIdentity ( ) ) { return ; } $ identity = $ services -> get ( $ config [ 'identityServiceName' ] ) ; $ isVerified = $ config [ 'identityCheckType' ] == 'property' ? $ identity -> $ config [ 'identityCheck' ] : call_user_func ( array ( $ identity , $ config [ 'identityCheck' ] ) ) ; if ( $ isVerified ) { return ; } //$routeMatch = new RouteMatch($config['routeParams']); //$event->setRouteMatch($routeMatch); return $ services -> get ( 'controllerPluginManager' ) -> get ( 'redirect' ) -> toRoute ( $ config [ 'route' ] , $ config [ 'routeParams' ] ) ; }
Check if the email address is verified and if not redirects to a
specified route.

@param MvcEvent $event
Check if the email address is verified and if not redirects to a specified route .