diff --git a/src/Modules/Request/default.blade.php b/src/Modules/Request/default.blade.php
index dc8afc2..0b46293 100644
--- a/src/Modules/Request/default.blade.php
+++ b/src/Modules/Request/default.blade.php
@@ -12,7 +12,7 @@
@foreach($request as $key => $value)
| {{ $key }} |
- {{ str_limit($value) }} |
+ {{ anbu_str_limit($value) }} |
@endforeach
@@ -34,7 +34,7 @@
@foreach($requestHeaders as $key => $value)
| {{ $key }} |
- {{ str_limit($value[0]) }} |
+ {{ anbu_str_limit($value[0]) }} |
@endforeach
@@ -56,7 +56,7 @@
@foreach($responseHeaders as $key => $value)
| {{ $key }} |
- {{ str_limit($value[0]) }} |
+ {{ anbu_str_limit($value[0]) }} |
@endforeach
@@ -78,7 +78,7 @@
@foreach($server as $key => $value)
| {{ $key }} |
- {{ str_limit($value) }} |
+ {{ anbu_str_limit($value) }} |
@endforeach
diff --git a/src/helpers.php b/src/helpers.php
index 0d3db98..d2d0181 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -10,3 +10,32 @@ function ad($value) {
app('Anbu\\Profiler')->getModule('debug')->debug($value);
}
}
+
+if ( ! function_exists('anbu_str_limit'))
+{
+ // str_limit() function with some checks
+ function anbu_str_limit($value)
+ {
+ // when value not is null or empty
+ if ( ! is_null($value) && $value !== '')
+ {
+ $data = $value;
+
+ // to json (object or array)
+ if (is_array($value) || is_object($value))
+ {
+ $data = json_encode($value);
+ }
+ // to string (int, float, etc)
+ elseif ( ! is_string($value))
+ {
+ $data = (string) $value;
+ }
+
+ return str_limit($data);
+ }
+
+ // when no data in value
+ return 'No data';
+ }
+}