From cb2090eaf09513667f5fd4c8f1c85b93f6617679 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Wed, 2 Jan 2019 14:42:09 +0100 Subject: [PATCH 1/2] Add extension to slugify client name for selectors Update Changelog Rename extension from slugify to httplug_slugify Rename extension from slugify to httplug_slugify Rename extension from slugify to httplug_slugify --- CHANGELOG.md | 6 ++++ Collector/Twig/HttpPlugSlugifyExtension.php | 36 +++++++++++++++++++++ Resources/config/data-collector.xml | 4 +++ Resources/views/stack.html.twig | 10 +++--- 4 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 Collector/Twig/HttpPlugSlugifyExtension.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c9c9cb..1c35fe87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 1.14.1 + +### Fixed + +- Profiler does not display stack when client name contains dots + ## 1.14.0 ### Added diff --git a/Collector/Twig/HttpPlugSlugifyExtension.php b/Collector/Twig/HttpPlugSlugifyExtension.php new file mode 100644 index 00000000..1127a881 --- /dev/null +++ b/Collector/Twig/HttpPlugSlugifyExtension.php @@ -0,0 +1,36 @@ + + */ +class HttpPlugSlugifyExtension extends \Twig_Extension +{ + /** + * {@inheritdoc} + * + * @return array + */ + public function getFilters() + { + return [ + new \Twig_SimpleFilter('httplug_slugify', [$this, 'slugify'], ['is_safe' => ['html']]), + ]; + } + + /** + * @param $string + * + * @return string + */ + public function slugify($string) + { + return preg_replace('/[^a-zA-Z0-9_-]/u', '_', $string); + } + + public function getName() + { + return 'httplug_slugify'; + } +} diff --git a/Resources/config/data-collector.xml b/Resources/config/data-collector.xml index dd3f3b85..5337003a 100644 --- a/Resources/config/data-collector.xml +++ b/Resources/config/data-collector.xml @@ -26,6 +26,10 @@ + + + + diff --git a/Resources/views/stack.html.twig b/Resources/views/stack.html.twig index 92fba7ff..59ab66b9 100644 --- a/Resources/views/stack.html.twig +++ b/Resources/views/stack.html.twig @@ -1,4 +1,4 @@ -
+
{% if stack.failed %} @@ -23,14 +23,14 @@ {% endif %}
-
+
- - + +
@@ -43,7 +43,7 @@
{% if stack.profiles %} -
+
{% for profile in stack.profiles %}

{{ profile.plugin }}

From 9dd2636590fc4718685d95b9311b1ff9720866e8 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Thu, 3 Jan 2019 09:43:46 +0100 Subject: [PATCH 2/2] Add stack.getClientSlug, remove slugify extension --- CHANGELOG.md | 7 +--- Collector/Stack.php | 8 +++++ Collector/Twig/HttpPlugSlugifyExtension.php | 36 --------------------- Resources/config/data-collector.xml | 4 --- Resources/views/stack.html.twig | 10 +++--- 5 files changed, 14 insertions(+), 51 deletions(-) delete mode 100644 Collector/Twig/HttpPlugSlugifyExtension.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c35fe87..f1c84d58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,6 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. -## 1.14.1 - -### Fixed - -- Profiler does not display stack when client name contains dots - ## 1.14.0 ### Added @@ -21,6 +15,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee ### Fixed - Fix deprecated notice when using symfony/config > 4.2 +- Profiler does not display stack when client name contains dots ## 1.13.1 - 2018-11-28 diff --git a/Collector/Stack.php b/Collector/Stack.php index 815b1239..755e9487 100644 --- a/Collector/Stack.php +++ b/Collector/Stack.php @@ -340,4 +340,12 @@ public function setCurlCommand($curlCommand) { $this->curlCommand = $curlCommand; } + + /** + * @return string + */ + public function getClientSlug() + { + return preg_replace('/[^a-zA-Z0-9_-]/u', '_', $this->client); + } } diff --git a/Collector/Twig/HttpPlugSlugifyExtension.php b/Collector/Twig/HttpPlugSlugifyExtension.php deleted file mode 100644 index 1127a881..00000000 --- a/Collector/Twig/HttpPlugSlugifyExtension.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class HttpPlugSlugifyExtension extends \Twig_Extension -{ - /** - * {@inheritdoc} - * - * @return array - */ - public function getFilters() - { - return [ - new \Twig_SimpleFilter('httplug_slugify', [$this, 'slugify'], ['is_safe' => ['html']]), - ]; - } - - /** - * @param $string - * - * @return string - */ - public function slugify($string) - { - return preg_replace('/[^a-zA-Z0-9_-]/u', '_', $string); - } - - public function getName() - { - return 'httplug_slugify'; - } -} diff --git a/Resources/config/data-collector.xml b/Resources/config/data-collector.xml index 5337003a..dd3f3b85 100644 --- a/Resources/config/data-collector.xml +++ b/Resources/config/data-collector.xml @@ -26,10 +26,6 @@ - - - - diff --git a/Resources/views/stack.html.twig b/Resources/views/stack.html.twig index 59ab66b9..207f1486 100644 --- a/Resources/views/stack.html.twig +++ b/Resources/views/stack.html.twig @@ -1,4 +1,4 @@ -
+
{% if stack.failed %} @@ -23,14 +23,14 @@ {% endif %}
-
+
- - + +
@@ -43,7 +43,7 @@
{% if stack.profiles %} -
+
{% for profile in stack.profiles %}

{{ profile.plugin }}