yii\web\UrlRule::substitutePlaceholderNames PHP Method

substitutePlaceholderNames() protected method

When found - replaces this placeholder key with a appropriate name of matching parameter. Used in UrlRule::parseRequest, UrlRule::createUrl.
See also: placeholders
Since: 2.0.7
protected substitutePlaceholderNames ( array $matches ) : array
$matches array result of `preg_match()` call
return array input array with replaced placeholder keys
    protected function substitutePlaceholderNames(array $matches)
    {
        foreach ($this->placeholders as $placeholder => $name) {
            if (isset($matches[$placeholder])) {
                $matches[$name] = $matches[$placeholder];
                unset($matches[$placeholder]);
            }
        }
        return $matches;
    }