From eb5f5d903198fde6fa5ce31633dbfe14deffd471 Mon Sep 17 00:00:00 2001 From: Andrii Vasyliev Date: Sun, 1 Oct 2017 17:02:26 +0000 Subject: [PATCH] added `normalizeScopedName` --- src/models/AssetPackage.php | 7 ++++++- src/views/package/_search_item.php | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/models/AssetPackage.php b/src/models/AssetPackage.php index fed4a14..5d8c99c 100644 --- a/src/models/AssetPackage.php +++ b/src/models/AssetPackage.php @@ -36,7 +36,12 @@ class AssetPackage extends Object public static function normalizeName($name) { - return strtolower($name); + return strtolower(static::normalizeScopedName($name)); + } + + public static function normalizeScopedName($name) + { + return preg_replace("#@(.+?)/#", '${1}--', $name); } /** diff --git a/src/views/package/_search_item.php b/src/views/package/_search_item.php index 03a8321..7d4f52b 100644 --- a/src/views/package/_search_item.php +++ b/src/views/package/_search_item.php @@ -9,14 +9,15 @@ $logoUrl = $bundle->baseUrl . '/logo'; $package = new AssetPackage(strtolower($model->platform), $model->name); -$url = Url::to(['package/detail', 'fullname' => $package->fullName]); +$url = Url::to(['package/detail', 'fullname' => $package->getNormalName()]); $url = str_replace('%2F', '/', $url); ?>

- fullName) ?> + getName() ?> + getNormalName()) ?>

description): ?>

description) ?>