public function getPath(array $pathParameters = null) {

		$path = $this->path;
		
		//insert path parameters
			
		if(!empty($this->placeholders)) {
			
			foreach ($this->placeholders as $placeholder) {

				// use path parameter if it was passed on

				$regExp = '~\{' . $placeholder['name'] . '(=.*?)?\}~';
				
				if($pathParameters && array_key_exists($placeholder['name'], $pathParameters)) {
					
					$path = preg_replace($regExp, $pathParameters[$placeholder['name']], $path);
					
				}

				// try to use previously set path parameter
				
				else if($this->pathParameters && array_key_exists($placeholder['name'], $this->pathParameters)) {
					$path = preg_replace($regExp, $this->pathParameters[$placeholder['name']], $path);
				}

				// no path parameter value passed on, but default defined
				
				else if(isset($placeholder['default'])){
					$path = preg_replace($regExp, $placeholder['default'], $path);
				}

				else {
					throw new \RuntimeException(sprintf("Path parameter '%s' not set.", $placeholder['name']));
				}

			}
		}

		// remove trailing slashes which might stem from one or more empty path parameters

		return rtrim($path, '/');

	}
public function getPath(array $pathParameters = null) {

		$path = $this->path;
		
		//insert path parameters
			
		if(!empty($this->placeholders)) {
			
			foreach ($this->placeholders as $placeholder) {

				// use path parameter if it was passed on

				$regExp = '~\{' . $placeholder['name'] . '(=.*?)?\}~';
				
				if($pathParameters && array_key_exists($placeholder['name'], $pathParameters)) {
					
					$path = preg_replace($regExp, $pathParameters[$placeholder['name']], $path);
					
				}

				// try to use previously set path parameter
				
				else if($this->pathParameters && array_key_exists($placeholder['name'], $this->pathParameters)) {
					$path = preg_replace($regExp, $this->pathParameters[$placeholder['name']], $path);
				}

				// no path parameter value passed on, but default defined
				
				else if(isset($placeholder['default'])){
					$path = preg_replace($regExp, $placeholder['default'], $path);
				}

				else {
					throw new \RuntimeException(sprintf("Path parameter '%s' not set.", $placeholder['name']));
				}

			}
		}

		// remove trailing slashes which might stem from one or more empty path parameters

		return rtrim($path, '/');

	}
public function getPath ( array $ pathParameters = null ) { $ path = $ this -> path ; //insert path parameters if ( ! empty ( $ this -> placeholders ) ) { foreach ( $ this -> placeholders as $ placeholder ) { // use path parameter if it was passed on $ regExp = '~\{' . $ placeholder [ 'name' ] . '(=.*?)?\}~' ; if ( $ pathParameters && array_key_exists ( $ placeholder [ 'name' ] , $ pathParameters ) ) { $ path = preg_replace ( $ regExp , $ pathParameters [ $ placeholder [ 'name' ] ] , $ path ) ; } // try to use previously set path parameter else if ( $ this -> pathParameters && array_key_exists ( $ placeholder [ 'name' ] , $ this -> pathParameters ) ) { $ path = preg_replace ( $ regExp , $ this -> pathParameters [ $ placeholder [ 'name' ] ] , $ path ) ; } // no path parameter value passed on, but default defined else if ( isset ( $ placeholder [ 'default' ] ) ) { $ path = preg_replace ( $ regExp , $ placeholder [ 'default' ] , $ path ) ; } else { throw new \ RuntimeException ( sprintf ( "Path parameter '%s' not set." , $ placeholder [ 'name' ] ) ) ; } } } // remove trailing slashes which might stem from one or more empty path parameters return rtrim ( $ path , '/' ) ; }
get path of route

When path parameters are passed on to method a path using these
parameter values is generated, but path parameters are not
stored and do not overwrite previously set path parameters.

When no (or only some) path parameters are passed on previously
set path parameters are considered when generating the path.

expects path parameters when required by route

@param array $pathParameters
@throws \RuntimeException
@return string
get path of route