Which for PHP

ResultSet
in package

Provides convenient access to the stream of search results.

Table of Contents

__construct()  : mixed
Creates a new result set.
all()  : array<string|int, string>
Returns all instances of the searched command.
first()  : string
Returns the first instance of the searched command.
stream()  : iteratable<string|int, SplFileInfo>
Returns a stream of instances of the searched command.

Methods

__construct()

Creates a new result set.

public __construct(string $command, Finder $finder) : mixed
Parameters
$command : string

The searched command.

$finder : Finder

The finder used to perform the search.

Return values
mixed —

all()

Returns all instances of the searched command.

public all([bool $throwIfNotFound = false ]) : array<string|int, string>
Parameters
$throwIfNotFound : bool = false

Value indicating whether to throw an exception if the command is not found.

Tags
throws
RuntimeException

The command has not been found.

Return values
array<string|int, string> —

All search results, or an empty array if the command is not found.

first()

Returns the first instance of the searched command.

public first([bool $throwIfNotFound = false ]) : string
Parameters
$throwIfNotFound : bool = false

Value indicating whether to throw an exception if the command is not found.

Tags
throws
RuntimeException

The command has not been found.

Return values
string —

The first search result, or an empty string if the command is not found.

stream()

Returns a stream of instances of the searched command.

public stream() : iteratable<string|int, SplFileInfo>
Return values
iteratable<string|int, SplFileInfo> —

A stream of the search results.

Search results