src/UriHandler.php
private function prepareSegment(string $name, string $segment): string
    {
        if (!empty($segment)) {
            return $this->filterSegment($segment);
        }

        if (!isset($this->constrains[$name])) {
            return self::DEFAULT_SEGMENT;
        }

        if (is_array($this->constrains[$name])) {
            $values = array_map([$this, 'filterSegment'], $this->constrains[$name]);

            return join('|', $values);
        }

        return $this->filterSegment((string)$this->constrains[$name]);
    }
private function prepareSegment(string $name, string $segment): string
    {
        if (!empty($segment)) {
            return $this->filterSegment($segment);
        }

        if (!isset($this->constrains[$name])) {
            return self::DEFAULT_SEGMENT;
        }

        if (is_array($this->constrains[$name])) {
            $values = array_map([$this, 'filterSegment'], $this->constrains[$name]);

            return join('|', $values);
        }

        return $this->filterSegment((string)$this->constrains[$name]);
    }
private function prepareSegment ( string $ name , string $ segment ) : string { if ( ! empty ( $ segment ) ) { return $ this -> filterSegment ( $ segment ) ; } if ( ! isset ( $ this -> constrains [ $ name ] ) ) { return self :: DEFAULT_SEGMENT ; } if ( is_array ( $ this -> constrains [ $ name ] ) ) { $ values = array_map ( [ $ this , 'filterSegment' ] , $ this -> constrains [ $ name ] ) ; return join ( '|' , $ values ) ; } return $ this -> filterSegment ( ( string ) $ this -> constrains [ $ name ] ) ; }
Prepares segment pattern with given constrains.

@param string $name
@param string $segment
@return string
Prepares segment pattern with given constrains .