protected function parseSegment($segment)
	{
		$optional = false;

		list($regex, $name) = \explode(":", $segment);

		if (\substr($name, -1) === "?")
		{
			$name = \substr($name, 0, -1);
			$optional = true;
		}

		if ($regex === "")
		{
			$regex = "[^\/]+";
		}

		$regex = "/(?P<{$name}>{$regex})";

		if ($optional)
		{
			$regex = "(?:{$regex})?";
		}

		return array(
			'segment' => $segment,
			'token' => "/".$segment,
			'name' => $name,
			'regex' => $regex,
			'optional' => $optional
		);
	}
protected function parseSegment($segment)
	{
		$optional = false;

		list($regex, $name) = \explode(":", $segment);

		if (\substr($name, -1) === "?")
		{
			$name = \substr($name, 0, -1);
			$optional = true;
		}

		if ($regex === "")
		{
			$regex = "[^\/]+";
		}

		$regex = "/(?P<{$name}>{$regex})";

		if ($optional)
		{
			$regex = "(?:{$regex})?";
		}

		return array(
			'segment' => $segment,
			'token' => "/".$segment,
			'name' => $name,
			'regex' => $regex,
			'optional' => $optional
		);
	}
protected function parseSegment ( $ segment ) { $ optional = false ; list ( $ regex , $ name ) = \ explode ( ":" , $ segment ) ; if ( \ substr ( $ name , - 1 ) === "?" ) { $ name = \ substr ( $ name , 0 , - 1 ) ; $ optional = true ; } if ( $ regex === "" ) { $ regex = "[^\/]+" ; } $ regex = "/(?P<{$name}>{$regex})" ; if ( $ optional ) { $ regex = "(?:{$regex})?" ; } return array ( 'segment' => $ segment , 'token' => "/" . $ segment , 'name' => $ name , 'regex' => $ regex , 'optional' => $ optional ) ; }
Pulls out relevent information on a given segment.

@param  string $segment The segment
@return array           ['segment' => (string), name' => (string), 'regex' => (string), 'optional' => (boolean)]
Pulls out relevent information on a given segment .