class PositionOf extends Mutator (View source)

Finds the position of the first occurrence of a substring in a string

Traits

Properties

protected $encoding from  UsesEncoding
protected $needle
protected $offset

Methods

__construct(string $needle, bool $last = false, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static PositionOf
first(string $needle, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

string|null
getEncoding(string $input = null)

No description

static PositionOf
last(string $needle, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

static PositionOf
make(string $needle, bool $last = false, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

mixed
mutate(mixed $value)

Mutate the input value.

string
resolveStringInput(mixed $value)

No description

void
setEncoding(string|null $encoding)

No description

void
validateEncoding(string|null $encoding)

No description

Details

__construct(string $needle, bool $last = false, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

Parameters

string $needle

The substring to search for.

bool $last

Whether to search for the last occurrence of the substring (default: false).

int $offset

The position to start searching from (default: 0).

bool $caseSensitive
string $encoding

The encoding to use (optional).

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static PositionOf first(string $needle, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

Parameters

string $needle
int $offset
bool $caseSensitive
string $encoding

Return Value

PositionOf

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

No description

Parameters

string $input

Return Value

string|null

static PositionOf last(string $needle, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

Parameters

string $needle
int $offset
bool $caseSensitive
string $encoding

Return Value

PositionOf

static PositionOf make(string $needle, bool $last = false, int $offset = 0, bool $caseSensitive = true, string $encoding = null)

No description

Parameters

string $needle

The substring to search for.

bool $last

Whether to search for the last occurrence of the substring (default: false).

int $offset

The position to start searching from (default: 0).

bool $caseSensitive
string $encoding

The encoding to use (optional).

Return Value

PositionOf

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

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