class TrimStrings extends TransformsRequest (View source)

Properties

protected array<int,string> $except

The attributes that should not be trimmed.

static protected array $neverTrim

The globally ignored attributes that should not be trimmed.

static protected array $skipCallbacks

All of the registered skip callbacks.

Methods

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

void
clean(Request $request)

Clean the request's data.

void
cleanParameterBag(ParameterBag $bag)

Clean the data in the parameter bag.

array
cleanArray(array $data, string $keyPrefix = '')

Clean the data in the given array.

mixed
cleanValue(string $key, mixed $value)

Clean the given value.

mixed
transform(string $key, mixed $value)

Transform the given value.

bool
shouldSkip(string $key, array $except)

Determine if the given key should be skipped.

static void
except(array|string $attributes)

Indicate that the given attributes should never be trimmed.

static void
skipWhen(Closure $callback)

Register a callback that instructs the middleware to be skipped.

static void
flushState()

Flush the middleware's global state.

Details

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

protected void clean(Request $request)

Clean the request's data.

Parameters

Request $request

Return Value

void

protected void cleanParameterBag(ParameterBag $bag)

Clean the data in the parameter bag.

Parameters

ParameterBag $bag

Return Value

void

protected array cleanArray(array $data, string $keyPrefix = '')

Clean the data in the given array.

Parameters

array $data
string $keyPrefix

Return Value

array

protected mixed cleanValue(string $key, mixed $value)

Clean the given value.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed transform(string $key, mixed $value)

Transform the given value.

Parameters

string $key
mixed $value

Return Value

mixed

protected bool shouldSkip(string $key, array $except)

Determine if the given key should be skipped.

Parameters

string $key
array $except

Return Value

bool

static void except(array|string $attributes)

Indicate that the given attributes should never be trimmed.

Parameters

array|string $attributes

Return Value

void

static void skipWhen(Closure $callback)

Register a callback that instructs the middleware to be skipped.

Parameters

Closure $callback

Return Value

void

static void flushState()

Flush the middleware's global state.

Return Value

void