class Substring extends StringMutator (View source)

Extracts a substring from a string

Traits

Properties

protected $encoding from  UsesEncoding
protected $length
protected $start

Methods

__construct(int $start, int $length = null, string $encoding = null)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
string|null
getEncoding(string $input = null)

No description

static Substring
make(int $start, int $length = null, string $encoding = null)

No description

mixed
mutate(mixed $value)

Mutate the input value.

string
mutateString(string $value)

No description

string
resolveStringInput(mixed $value)

No description

void
setEncoding(string|null $encoding)

No description

void
validateEncoding(string|null $encoding)

No description

Details

__construct(int $start, int $length = null, string $encoding = null)

No description

Parameters

int $start

The position to start extraction from.

int $length

The number of characters to extract (optional).

string $encoding

The encoding to use (optional).

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

protected string|null getEncoding(string $input = null)

No description

Parameters

string $input

Return Value

string|null

static Substring make(int $start, int $length = null, string $encoding = null)

No description

Parameters

int $start

The position to start extraction from.

int $length

The number of characters to extract (optional).

string $encoding

The encoding to use (optional).

Return Value

Substring

final mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

protected string mutateString(string $value)

No description

Parameters

string $value

Return Value

string

protected string resolveStringInput(mixed $value)

No description

Parameters

mixed $value

Return Value

string

protected void setEncoding(string|null $encoding)

No description

Parameters

string|null $encoding

Return Value

void

protected void validateEncoding(string|null $encoding)

No description

Parameters

string|null $encoding

Return Value

void