Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Modules/Request/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@foreach($request as $key => $value)
<tr>
<td>{{ $key }}</td>
<td>{{ str_limit($value) }}</td>
<td>{{ anbu_str_limit($value) }}</td>
</tr>
@endforeach
</tbody>
Expand All @@ -34,7 +34,7 @@
@foreach($requestHeaders as $key => $value)
<tr>
<td>{{ $key }}</td>
<td class="code">{{ str_limit($value[0]) }}</td>
<td class="code">{{ anbu_str_limit($value[0]) }}</td>
</tr>
@endforeach
</tbody>
Expand All @@ -56,7 +56,7 @@
@foreach($responseHeaders as $key => $value)
<tr>
<td>{{ $key }}</td>
<td class="code">{{ str_limit($value[0]) }}</td>
<td class="code">{{ anbu_str_limit($value[0]) }}</td>
</tr>
@endforeach
</tbody>
Expand All @@ -78,7 +78,7 @@
@foreach($server as $key => $value)
<tr>
<td>{{ $key }}</td>
<td class="code">{{ str_limit($value) }}</td>
<td class="code">{{ anbu_str_limit($value) }}</td>
</tr>
@endforeach
</tbody>
Expand Down
29 changes: 29 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<i>No data</i>';
}
}