public function parse($pattern, array $conditions)
    {
        if (strlen($pattern) > 1 && $pattern[0] !== '/') {
            throw new InvalidRoutePatternException(sprintf(
                    'Invalid route pattern: non-root route must be prefixed with \'/\', \'%s\' given',
                    $pattern
            ));
        }

        $segments = [];

        $patternSegments = explode('/', $pattern);
        array_shift($patternSegments);

        foreach ($patternSegments as $key => $patternSegment) {
            if ($this->matchRouteParameters($pattern, $patternSegment, $conditions, $matches, $names)) {
                $regex = $this->compileSegmentRegex($matches, $conditions);

                $segments[] = new ParameterSegment($names, $regex);
            } else {
                $segments[] = new StaticSegment($patternSegment);
            }
        }

        return $segments;
    }