<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Zend\Mvc\Router\Exception;

use 
Zend\Mvc\Exception\ExceptionInterface as Exception;

interface 
ExceptionInterface extends Exception
{
}
 = 
$params[$argPos];

            
/**
             * Check if literal param matches
             */
            
if ($part['literal']) {
                if (
                    (isset(
$part['alternatives']) && !in_array($value$part['alternatives'])) ||
                    (!isset(
$part['alternatives']) && $value != $part['name'])
                ) {
                    return 
null;
                }
            }

            
/**
             * Validate the value against constraints
             */
            
if ($part['hasValue'] && isset($this->constraints[$part['name']])) {
                if (
                    !
preg_match($this->constraints[$part['name']], $value)
                ) {
                    
// constraint failed
                    
return null;
                }
            }

            
/**
             * Store the value
             */
            
if ($part['hasValue']) {
                
$matches[$part['name']] = $value;

            } elseif (isset(
$part['alternatives'])) {
                
// from all alternativesm set matching parameter to TRUE and the rest to FALSE
                
foreach ($part['alternatives'] as $alt) {
                    
$matches[$alt] = $alt == $value;
                }

                
// set alternatives group value
                
$matches[$part['name']] = $value;

            } else {
                
// set matching parameter flag to true
                
$matches[$part['name']] = true;
            }

            
/**
             * Advance to next argument
             */
            
$argPos++;

        }

        
/**
         * Check if we have consumed all positional parameters
         */
        
if ($argPos count($params)) {
            return 
null// there are extraneous params that were not consumed
        
}

        return new 
RouteMatch(array_replace($matches$this->defaults));
    }

    
/**
     * assemble(): Defined by Route interface.
     *
     * @see    \Zend\Mvc\Router\RouteInterface::assemble()
     * @param  array $params
     * @param  array $options
     * @return mixed
     */
    
public function assemble(array $params = array(), array $options = array())
    {
        
$this->assembledParams = array();
    }

    
/**
     * getAssembledParams(): defined by Route interface.
     *
     * @see    RouteInterface::getAssembledParams
     * @return array
     */
    
public function getAssembledParams()
    {
        return 
$this->assembledParams;
    }
}